// Use this for initialization
 //
 void Awake()
 {
     //
     controlBoard = GameObject.FindGameObjectWithTag("GameController").GetComponent <SilantroControls> ();
     if (controlBoard == null)
     {
         Debug.LogError("Control Board is missing, Place Control Board in scene and restart!");
     }
     stopEngine = controlBoard.engineShutdown; dumpFuelKey = controlBoard.dumpFuelControl; refuelTankKey = controlBoard.refuelControl;
     //FUEL SETUP
     if (internalFuelTank != null)
     {
         TotalFuelRemaining = 0;
         if (externalTanks.Count > 0)
         {
             foreach (SilantroFuelTank external in externalTanks)
             {
                 TotalFuelRemaining += external.Capacity;
             }
         }
         TotalFuelRemaining += internalFuelTank.Capacity;
         CurrentTank         = internalFuelTank;
         //
     }
     else
     {
         Debug.Log("No internal fuel tank is assigned to distributor!!");
     }
     //
 }
Exemple #2
0
    void Awake()
    {
        controlBoard = GameObject.FindGameObjectWithTag("GameController").GetComponent <SilantroControls> ();
        if (controlBoard == null)
        {
            Debug.LogError("Control Board is missing, Place Control Board in scene and restart!");
        }
        //
        startEngine  = controlBoard.engineStart;
        stopEngine   = controlBoard.engineShutdown;
        throttleUp   = controlBoard.engineThrottleUp;
        throttleDown = controlBoard.engineThrottleDown;
        //
        GameObject brain = GameObject.FindGameObjectWithTag("Brain");

        if (brain != null && brain.transform.root == gameObject.transform.root)
        {
            instrumentation = brain.GetComponent <SilantroInstrumentation> ();
        }

        if (instrumentation == null)
        {
            //instrumentation.Store ();
            Debug.LogError("Instrumentation is missing!! If Engine is just for Test, add Instrumentation Prefab to the Scene");
        }
    }
Exemple #3
0
    //
    void Awake()
    {
        //
        if (pushDirection == PushDirection.Backward)
        {
            direction = -1;
        }
        else if (pushDirection == PushDirection.forward)
        {
            direction = 1;
        }
        controlBoard  = GameObject.FindGameObjectWithTag("GameController").GetComponent <SilantroControls> ();
        panelControls = GameObject.FindGameObjectWithTag("PanelControls").GetComponent <PanelControls> ();

        if (controlBoard == null)
        {
            Debug.LogError("Control Board is missing, Place Control Board in scene and restart!");
        }
        brake        = controlBoard.BrakeHoldRelease;
        gearActivate = controlBoard.LandingGear;
        GameObject attachee = new GameObject();

        attachee.transform.parent        = this.transform;
        attachee.transform.localPosition = new Vector3(0, 0, 0);
        attachee.transform.name          = "Mechanical Sounds";
        mechanicalSounds = attachee.AddComponent <AudioSource>();
        brakeActivated   = true;
        //
    }
 void Awake()
 {
     controlBoard = GameObject.FindGameObjectWithTag("GameController").GetComponent <SilantroControls> ();
     if (controlBoard == null)
     {
         Debug.LogError("Control Board is missing, Place Control Board in scene and restart!");
     }
     //
     ControlInput = controlBoard.FlapControl;
     controlCurve = controlBoard.controlCurve;
 }
 void Awake()
 {
     controlBoard = GameObject.FindGameObjectWithTag("GameController").GetComponent <SilantroControls> ();
     if (controlBoard == null)
     {
         Debug.LogError("Control Board is missing, Place Control Board in scene and restart!");
     }
     //
     if (surfaceType == SurfaceType.Aileron)
     {
         ControlInput = controlBoard.Aileron;
     }
     else if (surfaceType == SurfaceType.Elevator)
     {
         ControlInput = controlBoard.Elevator;
     }
     else if (surfaceType == SurfaceType.Rudder)
     {
         ControlInput = controlBoard.Rudder;
     }
 }
    void Awake()
    {
        //
        //ADD AUDIOSOURCES
        if (null != EngineStartSound)
        {
            EngineStart              = Thruster.gameObject.AddComponent <AudioSource>();
            EngineStart.clip         = EngineStartSound;
            EngineStart.loop         = false;
            EngineStart.dopplerLevel = 0f;
            EngineStart.spatialBlend = 1f;
            EngineStart.rolloffMode  = AudioRolloffMode.Custom;
            EngineStart.maxDistance  = 650f;
        }
        if (null != EngineIdleSound)
        {
            GameObject soundPoint = new GameObject();
            soundPoint.transform.parent        = this.transform;
            soundPoint.transform.localPosition = new Vector3(0, 0, 0);
            soundPoint.name = this.name + " Sound Point";
            //

            EngineRun      = soundPoint.gameObject.AddComponent <AudioSource>();
            EngineRun.clip = EngineIdleSound;
            EngineRun.loop = true;
            EngineRun.Play();
            engineSoundVolume      = EngineRun.volume * 2f;
            EngineRun.spatialBlend = 1f;
            EngineRun.dopplerLevel = 0f;
            EngineRun.rolloffMode  = AudioRolloffMode.Custom;
            EngineRun.maxDistance  = 600f;
        }
        if (null != EngineShutdownSound)
        {
            EngineShutdown              = Thruster.gameObject.AddComponent <AudioSource>();
            EngineShutdown.clip         = EngineShutdownSound;
            EngineShutdown.loop         = false;
            EngineShutdown.dopplerLevel = 0f;
            EngineShutdown.spatialBlend = 1f;
            EngineShutdown.rolloffMode  = AudioRolloffMode.Custom;
            EngineShutdown.maxDistance  = 650f;
        }

        //
        GameObject brain = GameObject.FindGameObjectWithTag("Brain");

        if (brain.transform.root == gameObject.transform.root)
        {
            instrumentation = brain.GetComponent <SilantroInstrumentation> ();
        }
        if (instrumentation == null)
        {
            Debug.LogError("Instrumentation System is Missing!! Add COG to aircraft");
        }
        else
        {
            instrumentation.boom = EngineRun;
        }
        //
        controlBoard  = GameObject.FindGameObjectWithTag("GameController").GetComponent <SilantroControls> ();
        panelControls = GameObject.FindGameObjectWithTag("PanelControls").GetComponent <PanelControls> ();
        if (controlBoard == null)
        {
            Debug.LogError("Control Board is missing, Place Control Board in scene and restart!");
        }
        startEngine        = controlBoard.engineStart;
        stopEngine         = controlBoard.engineShutdown;
        throttleUp         = controlBoard.engineThrottleUp;
        throttleDown       = controlBoard.engineThrottleDown;
        afterburnerControl = controlBoard.AfterburnerControl;
        //
        LPIdleRPM = LowPressureFanRPM * 0.1f;
        HPIdleRPM = HighPressureFanRPM * 0.09f;
        //
        if (reheatSystem == ReheatSystem.Afterburning)
        {
            canUseAfterburner = true;
        }
        else if (reheatSystem == ReheatSystem.noReheat)
        {
            canUseAfterburner = false;
        }
        //
        AfterburnerOperative = false;
    }