Exemplo n.º 1
0
 internal static void IncrementScore(uint scoreIncrement)
 {
     SoundManager.PlaySound(DataHandler.Sounds[SoundType.Score], SoundCategory.SFX);
     UserData.GameState.Score += scoreIncrement;
 }
Exemplo n.º 2
0
 internal static void GameOver()
 {
     SoundManager.PlaySound(DataHandler.Sounds[SoundType.Gameover], SoundCategory.SFX);
     ((StageCont)StageCont.GetInstance()).ShowGameOver();
 }
Exemplo n.º 3
0
        public override void Update(GameTime time)
        {
            Vector3 newpos = Position;
            Vector3 newrot = Rotation;

            if (!Attacking && Alive)
            {
                // Vector3 is passed on assignment as a clone not a reference
                if (InputManager.IsKeyDown(Keys.W))
                {
                    if (InputManager.IsKeyDown(Keys.A))
                    {
                        newrot.Y += 0.05f;
                        adjusted  = true;
                    }
                    else if (InputManager.IsKeyDown(Keys.D))
                    {
                        newrot.Y -= 0.05f;
                        adjusted  = true;
                    }
                    else if (!ismoving || !adjusted)
                    {
                        newrot = new Vector3(0, World.GetInstance().ActiveCam.Rotation.Y + (float)Math.PI, 0);
                    }
                    newpos.X += speed * (float)Math.Sin(newrot.Y);
                    newpos.Z += speed * (float)Math.Cos(newrot.Y);
                    ismoving  = true;
                }
                else
                {
                    ismoving = adjusted = false;
                }
                var test = new TimeSpan(0, 0, 1);
                if (ismoving)
                {
                    StarWalking();
                }
                else
                {
                    StandStill();
                }
            }
            int prog = (int)(AnimationProgress * 100);

            if (Alive && ismoving && prog % 50 == 0)
            {
                SoundManager.PlaySound(StepSounds[ran.Next(StepSounds.Length)], SoundCategory.SFX);
            }
            if (Attacking)
            {
                if (prog > 50)
                {
                    OnFinishedPlayingAnimation();
                }
                else if (prog > 20)
                {
                    if (!dgthrown)
                    {
                        ThrowDagger();
                    }
                }
            }
            Position = newpos;
            Rotation = newrot;
            World.GetInstance().ActiveCam.Position = Position + camoffset;
            base.Update(time);
        }