Beispiel #1
0
        public virtual void Fire()
        {
            if (AudioSource != null)
            {
                AudioSource.Play();
            }

            // if this effect has an explosion force, apply that now
            CreateExplosion(gameObject.transform.position, ForceRadius, ForceAmount);

            // start any particle system that is not in the list of manual start particle systems
            StartParticleSystems();

            // If we implement the ICollisionHandler interface, see if any of the children are forwarding
            // collision events. If they are, hook into them.
            ICollisionHandler handler = (this as ICollisionHandler);

            if (handler != null)
            {
                FireCollisionForwardScript collisionForwarder = GetComponentInChildren <FireCollisionForwardScript>();
                if (collisionForwarder != null)
                {
                    collisionForwarder.CollisionHandler = handler;
                }
            }
        }
        protected virtual void Start()
        {
            if (AudioSource != null)
            {
                AudioSource.Play();
            }

            // precalculate so we can multiply instead of divide every frame
            stopTimeMultiplier  = 1.0f / StopTime;
            startTimeMultiplier = 1.0f / StartTime;

            // if this effect has an explosion force, apply that now
            CreateExplosion(gameObject.transform.position, ForceRadius, ForceAmount);

            // start any particle system that is not in the list of manual start particle systems
            StartParticleSystems();

            // If we implement the ICollisionHandler interface, see if any of the children are forwarding
            // collision events. If they are, hook into them.
            ICollisionHandler handler = (this as ICollisionHandler);

            if (handler != null)
            {
                FireCollisionForwardScript collisionForwarder = GetComponentInChildren <FireCollisionForwardScript>();
                if (collisionForwarder != null)
                {
                    collisionForwarder.CollisionHandler = handler;
                }
            }
        }
Beispiel #3
0
        protected virtual void Start()
        {
            if (AudioSource != null)
            {
                AudioSource.Play();
            }

            StartParticleSystems();

            ICollisionHandler handler = (this as ICollisionHandler);

            if (handler != null)
            {
                FireCollisionForwardScript collisionForwarder = GetComponentInChildren <FireCollisionForwardScript>();
                if (collisionForwarder != null)
                {
                    collisionForwarder.CollisionHandler = handler;
                }
            }
        }
Beispiel #4
0
        public virtual void StartFire()
        {
            if (AudioSource != null)
            {
                AudioSource.Play();
            }

            // start any particle system that is not in the list of manual start particle systems
            StartParticleSystems();

            // If we implement the ICollisionHandler interface, see if any of the children are forwarding
            // collision events. If they are, hook into them.
            ICollisionHandler handler = (this as ICollisionHandler);

            if (handler != null)
            {
                FireCollisionForwardScript collisionForwarder = GetComponentInChildren <FireCollisionForwardScript>();
                if (collisionForwarder != null)
                {
                    collisionForwarder.CollisionHandler = handler;
                }
            }
        }