Ejemplo n.º 1
0
    public void Init()
    {
        combosManager = Data.Instance.combosManager;

        Events.OnScoreAdd    += OnScoreAdd;
        Events.OnHeroDie     += OnHeroDie;
        Events.StartGame     += StartGame;
        Events.OnExplotion   += OnExplotion;
        Events.OnChangeSpeed += OnChangeSpeed;
        Events.OnResetSpeed  += OnResetSpeed;

        characterManager = GetComponent <CharacterManager>();
        characterManager.Init();

        levelsManager = GetComponent <LevelsManager>();
        levelsManager.Init();

        GameObject mood = Instantiate(Data.Instance.moodsManager.GetCurrentMoodAsset());

        mood.transform.SetParent(container.transform);
        mood.transform.localPosition = Vector2.zero;

        foreach (BackgroundScrolleable bg in mood.GetComponentsInChildren <BackgroundScrolleable>())
        {
            backgroundsScrolleable.Add(bg);
        }

        Events.OnStartCountDown();

        Events.OnMusicChange("Gameplay");

        score = 0;

        camera.UpdatePosition(distance);
        characterManager.UpdatePosition(distance);

        if (PlayerPrefs.GetString("tutorialReady") != "true")
        {
            DEFAULT_SPEED = 0.065f;
        }
    }
Ejemplo n.º 2
0
    public void Init()
    {
        combosManager = Data.Instance.combosManager;

        Events.OnScoreAdd += OnScoreAdd;
        Events.OnHeroDie += OnHeroDie;
        Events.StartGame += StartGame;
        Events.OnExplotion += OnExplotion;
        Events.OnChangeSpeed += OnChangeSpeed;
        Events.OnResetSpeed += OnResetSpeed;

        characterManager = GetComponent<CharacterManager>();
        characterManager.Init();

        levelsManager = GetComponent<LevelsManager>();
        levelsManager.Init();

        GameObject mood = Instantiate(Data.Instance.moodsManager.GetCurrentMoodAsset());
        mood.transform.SetParent(container.transform);
        mood.transform.localPosition = Vector2.zero;

        foreach (BackgroundScrolleable bg in mood.GetComponentsInChildren<BackgroundScrolleable>())
            backgroundsScrolleable.Add(bg);

        Events.OnStartCountDown();

        Events.OnMusicChange("Gameplay");

        score = 0;

        camera.UpdatePosition(distance);
        characterManager.UpdatePosition(distance);

        if (PlayerPrefs.GetString("tutorialReady") != "true")
            DEFAULT_SPEED = 0.065f;
    }