/// <summary>
        /// Start is called on the frame when a script is enabled just before any of the Update methods is called the first time.
        /// </summary>
        protected virtual void Start()
        {
            if (this._inDesigner)
            {
                return;
            }

            // Grab a reference to the modifier and aircraft controls as we will need them every frame
            this._modifier = (SmokeTrails)this.PartModifier;
            this._controls = ServiceProvider.Instance.PlayerAircraft.Controls;

            // Determine the color of the smoke which is driven by the paint color for the part
            this._color = this.LookupColor();

            // Find our primary light source so we can adjust the particle color with the time of day
            this._light = FindDirectionalLight();
            if (this._light == null)
            {
                Debug.LogError("Could not find the light source for the level.");
            }

            // Grab a reference to the particle system that will be emitting the smoke
            this._particleSystem = this.GetComponentInChildren <ParticleSystem>(true);
            if (this._particleSystem == null)
            {
                Debug.LogError("Particle system not found for smoke trail emitter.");
                return;
            }

            // Initialize our particle system and fire it up.
            this.InitializeParticleSystem();
            this._particleSystem.Play();
        }
Exemple #2
0
    private void Start()
    {
        if (inDesigner)
        {
            return;
        }
        modifier    = (GPWSCore)PartModifier;
        controls    = sp.PlayerAircraft.Controls;
        audioSource = Camera.main.gameObject.AddComponent <AudioSource>();

        alt   = GroundAltitude();
        angle = BankAngle();
    }