コード例 #1
0
ファイル: Ship.cs プロジェクト: Einsich/Map-Generator
 public void CellChange(Vector2Int oldCell, Vector2Int newCell)
 {
     FindLand(newCell);
     if (curOwner == Player.curPlayer)
     {
         MapMetrics.UpdateAgentVision(oldCell, newCell, VisionRadius);
         MapMetrics.UpdateSplatMap();
         Army.FoggedArmy();
     }
 }
コード例 #2
0
ファイル: Player.cs プロジェクト: Einsich/Map-Generator
    public void WhitePeace(State annexator, State target)
    {
        foreach (var reg in annexator.regions)
        {
            if (reg.ocptby == target)
            {
                reg.ocptby = null;
            }
        }
        foreach (var army in annexator.army)
        {
            if (army.navAgent.target?.curOwner == target)
            {
                army.navAgent.target = null;
            }
        }
        foreach (var reg in target.regions)
        {
            if (reg.ocptby == annexator)
            {
                reg.ocptby = null;
            }
        }

        foreach (var army in target.army)
        {
            if (army.navAgent.target?.curOwner == annexator)
            {
                army.navAgent.target = null;
            }
        }

        foreach (var reg in regions)
        {
            reg.UpdateSplateState(curPlayer);
        }
        foreach (var agent in curPlayer.army)
        {
            MapMetrics.UpdateAgentVision(agent.curPosition, agent.curPosition, agent.VisionRadius, 1);
        }
        foreach (var agent in curPlayer.ships)
        {
            MapMetrics.UpdateAgentVision(agent.curPosition, agent.curPosition, agent.VisionRadius, 1);
        }
        if (target.stateAI.autoArmyCommander.IsOn)
        {
            target.stateAI.autoArmyCommander.RecalculateRegions();
        }
        if (annexator.stateAI.autoArmyCommander.IsOn)
        {
            annexator.stateAI.autoArmyCommander.RecalculateRegions();
        }
        MapMetrics.UpdateOccupedMap();
        MapMetrics.UpdateSplatMap();
    }
コード例 #3
0
ファイル: Player.cs プロジェクト: Einsich/Map-Generator
    public static void SetState(State state)
    {
        if (state != null)
        {
            MenuManager.SetState(state);
        }

        curPlayer = state;
        foreach (var r in curPlayer.regions)
        {
            if (r.data.portLevel != 0)
            {
                Ship.CreateShip(r);
            }
        }
        foreach (Region r in regions)
        {
            r.UpdateSplateState(curPlayer);
            r.UpdateBorder();
        }
        for (int i = 0; i < states.Count; i++)
        {
            states[i].SetNameStatus(!CameraController.showstate);
            states[i].stateAI.autoBuilder.IsOn         = (state != states[i]);
            states[i].stateAI.autoReasercher.IsOn      = (state != states[i]);
            states[i].stateAI.autoTrader.IsOn          = (state != states[i]);
            states[i].stateAI.autoRegimentBuilder.IsOn = (state != states[i]);
            states[i].stateAI.autoArmyCommander.IsOn   = (state != states[i]);
            states[i].stateAI.autoPersonControl.IsOn   = (state != states[i]);
            states[i].stateAI.autoDiplomacy.IsOn       = (state != states[i]);
        }
        foreach (var army in Army.AllArmy)
        {
            army.GetComponent <ArmyAI>().enabled = army.owner != state;
        }
        foreach (var army in state.army)
        {
            MapMetrics.UpdateAgentVision(army.curPosition, army.curPosition, army.VisionRadius, 1);
        }
        foreach (var ship in state.ships)
        {
            MapMetrics.UpdateAgentVision(ship.curPosition, ship.curPosition, ship.VisionRadius, 1);
        }
        CameraController.SetTarget(curPlayer.Capital.pos);
        StateStatistic.ShowStates();
        Army.FoggedArmy();
        MapMetrics.UpdateSplatMap();
        MenuManager.HiddenProvinceMenu();
        GameTimer.UpdateListenerQueue();
    }
コード例 #4
0
ファイル: Player.cs プロジェクト: Einsich/Map-Generator
    public void Annexation(State annexator, State target, List <Region> land)
    {
        foreach (var war in target.diplomacy.war)
        {
            foreach (var reg in war.Enemy(target).regions)
            {
                if (reg.ocptby == target)
                {
                    reg.ocptby = null;
                }
            }
        }
        foreach (var reg in land)
        {
            reg.owner.regions.Remove(reg);
            reg.owner  = annexator;
            reg.ocptby = null;
            annexator.regions.Add(reg);
        }
        foreach (var reg in regions)
        {
            reg.UpdateSplateState(curPlayer);
        }

        /*foreach (var agent in curPlayer.army)
         *  MapMetrics.UpdateAgentVision(agent.curPosition, agent.curPosition, agent.VisionRadius, 1);
         * foreach (var agent in curPlayer.ships)
         *  MapMetrics.UpdateAgentVision(agent.curPosition, agent.curPosition, agent.VisionRadius, 1);*/
        annexator.SetName();
        if (target.regions.Count == 0)
        {
            target.DestroyState();
        }
        else
        {
            target.SetName();
        }
        if (target.stateAI.autoArmyCommander.IsOn)
        {
            target.stateAI.autoArmyCommander.RecalculateRegions();
        }
        if (annexator.stateAI.autoArmyCommander.IsOn)
        {
            annexator.stateAI.autoArmyCommander.RecalculateRegions();
        }
        MapMetrics.UpdateColorMap();
        MapMetrics.UpdateOccupedMap();
        MapMetrics.UpdateSplatMap();
    }
コード例 #5
0
ファイル: Player.cs プロジェクト: Einsich/Map-Generator
    public void Occupated(Region r, State occupant)
    {
        r.Destoyed = false;
        State realOwner = r.owner;
        State curOwner  = r.curOwner;

        if (occupant != r.owner)
        {
            r.ocptby = occupant;

            Debug.Log(string.Format("Страна {0} захватила {1}", occupant.name, r.name));
        }
        else
        {
            r.ocptby = null;

            Debug.Log(string.Format("Страна {0} вернула {1}", occupant.name, r.name));
        }

        if (realOwner.stateAI.autoArmyCommander.IsOn)
        {
            realOwner.stateAI.autoArmyCommander.RecalculateRegions();
        }

        AutoArmyCommander autoArmy = realOwner.stateAI.autoArmyCommander;

        if (autoArmy.IsOn)
        {
            autoArmy.RecalculateRegions();
        }


        if (!r.InFogFrom(curPlayer))
        {
            MapMetrics.SetRegionSplatState(r.territory, LandShowMode.Visible);
        }
        MapMetrics.UpdateOccupedMap();
        MapMetrics.UpdateSplatMap();
    }