コード例 #1
0
        public void PlayTankFrictionSound(UpdateEvent evt, ReadyActiveTankFrictionSoundNode tank)
        {
            TankFrictionSoundBehaviour tankFrictionSoundBehaviour = tank.tankFrictionSoundEffectReady.TankFrictionSoundBehaviour;

            if (tankFrictionSoundBehaviour.TriggerStay)
            {
                TankFrictionSoundEffectComponent tankFrictionSoundEffect = tank.tankFrictionSoundEffect;
                Collider frictionCollider = tankFrictionSoundBehaviour.FrictionCollider;
                if (frictionCollider == null)
                {
                    this.StopSounds(tankFrictionSoundEffect);
                }
                else
                {
                    Vector3 velocity = tank.rigidbody.Rigidbody.velocity;
                    if (frictionCollider.gameObject.layer == Layers.FRICTION)
                    {
                        this.SetMetallFriction(tankFrictionSoundEffect, velocity);
                    }
                    else
                    {
                        DustEffectBehaviour effect = tank.collisionDust.CollisionDustBehaviour.Effect;
                        if (effect == null)
                        {
                            this.StopSounds(tankFrictionSoundEffect);
                        }
                        else
                        {
                            DustEffectBehaviour.SurfaceType surface = effect.surface;
                            if (surface == DustEffectBehaviour.SurfaceType.Metal)
                            {
                                this.SetMetallFriction(tankFrictionSoundEffect, velocity);
                            }
                            else if (surface != DustEffectBehaviour.SurfaceType.Concrete)
                            {
                                this.StopSounds(tankFrictionSoundEffect);
                            }
                            else
                            {
                                this.SetStoneFriction(tankFrictionSoundEffect, velocity);
                            }
                        }
                    }
                }
            }
        }
コード例 #2
0
 public void EnableTankFrictionSound(NodeAddedEvent evt, ReadyActiveTankFrictionSoundNode tank)
 {
     tank.tankFrictionSoundEffectReady.TankFrictionCollideSoundBehaviour.enabled = true;
     tank.tankFrictionSoundEffectReady.TankFrictionSoundBehaviour.enabled        = true;
 }