示例#1
0
        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);
        }
示例#2
0
 /// <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;
     }
 }
示例#4
0
        /// <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);
        }