Esempio n. 1
0
        public void ActionCommand(int commandRotate, IGenericGameArea 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;
            }
        }
Esempio n. 2
0
        public void MoveCommand(int commandRotate, IGenericGameArea gameArea)
        {
            ActionCommand(commandRotate, gameArea);

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

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