Realistic Car Controller Switch for use with UFPS

I am extending the method I posted on THIS page to work with RCC from BoneCracker Games. You need to also have the base script for this to work.
Follow the same steps from the video.

Link to RCC

Realistic Car Controller Interact Script from Inherited Script

using UnityEngine;
using System.Collections;
// USING THE BASE VehicleInteractSwitch script and adding EVP controls

namespace RedHawk{
	//Using my namespace.  If you want access, you should include using RedHawk; at the top of the script
	public class VehicleInteractSwitchRCC: VehicleInteractSwitch {

		#region Variables - RCCCarControllerV2
		RCCCarControllerV2 m_RCCCarControllerV2;
		RCCCarCamera m_RCCCarCamera;
		RCCCarCameraConfig m_RCCCarCameraConfig;
		#endregion

		//OVERRIDE the Base Start
		protected override void Start(){
			base.Start();

			m_RCCCarControllerV2=Target.GetComponent<RCCCarControllerV2>();
			m_RCCCarControllerV2.runEngineAtAwake = false;
			m_RCCCarControllerV2.canControl = false;
			m_RCCCarControllerV2.engineRunning = false;

			m_RCCCarCamera=vehicleCamera.GetComponent<RCCCarCamera>();
			m_RCCCarCamera.enabled=false;
			m_RCCCarCameraConfig=Target.GetComponent<RCCCarCameraConfig>();
			m_RCCCarCameraConfig.enabled = false;
		}

		//OVERRIDE the Base GetIn
		protected override void GetIn(){
			base.GetIn ();//Run the Base class stuff
			//RCC Vehicle Input
			m_RCCCarControllerV2.canControl = true;
			Target.SendMessage("StartEngine");
			//RCC Vehicle Camera Controller
			m_RCCCarCamera.playerCar = Target.transform;
			m_RCCCarCameraConfig.enabled = true;
			m_RCCCarCamera.enabled = true;
		}

		//OVERRIDE the Base GetOut
		protected override void GetOut(){
			base.GetOut ();//Run the Base class stuff
			//RCC Vehicle Input
			m_RCCCarControllerV2.canControl = false;
			m_RCCCarControllerV2.engineRunning = false;
			//RCC Vehicle Camera Controller
			m_RCCCarCameraConfig.enabled = false;
			m_RCCCarCamera.enabled = false;

		}
	}
}
Advertisements