Ejemplo n.º 1
0
        public void Collision(IHumanPlayer player, Edge edge)
        {
            double angle = 0;

            switch (edge)
            {
            case Edge.Top:
                angle = player.AngleToHeading(180);
                break;

            case Edge.Bottom:
                angle = player.AngleToHeading(0);
                break;

            case Edge.Left:
                angle = player.AngleToHeading(90);
                break;

            case Edge.Right:
                angle = player.AngleToHeading(270);
                break;

            case Edge.TopAndLeft:
                angle = player.AngleToHeading(90 + 45);
                break;

            case Edge.TopAndRight:
                angle = player.AngleToHeading(180 + 45);
                break;

            case Edge.BottomAndLeft:
                angle = player.AngleToHeading(45);
                break;

            case Edge.BottomAndRight:
                angle = player.AngleToHeading(270 + 45);
                break;
            }
            Console.WriteLine("Turning around {0} degrees", angle);
            player.Turn(angle);
            s = State.Collided;
        }
Ejemplo n.º 2
0
        public void DoSomething(IHumanPlayer player, List <IWalker> zombies, List <IWalker> humans, List <ITakeSpace> obstacles, List <ResupplyPoint> resupply)
        {
            if (player.Movement == MoveState.Moving)
            {
                return;
            }
            switch (state)
            {
            case 0:
                player.Turn(player.AngleToHeading(45));
                state++;
                break;

            case 1:
            case 3:
            case 5:
            case 7:
            case 9:
            case 11:
            case 13:
            case 15:
                player.GoForward(5.0);
                state++;
                break;

            case 2:
                player.Turn(player.AngleToHeading(90));
                state++;
                break;

            case 4:
                player.Turn(player.AngleToHeading(90 + 45));
                state++;
                break;

            case 6:
                player.Turn(player.AngleToHeading(180));
                state++;
                break;

            case 8:
                player.Turn(player.AngleToHeading(180 + 45));
                state++;
                break;

            case 10:
                player.Turn(player.AngleToHeading(270));
                state++;
                break;

            case 12:
                player.Turn(player.AngleToHeading(270 + 45));
                state++;
                break;

            case 14:
                player.Turn(player.AngleToHeading(0));
                state++;
                break;

            case 16:
                player.Turn(rng.NextDouble() * 300.0);
                state = 0;
                break;
            }
        }