Exemplo n.º 1
0
        private async void Start()
        {
            _scenesParameters = new LoadSceneParameters(LoadSceneMode.Additive);
            loadedScene       = SceneManager.LoadScene(_levels[_currentLevel].Value.SceneName, _scenesParameters);

            while (!loadedScene.isLoaded)
            {
                await UniTask.Yield();
            }

            float alpha = 1f;
            float time  = 0f;

            while (alpha > 0f)
            {
                alpha = Mathf.Lerp(1f, 0f, time / _fadeAnimationTime);
                await UniTask.Yield(PlayerLoopTiming.FixedUpdate);

                time        += Time.fixedDeltaTime;
                _fader.color = new Color(_fader.color.r, _fader.color.g, _fader.color.b, alpha);
            }

            LevelProxy level = loadedScene.GetRootGameObjects()[0].GetComponent <LevelProxy>();

            if (level != null)
            {
                _playerInputManager.GetComponent <PlayerSetup>().PlayerSpawners = level.PlayerSpawners;
                _playerInputManager.gameObject.SetActive(true);
            }

            _onVictory.Register(OnVictory);
        }
Exemplo n.º 2
0
 private void OnEnable()
 {
     goMainMenu.Register(LoadMainMenu);
     goNextLevel.Register(LoadNextLevel);
     goLevel.Register(LoadLevel);
     goRepeat.Register(RepeatLevel);
 }
Exemplo n.º 3
0
    private void Awake()
    {
        List <List <int> > roomInts = new List <List <int> >
        {
            new List <int> {
                1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
            },
            new List <int> {
                1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1
            },
            new List <int> {
                1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1
            },
            new List <int> {
                1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1
            },
            new List <int> {
                1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1
            },
            new List <int> {
                1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1
            },
            new List <int> {
                1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1
            },
            new List <int> {
                1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1
            },
            new List <int> {
                1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1
            },
            new List <int> {
                1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1
            },
            new List <int> {
                1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1
            },
            new List <int> {
                1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1
            },
            new List <int> {
                1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
            }
        };

        foreach (List <int> tiles in roomInts)
        {
            List <(RoomTile, GameObject)> roomRow = new List <(RoomTile, GameObject)>();
            foreach (int tile in tiles)
            {
                roomRow.Add(((RoomTile)tile, null));
            }
            room.content.Add(roomRow);
        }

        doDrawOn.Register(Redraw);
    }
Exemplo n.º 4
0
 private void OnEnable()
 {
     doSpawnRobotOn.Register(StartPopulation);
 }
Exemplo n.º 5
0
 private void OnEnable() => onPlayerLost.Register(OnPlayerLost);
 private void OnEnable()
 {
     onPlayerWon.Register(RemoveThisComponent);
     onPlayerLost.Register(RemoveThisComponent);
 }
Exemplo n.º 7
0
 private void OnEnable()
 {
     doSpawnRobotOn.Register(SpawnRobot);
 }
Exemplo n.º 8
0
 private void OnEnable()
 {
     Event.Register(this);
 }