Example #1
0
    private void Initialize()
    {
        _lifetime = Lifetime.Define(Lifetime.Eternal);

        _onUpdate      = new Signal(_lifetime.Lifetime);
        _onLateUpdate  = new Signal(_lifetime.Lifetime);
        _onFixedUpdate = new Signal(_lifetime.Lifetime);
        _onQuit        = new Signal(_lifetime.Lifetime);
        _onFocus       = new Signal <bool>(_lifetime.Lifetime);
        _onPause       = new Signal <bool>(_lifetime.Lifetime);

        _gameContext = new GameContext(_lifetime.Lifetime, this);
        GameContext.GameController.Start();

        DontDestroyOnLoad(gameObject);
    }
Example #2
0
        private void Awake()
        {
            if (!GameContext.Initialized)
            {
                return;
            }

            _definition = Lifetime.Define(GameContext.LevelController.LeveLifetime);

            _bulletTransform = new GameObject("Bullets").transform;
            _bulletTransform.SetParent(transform, false);
            _poolTransform = new GameObject("Pool").transform;
            _poolTransform.SetParent(transform, false);
            _poolTransform.gameObject.SetActive(false);
            _activeSpawnTransform = new GameObject("ActiveSpawn").transform;
            _activeSpawnTransform.SetParent(transform, false);
            _runeTransform = new GameObject("Runes").transform;
            _runeTransform.SetParent(transform, false);
            _effectTransform = new GameObject("Effects").transform;
            _effectTransform.SetParent(transform, false);

            InputController = new InputControllerComponent();
            InputController.Init(Lifetime);

            State = new LevelState();
            State.Init(Lifetime);

            HudComponent.Init(this, Lifetime);

            Spawn = new SpawnController(this, Settings);
            Spawn.Init();

            GoatSpawn = new GoatSpawnController(this, Settings);
            GoatSpawn.Init();

            ShootController = new ShootController(this);

            RuneRequirementController = new RuneRequirementController(this);
            ExplosionController       = new ExplosionController(this, Settings.ExplosionEffectPrefab);
            SpawnEffectController     = new ExplosionController(this, Settings.SpawnEffectPrefab);

            //GameContext.DelayCall(1f, StartLevel);
        }
 private void Awake()
 {
     _definition    = Lifetime.Define(GameContext.LevelController.Current.Lifetime);
     _onPlayDestroy = new Signal(_definition.Lifetime);
 }
Example #4
0
 private void OnEnable()
 {
     _definition = Lifetime.Define(Lifetime.Eternal);
     _onComplete = new Signal(_definition.Lifetime);
 }
Example #5
0
 public CommandFactory(Func <Lifetime, ICommand> factory, bool oneTime, Lifetime.Definition lifetime)
 {
     Factory  = factory;
     OneTime  = oneTime;
     Lifetime = lifetime;
 }
 private void OnEnable()
 {
     _definition = Lifetime.Define(GameContext.Lifetime);
 }