Exemple #1
0
 public void Jump()
 {
     if (!Jumping /*&& !Anim.GetCurrentAnimatorStateInfo(0).IsName(MagicName)*/)
     {
         JumpSound.Play();
         rb2D.AddForce(Vector2.up * ForceAmmount);
         Jumping = true;
     }
 }
Exemple #2
0
        private void PlayJumpSound()
        {
            JumpSound evnt = JumpSound.Create(Bolt.GlobalTargets.Others);

            evnt.Player = entity;
            evnt.Send();

            m_AudioSource.clip = m_JumpSound;
            m_AudioSource.Play();
        }
Exemple #3
0
    public override void OnEvent(JumpSound evnt)
    {
        if (evnt.Player.IsOwner)
        {
            return;
        }
        var script = evnt.Player.gameObject.GetComponent <PlayerStartScript>();

        script.PlayJumpSound();
    }
Exemple #4
0
        public void Update()
        {
            Input.Update();

            Camera.Update();

            if (Input.Jump())
            {
                if (Paused)
                {
                    Reset();
                }
                else
                {
                    if (Player.Jump())
                    {
                        JumpSound.Play();
                    }
                }
            }

            if (Paused)
            {
                return;
            }

            BG.Update();
            Road.Update();
            Foreground.Update();

            for (int i = 0; i < Obstacles.Count; i++)
            {
                Obstacles[i].Update();
                if (!Obstacles[i].Active)
                {
                    Obstacles.RemoveAt(i--);
                    score++;
                    Coin.Play();
                }
            }

            Player.Update();

            if (counter++ >= 60)
            {
                AddObstacle();
                counter = 0;
            }

            if (CheckCollisions())
            {
                Die();
            }
        }
        public override void Start()
        {
            currentHitpoints        = MaximumHitpoints;
            invulnerabilityCooldown = 1;

            jumpSfxInstance = JumpSound?.CreateInstance();
            jumpSfxInstance?.Stop();
            spawnSfxInstance = SpawnSound?.CreateInstance();
            if (spawnSfxInstance != null)
            {
                // boost sfx volme
                spawnSfxInstance.Volume = 10;
                spawnSfxInstance.Play();
            }
        }
Exemple #6
0
        public void ApplyAcceleration(GameTime gameTime, Vector2 acceleration)
        {
            if (CurrentEntityStates.Contains(EntityStates.Boost))
            {
                Speed += Vector2.UnitX * acceleration / 300 * (float)gameTime.ElapsedGameTime.TotalMilliseconds;
            }
            else
            {
                Speed += Vector2.UnitX * acceleration / 400 * (float)gameTime.ElapsedGameTime.TotalMilliseconds;
            }

            if (acceleration.Y != 0 && !CurrentEntityStates.Contains(EntityStates.OnAir))
            {
                Speed = Speed * Vector2.UnitX - Vector2.UnitY * 0.65f;
                CurrentEntityStates.Add(EntityStates.OnAir);
                JumpSound.Play();
            }
            if (!CurrentEntityStates.Contains(EntityStates.Boost))
            {
                ApplyGravity(gameTime);
            }
            ApplyFriction(gameTime);
        }
Exemple #7
0
 public SoundStrategy_Jump()
 {
     this._Sound = JumpSound.GetInstance();
 }
Exemple #8
0
 static public void PlayJumpSound()
 {
     JumpSound.Play();
 }
Exemple #9
0
 private void Start()
 {
     rigidBody = GetComponent <Rigidbody>();
     jumpSound = GetComponentInChildren <JumpSound>();
 }