Ejemplo n.º 1
0
 //I don't use a static constructor since I need the delegates to be loaded immediately,
 //but static constructors don't guarantee when they're run.
 public static void Prepare()
 {
     typName = typeof(T).Name;
     SceneIntermediary.RegisterSceneLoad(CreateParticleContainer);
     SceneIntermediary.RegisterSceneUnload(OrphanAll);
     Pooled <T> .Prepare(GetContainer);
 }
Ejemplo n.º 2
0
        private void Awake()
        {
            if (gm != null)
            {
                DestroyImmediate(gameObject);
                return;
            }
            Initialized = true;
            gm          = this;
            DontDestroyOnLoad(this);

            //This looks silly, but the static initializer needs to be actively run to ensure that the locale is set correctly.
            _ = SaveData.s;

            Log.Unity($"Danmokou {EngineVersion}, {References.gameIdentifier} {References.gameVersion}");
            SceneIntermediary.Setup(References.defaultTransition);
            ParticlePooler.Prepare();
            GhostPooler.Prepare(Prefabs.cutinGhost);
            BEHPooler.Prepare(Prefabs.inode);
            ItemPooler.Prepare(References.items);
            ETime.RegisterPersistentSOFInvoke(Replayer.BeginFrame);
            ETime.RegisterPersistentSOFInvoke(Enemy.FreezeEnemies);
            ETime.RegisterPersistentEOFInvoke(BehaviorEntity.PrunePoolControls);
            ETime.RegisterPersistentEOFInvoke(CurvedTileRenderLaser.PrunePoolControls);
            SceneIntermediary.RegisterSceneUnload(ClearForScene);
            SceneIntermediary.RegisterSceneLoad(OnSceneLoad);

            //The reason we do this instead of Awake is that we want all resources to be
            //loaded before any State Machines are constructed, which may occur in other entities' Awake calls.
            GetComponent <ResourceManager>().Setup();
            GetComponent <BulletManager>().Setup();
            GetComponentInChildren <SFXService>().Setup();
            GetComponentInChildren <AudioTrackService>().Setup();

            if (References.achievements != null)
            {
                Achievements = References.achievements.MakeRepo().Construct();
            }

            RunDroppableRIEnumerator(DelayedInitialAchievementsCheck());
        }
Ejemplo n.º 3
0
 public static bool GoToReplayScreen() => SceneIntermediary.LoadScene(
     new SceneIntermediary.SceneRequest(References.replaySaveMenu,
                                        SceneIntermediary.SceneRequest.Reason.FINISH_RETURN,
                                        () => BackgroundOrchestrator.NextSceneStartupBGC = References.defaultMenuBackground));
Ejemplo n.º 4
0
 public static bool GoToMainMenu() => SceneIntermediary.LoadScene(
     new SceneIntermediary.SceneRequest(References.mainMenu,
                                        SceneIntermediary.SceneRequest.Reason.ABORT_RETURN, () => {
     Instance.Request?.Cancel();
     Replayer.Cancel();
 }));