Exemplo n.º 1
0
        public void Process()
        {
            LeftOld = Left;
            TopOld  = Top;

            // Arrow ready to be launched
            if (!fMoving)
            {
                Left = CurrentGame.Barbarian.Bounds.Left + (CurrentGame.Barbarian.Bounds.Width / 2) - (Width / 2);
                Top  = CurrentGame.Barbarian.Bounds.Top - Height;
            }
            // Arrow moving
            else
            {
                // Move it
                Top += VerticalVelocity;

                // check if any Roman were killed
                if (CurrentGame.Legion.KillRomanFromXY(Left, Top))
                {
                    // Stop the arrow
                    Stop();
                }

                // Arrow reach top of the window
                if (Top < 50)
                {
                    //Stop the arrow
                    Stop();
                }

                // Arrow reach the bottom of the window
                if (Top > MaximumY)
                {
                    this.IsAlive = false;
                    this.Stuck   = true;
                }

                // Check if hit the Barbarian
                if (CurrentGame.Barbarian.CollidesWith(this))
                {
                    // If the Arrow hit the Barbarian , game over
                    CurrentGame.Lost();
                }
            }
        }