Exemple #1
0
            public static CutterWrapper CreateNewCutter(ILevelManager level, AggressivePlayer player)
            {
                foreach (var position in PossiblePositions)
                {
                    ITile tile = GetTileRelativeToKeepCenter(position, player);
                    if (player.takenPositions.Contains(position) ||
                        !player.type.TreeCutter.CanBuild(tile.MapLocation, player.Player, level))
                    {
                        continue;
                    }

                    IBuilding newBuilding = level.BuildBuilding(player.type.TreeCutter.MyTypeInstance,
                                                                tile.MapLocation,
                                                                Quaternion.Identity,
                                                                player.Player);
                    if (newBuilding != null)
                    {
                        player.takenPositions.Add(position);
                        return(new CutterWrapper(newBuilding, player, position));
                    }
                }
                return(null);
            }