예제 #1
0
        IEnumerator DelayStartGame(float delay = 0.5f)
        {
            yield return(null);

            FactionManager.SetupFaction();
            GridManager.SetupGridForFogOfWar();
            yield return(null);

            PerkManager.InitPerkProgress();             //initiate prepurchase perk and so on

            if (delay > 0)
            {
                yield return(new WaitForSeconds(delay));
            }

            gamePhase = _GamePhase.Play;
            TurnControl.StartGame();                    //this will initiate unit selection and start the game
            yield return(null);

            //if(onGameStartE!=null) onGameStartE();
            TBTK.OnGameStart();
        }
예제 #2
0
        void Awake()
        {
            instance = this;

            TBData.ClearEndData();

            SettingDB settingDB = InitSetting();

            if (enableCover)
            {
                CoverSystem.SetFullCoverDodgeBonus(fullCoverBonus);
                CoverSystem.SetHalfCoverDodgeBonus(halfCoverBonus);
                CoverSystem.SetExposedCritChanceBonus(exposedCritBonus);
            }

            //get the instance of each component and initiate them, the order in which these component matters

            PerkManager perkManager = (PerkManager)FindObjectOfType(typeof(PerkManager));

            if (perkManager != null)
            {
                perkManager.Init();
            }

            AbilityManagerUnit abManagerUnit = (AbilityManagerUnit)FindObjectOfType(typeof(AbilityManagerUnit));

            if (abManagerUnit != null)
            {
                abManagerUnit.Init();
            }

            AbilityManagerFaction abManagerFac = (AbilityManagerFaction)FindObjectOfType(typeof(AbilityManagerFaction));

            if (abManagerFac != null)
            {
                abManagerFac.Init();
            }

            TurnControl turnControl = (TurnControl)FindObjectOfType(typeof(TurnControl));

            turnControl.Init();

            if (settingDB != null)
            {
                turnControl.turnMode  = settingDB.turnMode;
                turnControl.moveOrder = settingDB.moveOrder;
            }

            GridManager gridManager = (GridManager)FindObjectOfType(typeof(GridManager));

            if (settingDB != null)
            {
                gridManager.generateGridOnStart = settingDB.generateGridOnStart;
            }
            gridManager.Init();

            FactionManager factionManager = (FactionManager)FindObjectOfType(typeof(FactionManager));

            if (settingDB != null)
            {
                factionManager.generateUnitOnStart = settingDB.generateUnitOnStart;
            }
            factionManager.Init();

            CollectibleManager collectibleManager = (CollectibleManager)FindObjectOfType(typeof(CollectibleManager));

            if (settingDB != null)
            {
                collectibleManager.generateCollectibleOnStart = settingDB.generateCollectibleOnStart;
            }
            collectibleManager.Init();

            GridManager.SetupGridForFogOfWar();

            OverlayManager overlayManager = (OverlayManager)FindObjectOfType(typeof(OverlayManager));

            overlayManager.Init();

            defaultShootObject = Resources.Load("ScenePrefab/DefaultShootObject", typeof(GameObject)) as GameObject;

            gamePhase = _GamePhase.Initialization;
        }