Exemple #1
0
        public RighterMob(GameModel model, int X, int Y) : base(model, "Righter", X, Y)
        {
            Action <Keys> TurnDirection = (key) =>
            {
                KeyMap.TurnOn(key);
                MakeMove(key);
            };

            TurnDirection(Keys.Down);

            OnCantMove += (key) =>
            {
                KeyMap.TurnOff();
                switch (key)
                {
                case Keys.Up:
                    TurnDirection(Keys.Right); break;

                case Keys.Down:
                    TurnDirection(Keys.Left); break;

                case Keys.Right:
                    TurnDirection(Keys.Down); break;

                case Keys.Left:
                    TurnDirection(Keys.Up); break;
                }
            };
        }
        public BlueGolemMob(GameModel model, int X, int Y) : base(model, "BlueGolem/", X, Y)
        {
            OnCantMove += (key) =>
            {
                KeyMap.TurnOff();
                switch (key)
                {
                case Keys.Up:
                    GoTo(Keys.Left); break;

                case Keys.Down:
                    GoTo(Keys.Right); break;

                case Keys.Right:
                    GoTo(Keys.Up); break;

                case Keys.Left:
                    GoTo(Keys.Down); break;
                }
            };

            GoTo(Keys.Down);
        }
        public RedGolemMob(GameModel model, int X, int Y) : base(model, "RedGolem/", X, Y)
        {
            OnCantMove += (key) =>
            {
                if (currentTick == Model.TickCount)
                {
                    if (countTurn == 4)
                    {
                        Destroy();
                        return;
                    }
                    countTurn++;
                }
                else
                {
                    countTurn = 1;
                }
                KeyMap.TurnOff();
                switch (key)
                {
                case Keys.Up:
                    GoTo(Keys.Right); break;

                case Keys.Down:
                    GoTo(Keys.Left); break;

                case Keys.Right:
                    GoTo(Keys.Down); break;

                case Keys.Left:
                    GoTo(Keys.Up); break;
                }
            };

            GoTo(Keys.Down);
        }