private void UpdateTiles(GameTurnTransition turn, DisplayTimings timings)
 {
     foreach (TileDisplay tileDisplay in Map.TileDisplays)
     {
         tileDisplay.DisplayTile(turn, timings);
     }
 }
Esempio n. 2
0
    public MainGameManager(GameSetup gameSetup)
    {
        MapAssetSet assetSet = gameSetup.MapDefinition.GetMapAssetSet();
        Map         map      = new Map(assetSet.MapSetup);

        IEnumerable <PlayerSetup> playerSetups = PlayerSetup.CreateFromMapDefinition(assetSet.MapSetup);
        GameTurnTransition        initialState = GetInitialState(playerSetups, map);

        _turns.Add(initialState);
        _provinceNeighbors = new ProvinceNeighborsTable(CurrentState);

        ObjectManager = new UnityObjectManager(map,
                                               assetSet,
                                               gameSetup.MapPrefab,
                                               gameSetup.FactionPrefab,
                                               gameSetup.OrderIndicatorPrefab,
                                               gameSetup.ScreenCanvas,
                                               initialState.AfterEverything,
                                               playerSetups);
        InteractionManager = new InteractionManager(this,
                                                    map,
                                                    gameSetup,
                                                    ObjectManager,
                                                    playerSetups);
        DisplayManager = new GameDisplayManager(this,
                                                gameSetup,
                                                playerSetups.Select(item => item.Faction),
                                                map,
                                                ObjectManager,
                                                InteractionManager.Factions,
                                                initialState.AfterEverything);
    }
 private void UpdateProvinces(GameTurnTransition transiation, DisplayTimings timings)
 {
     foreach (ProvinceDisplay province in _provinces.Values)
     {
         province.DisplayProvince(transiation, timings);
     }
 }
    public void DisplayTurn(GameTurnTransition turn, float progression)
    {
        DisplayTimings timings = new DisplayTimings(progression);

        UpdateTiles(turn, timings);
        UpdateProvinces(turn, timings);
    }
    public void DisplayGamestate()
    {
        float gameTime          = _mainManager.InteractionManager.Timeline.DisplayTime;
        GameTurnTransition turn = _mainManager[Mathf.FloorToInt(gameTime)];
        float progression       = gameTime % 1;

        DisplayTurn(turn, progression);
    }
Esempio n. 6
0
    public GameTurnTransition GetNextState(GameTurnMoves moves)
    {
        WarsResolver         postWars     = new WarsResolver(this, moves.ArmyMoves);
        UpgradeMovesResolver postUpgrades = new UpgradeMovesResolver(postWars.NewGameState, moves.Upgrades);
        MergerMovesResolver  postMergers  = new MergerMovesResolver(postUpgrades.NewGameState, moves.Mergers);

        GameTurnTransition transition = new GameTurnTransition(
            this,
            postWars.NewGameState,
            postUpgrades.NewGameState,
            postMergers.NewGameState,
            postMergers.MergeTable,
            postWars.Wars);

        return(transition);
    }
Esempio n. 7
0
    public void AdvanceGame(GameTurnMoves moves)
    {
        GameTurnTransition newState = CurrentState.GetNextState(moves);

        _turns.Add(newState);

        IEnumerable <Faction> survivingFactions = newState.AfterEverything.GetSurvivingFactions();

        if (survivingFactions.Count() < 2)
        {
            HandleGameConclusion(survivingFactions);
        }
        DisplayManager.UpdateDisplayWrappers(CurrentState);
        _provinceNeighbors = new ProvinceNeighborsTable(CurrentState);
        InteractionManager.Factions.RenewBuilders(survivingFactions);

        InteractionManager.Timeline.SetToMax(TurnsCount);
    }
Esempio n. 8
0
 public void DisplayTile(GameTurnTransition gameTransition, DisplayTimings timings)
 {
     DisplayProvinceOwnershipChanges(gameTransition.BeforeEverything, gameTransition.AfterWars, timings.ProvinceOwnershipChanges);
     DisplayProvinceMergers(gameTransition.BeforeEverything, gameTransition.AfterEverything, timings.ProvinceMergers);
 }
Esempio n. 9
0
 private void DisplayProvinceUpgrades(GameTurnTransition transition, float provinceUpgrades)
 {
     //ProvinceState initialProvince = transition.BeforeEverything.GetProvinceState(Identifier);
     //ProvinceState finalProvince = transition.AfterWarsAndUpgrades.GetProvinceState(Identifier);
 }
Esempio n. 10
0
 public void DisplayProvince(GameTurnTransition transition, DisplayTimings timings)
 {
     DisplayProvinceUpgrades(transition, timings.ProvinceUpgrades);
 }