Esempio n. 1
0
        //Thread thread = new Thread(Console.Beep);

        public void MakeВeliberateAction(ref GameRoom level, int frameTime)
        {
            for (int i = 0; i <= level.lastObjectIndex; i++)
            {
                if (level.gameObj[i].IsActive)
                {
                    if (frameTime % level.gameObj[i].Slowness == 0)
                    {
                        MakeВeliberateAction(ref level, ref level.gameObj[i]);
                    }
                }
            }

            level.gameObj[level.FindPlayerIndex()].Action = UnitActions.None;
        }
Esempio n. 2
0
        private UnitActions BlindBeagle(GameRoom level, GameObject beagle)
        {
            UnitActions beagleAction = UnitActions.None;

            if (beagle.IsActive)
            {
                int        playerIndex  = level.FindPlayerIndex();
                Coordinate playerCenter = level.gameObj[playerIndex].ObjArea.GetCenter();
                Coordinate beagleCenter = beagle.ObjArea.GetCenter();

                int absX = Math.Abs(playerCenter.x - beagleCenter.x);
                int absY = Math.Abs(playerCenter.y - beagleCenter.y);

                if (absX > absY)
                {
                    if (playerCenter.x >= beagleCenter.x)
                    {
                        beagleAction = UnitActions.MoveRight;
                    }
                    else
                    {
                        beagleAction = UnitActions.MoveLeft;
                    }
                }
                else
                {
                    if (playerCenter.y >= beagleCenter.y)
                    {
                        beagleAction = UnitActions.MoveDown;
                    }
                    else
                    {
                        beagleAction = UnitActions.MoveTop;
                    }
                }
            }
            return(beagleAction);
        }
Esempio n. 3
0
 public void SetPlayerDecision(GameRoom level, UnitActions action)
 {
     level.gameObj[level.FindPlayerIndex()].Action = action;
 }