protected override bool Initialize(Vehicle vehicle) { if (!base.Initialize(vehicle)) { return(false); } weapons = vehicle.GetComponent <Weapons>(); if (weapons == null) { return(false); } triggerablesManager = vehicle.GetComponent <TriggerablesManager>(); if (triggerablesManager == null) { return(false); } engines = vehicle.GetComponent <VehicleEngines3D>(); if (engines == null) { return(false); } rBody = vehicle.GetComponent <Rigidbody>(); if (rBody == null) { return(false); } return(engines != null); }
/// <summary> /// Focus on the triggerables manager from a different vehicle. /// </summary> /// <param name="vehicle">The new vehicle.</param> public override void SetVehicle(Vehicle vehicle) { if (vehicle != null) { triggerablesManager = vehicle.GetComponent <TriggerablesManager>(); } else { triggerablesManager = null; } }
/// <summary> /// Focus on the triggerables manager from a different vehicle. /// </summary> /// <param name="vehicle">The new vehicle.</param> public virtual void OnFocusedVehicleChanged(Vehicle vehicle) { if (vehicle != null) { triggerablesManager = vehicle.GetComponent <TriggerablesManager>(); } else { triggerablesManager = null; } }
/// <summary> /// Initialize the vehicle input with a vehicle. /// </summary> /// <param name="vehicle">The vehicle reference.</param> /// <returns>Whether initialization succeeded.</returns> protected override bool Initialize(Vehicle vehicle) { // Clear dependencies triggerablesManager = null; // Make sure the vehicle has a Triggerables component triggerablesManager = vehicle.GetComponent <TriggerablesManager>(); if (triggerablesManager == null) { return(false); } return(true); }