Exemplo n.º 1
0
        public async Task ReturnToBaseAsync()
        {
            attackStarted.Raise();

            var baseDescription = await playerBaseProvider.GetPlayerBase(playerData.Id, false);

            await Scenes.UnloadScenes();

            await Scenes.LoadPlayerScene();

            currentGameState.Value = defaultState;

            await baseBuilder.BuildBase(baseDescription);

            attackFinished.Raise();
        }
Exemplo n.º 2
0
        public async Task AttackAsync()
        {
            attackStarted.Raise();

            var targetId = await targetProvider.GetAttackTargetId();

            var baseDescription = await enemyBaseProvider.GetPlayerBase(targetId, true);

            await Scenes.UnloadScenes();

            await Scenes.LoadAttackScene();

            currentGameState.Value = attackState;

            await baseBuilder.BuildBase(baseDescription);

            attackFinished.Raise();
        }
Exemplo n.º 3
0
        public async Task BuildBase(BaseDescription baseDescription)
        {
            var bundle = await AssetBundle.LoadFromFileAsync(Path.Combine(Constants.AssetBundlesPath, baseDescription.bundleName));

            using (var disposable = new DisposableBundle(bundle)) {
                var sceneName = Path.GetFileNameWithoutExtension(disposable.GetAllScenePaths()[0]);

                await Scenes.LoadBaseScene(sceneName);

                SetupBaseLayout(baseDescription);
                SetupUpgrades(baseDescription);
                SetupAdditionalData(baseDescription);

                if (baseDescription.isAttacking)
                {
                    SpawnPlayerSpaceship();
                }

                onBaseBuilt.Raise(baseDescription);
            }
        }
Exemplo n.º 4
0
        private async void Start()
        {
            if (enableTutorial)
            {
                Tutorials.TutorialUtility.IsDebugMode = true;
                Tutorials.TutorialUtility.SetTutorialRunning(true);
            }

            await playerData.Init();

            var baseDescription = await baseProvider.GetPlayerBase(playerData.Id, false);

            if (!baseDescription.isPersistant)
            {
                await InitNewPlayer(baseDescription);
            }

            await Scenes.LoadPlayerScene();

            currentGameState.Value = defaultGameState;

            await baseBuilder.BuildBase(baseDescription);
        }