Manages the destruction of player ship parts, and parent mass change.
Inheritance: UnityEngine.MonoBehaviour
        void Awake()
        {
            // Get Rigidbody variables
            m_myRigid = GetComponent<Rigidbody>();
            m_trans = transform;

            m_myRigid.mass = adjustableMass;
            m_startShipMass = adjustableMass;

            m_anim = GetComponent<Animator>();
            m_shipPartDestroy = GetComponent<ShipPartDestroy>();
            m_shipStallScript = GetComponent<AirshipStallingBehaviour>();
            m_shipStates = GetComponent<StateManager>();

            m_tray = GetComponentInChildren<PassengerTray>();
        }
 /// <summary>
 /// Returns the part input multipliers for the input ship part type.
 /// </summary>
 /// <param name="a_partType">Part type to find.</param>
 /// <param name="ao_primMult">Primary input multiplier. E.g. Balloon affecting roll.</param>
 /// <param name="ao_auxMult">Auxiliary input multiplier. E.g. Balloon causing constant roll input.</param>
 /// <returns>True if the part has been destroyed, false if not.</returns>
 private bool GetPartInputMults(ShipPartDestroy.EShipPartType a_partType, out float ao_primMult, out float ao_auxMult)
 {
     ao_primMult = 0;
     ao_auxMult = 0;
     if (m_shipPartDestroy.IsPartTypeDestroyed(a_partType))
     {
         foreach (ShipPartInputConnection part in shipPartConns)
         {
             // Part of the same type?
             if (part.partType == a_partType)
             {
                 ao_primMult = part.partValueMult;
                 ao_auxMult = part.partAuxValueMult;
                 return true;
             }
         }
     }
     return false;
 }
Exemplo n.º 3
0
        void Awake()
        {
            m_trans = transform;
            m_rb = GetComponent<Rigidbody>();
            m_shipParts = GetComponent<ShipPartDestroy>();
            //m_broadSideWeapons = GetComponent<BroadsideWeaponsController>();
            m_camRotator = GetComponent<RotateCam>();

               // m_rouletteScript = GetComponent<RouletteBehaviour>();
            m_airshipScript = GetComponent<AirshipControlBehaviour>();
            m_dyingScript = GetComponent<AirshipDyingBehaviour>();
            m_stallingScript = GetComponent<AirshipStallingBehaviour>();
            m_suicideScript = GetComponent<AirshipSuicideBehaviour>();

            //m_inputManager = GetComponent<InputManager>();

            // World position & rotation
            m_worldStartPos = m_trans.position;
            m_worldStartRotation = m_trans.rotation;

            //get reference to audio source
            m_Audio = gameObject.GetComponent<AudioSource>();
        }