Exemplo n.º 1
0
        public void ActionCommand(int commandRotate, IGameArea gameArea)
        {
            //TODO: return cell, not only type
            Coordinate targetPosition = AnalyzePosition(commandRotate);
            IBaseCell  cellOnWay      = gameArea.GetCellOnPosition(targetPosition);

            if (cellOnWay == null)
            {
                return;
            }

            PointType cellType = cellOnWay.GetPointType();

            if (cellType == PointType.Food)
            {
                gameArea.TryEat(this, targetPosition);

                return;
            }

            if (cellType == PointType.Cell)
            {
                //Attack?
            }

            if (cellType == PointType.Trap)
            {
                Health = 0;
            }
        }
Exemplo n.º 2
0
        public void MoveCommand(int commandRotate, IGameArea gameArea)
        {
            ActionCommand(commandRotate, gameArea);

            Coordinate targetPosition = AnalyzePosition(commandRotate);
            IBaseCell  targetCell     = gameArea.GetCellOnPosition(targetPosition);

            if (targetCell == null)
            {
                Position = targetPosition;
            }
        }