Example #1
0
        internal void LaunchSnowball(Player thrower)
        {
            bool aCreateNew = true;
            foreach (Snowball snowball in _snowballs)
            {
                if (false)//snowball.Alive == false)
                {
                    aCreateNew = false;
                    snowball.Launch(new Vector2(thrower.Position.X + thrower.Width, thrower.Position.Y), thrower.GetThrowVelocity(), thrower.IsDucking(), thrower);
                    thrower.ReleaseSnowball();
                    break;
                }
            }

            if (aCreateNew == true)
            {
                Snowball aSnowball = new Snowball(_content);
                aSnowball.Launch(new Vector2(thrower.Position.X + thrower.Width, thrower.Position.Y), thrower.GetThrowVelocity(), !thrower.IsDucking(), thrower);
                _snowballs.Add(aSnowball);
            }

            thrower.ReleaseSnowball();
        }
Example #2
0
 public void TakeDamage(Snowball snowball)
 {
     Health -= snowball.Damage;
     snowball.Alive = false;
     if (Health <= 0)
     {
         Alive = false;
         animationPlayer.PlayAnimation(animation, "PlayerForwardAttack", 0.3f, true);
     }
 }