Exemple #1
0
    private IEnumerator ZoomProcess(Action onFinish)
    {
        heliPlayer.ApplyHeliPlayerData(gameSceneState.HeliPlayerData);
        view.ApplyGameSceneState(gameSceneState);

        onFinish();
        yield break;
    }
Exemple #2
0
    public override void OnInitializeScene(ISceneInitData _initData)
    {
        initData = (GameSceneInitData)_initData;

        GameInstance.Inst.PlayBGM(new BgmEnum[] { BgmEnum.Game, BgmEnum.GameAmbient });

        field        = GenericPrefab.InstantiatePathFormat <Field>(initData.FieldId.ToString());
        cameraTrack  = field.GetCameraTrack();
        heliPlayer   = GenericPrefab.Instantiate <HeliPlayer>(cameraTrack.GetCameraJoint());
        subStageList = field.GetSubStageList();

        //GameSceneState
        {
            int       enemyCount  = 0;
            var       fistStage   = subStageList.FirstOrDefault();
            Transform firstTarget = null;
            if (fistStage != null)
            {
                var firstEnemy = fistStage.EnemyList.FirstOrDefault();
                enemyCount = fistStage.EnemyList.Count;
                if (firstEnemy != null)
                {
                    firstTarget = firstEnemy.TargetJoint;
                }
            }

            gameSceneState = new GameSceneState()
            {
                TargetEnemyList = fistStage.EnemyList.ToList(),
                HeliPlayerData  = new HeliPlayerData()
                {
                    Zoom   = false,
                    Target = firstTarget
                },
                SubStageId        = fistStage.SubStageId,
                NextSubStageId    = fistStage.NextSubStageId,
                LeftEnemyCount    = enemyCount,
                CurrentEnemyIndex = 0
            };
            fistStage.SetColliderActive(true);

            gameSceneState.InvalidTarget();
            heliPlayer.ApplyHeliPlayerData(gameSceneState.HeliPlayerData);
            view.ApplyGameSceneState(gameSceneState);
        }

        //init enemy
        {
            var enemyInitData = new EnemyInitData()
            {
                OnKillEnemy   = OnKillEnemy,
                OnRemoveEnemy = OnRemoveEnemy
            };

            foreach (var subStage in subStageList)
            {
                foreach (var enemy in subStage.EnemyList)
                {
                    enemy.Initialize(enemyInitData);
                }
            }
        }

        //Init CameraTrack
        cameraTrack.SetSubStage(1);

        startTime = Time.time;
        view.ApplyTime(Time.time - startTime);
    }