Пример #1
0
    Dictionary <Pos, StatsMilitary> GetPosViewMilitary()
    {
        Dictionary <Pos, Dictionary <Player, float> > military = new Dictionary <Pos, Dictionary <Player, float> >();
        List <Player> players = _game._playerSystem._players;

        foreach (Pos p in _game._locations.Keys)
        {
            military[p] = new Dictionary <Player, float>();
            foreach (Player player in players)
            {
                military[p][player] = 0f;
            }
        }
        foreach (Pos p in _game._locations.Keys)
        {
            HomelandsStructure structure = _game._locations[p]._structure;
            if (structure != null)
            {
                List <HomelandsLocation> visibleLocations = structure.GetLocationsInRadius(eRadius.Military);
                foreach (HomelandsLocation location in visibleLocations)
                {
                    military[location._pos][structure._owner] += 1f;
                }
            }
        }
        Dictionary <Pos, StatsMilitary> militaryStats = new Dictionary <Pos, StatsMilitary>();

        foreach (Pos p in military.Keys)
        {
            militaryStats[p] = new StatsMilitary(military[p]);
        }
        return(militaryStats);
    }
Пример #2
0
    Dictionary <Pos, StatsVision> GetPosViewVision()
    {
        Dictionary <Pos, Dictionary <Player, eVisibility> > visibility = new Dictionary <Pos, Dictionary <Player, eVisibility> >();
        List <Player> players = _game._playerSystem._players;

        foreach (Pos p in _game._locations.Keys)
        {
            visibility[p] = new Dictionary <Player, eVisibility>();
            foreach (Player player in players)
            {
                visibility[p][player] = eVisibility.Unexplored;
            }
        }
        foreach (Pos p in _game._locations.Keys)
        {
            HomelandsStructure structure = _game._locations[p]._structure;
            if (structure != null)
            {
                List <HomelandsLocation> visibleLocations = structure.GetLocationsInRadius(eRadius.Vision);
                foreach (HomelandsLocation location in visibleLocations)
                {
                    visibility[location._pos][structure._owner] = eVisibility.Visible;
                }
            }
        }

        Dictionary <Pos, StatsVision> visionStats = new Dictionary <Pos, StatsVision>();

        foreach (Pos p in visibility.Keys)
        {
            visionStats[p] = new StatsVision(visibility[p]);
        }
        return(visionStats);
    }
Пример #3
0
    Dictionary <Pos, StatsExtraction> GetPosViewExtraction()
    {
        Dictionary <Pos, Dictionary <Player, float> > extractionRaw = new Dictionary <Pos, Dictionary <Player, float> >();
        List <Player> players = _game._playerSystem._players;

        foreach (Pos p in _game._locations.Keys)
        {
            extractionRaw[p] = new Dictionary <Player, float>();
            foreach (Player player in players)
            {
                extractionRaw[p][player] = 0f;
            }
        }
        foreach (Pos p in _game._locations.Keys)
        {
            HomelandsStructure structure = _game._locations[p]._structure;
            if (structure != null)
            {
                List <HomelandsLocation> visibleLocations = structure.GetLocationsInRadius(eRadius.Extraction);
                foreach (HomelandsLocation location in visibleLocations)
                {
                    extractionRaw[location._pos][structure._owner] += 1f;
                }
            }
        }
        Dictionary <Pos, StatsExtraction> extractionStats = new Dictionary <Pos, StatsExtraction>();

        foreach (Pos p in extractionRaw.Keys)
        {
            extractionStats[p] = new StatsExtraction(extractionRaw[p]);
        }
        return(extractionStats);
    }
Пример #4
0
    void UpdateText(Pos pos, eTerrain terrain, HomelandsStructure structure)
    {
        string posString =
            _posText.text = pos._gridLoc.key();

        _terrainText.text   = terrain.ToString();
        _structureText.text = structure == null ? "" : structure.Describe();
    }
Пример #5
0
 void PerformWar()
 {
     foreach (HomelandsLocation location in _locations.Values)
     {
         HomelandsStructure structure = location._structure;
         if (structure != null)
         {
             Player owner = structure._owner;
             Dictionary <Player, float> attackValues = location._stats._military._attack;
             foreach (Player player in attackValues.Keys)
             {
                 if (player != owner)
                 {
                     float attackAmount = attackValues[player];
                     structure.TakeDamage(attackAmount);
                 }
             }
         }
     }
 }
Пример #6
0
 public bool Build()
 {
     Debug.Log("Building Set");
     if (CanAffordSet())
     {
         foreach (dStructurePlacement spd in _set)
         {
             HomelandsStructure newStructure = StructureFactory.Make(spd.location._game, spd);
             spd.location._structure = newStructure;
             _player._resources.Pay(spd.data.cost);
             _player._game._locations[spd.location._pos]._structure = newStructure;
             _player._buildQueue._queue.Remove(spd);
         }
         return(true);
     }
     else
     {
         Debug.Log(_player._name + " can't afford the set!");
         return(false);
     }
 }
Пример #7
0
    Dictionary <Pos, StatsControl> GetPosViewControl()
    {
        Dictionary <Pos, Dictionary <Player, bool> > control = new Dictionary <Pos, Dictionary <Player, bool> >();
        List <Player> players = _game._playerSystem._players;

        foreach (Pos p in _game._locations.Keys)
        {
            control[p] = new Dictionary <Player, bool>();
            foreach (Player player in players)
            {
                control[p][player] = false;
            }
        }
        Player currentPlayer = _game._playerSystem._currentPlayer;

        foreach (Pos p in _game._locations.Keys)
        {
            HomelandsStructure structure = _game._locations[p]._structure;
            if (structure != null)
            {
                List <HomelandsLocation> visibleLocations = structure.GetLocationsInRadius(eRadius.Control);
                foreach (HomelandsLocation location in visibleLocations)
                {
                    control[location._pos][structure._owner] = true;
                }
            }
        }

        Dictionary <Pos, StatsControl> controlStats = new Dictionary <Pos, StatsControl>();

        foreach (Pos p in control.Keys)
        {
            controlStats[p] = new StatsControl(control[p]);
        }
        return(controlStats);
    }
Пример #8
0
 public SelectedData(HomelandsLocation location)
 {
     _pos       = location._pos;
     _terrain   = location._terrain._type;
     _structure = location._structure;
 }