Exemple #1
0
    void Start()
    {
        // Resources.UnloadUnusedAssets();

        Game.Instance.DisabledState = PlayerPrefs.GetInt("failed", 0);

        Game.Instance.GameState    = E_GameState.Game;
        Game.Instance.CurrentLevel = Application.loadedLevelName;

        for (int i = 0; i < HumansCache.Length; i++)
        {
            HumansCache[i].Init();
        }

        for (int i = 0; i < DeadBodies.Length; i++)
        {
            DeadBodies[i].Init();
        }

        for (int i = 0; i < GameZones.Length; i++)
        {
            if (i == Game.Instance.CurrentGameZone)
            {
                CurrentGameZone = GameZones[i];
                CurrentGameZone.Enable();
            }
            else
            {
                GameZones[i].Disable();
            }
        }

        Game.Instance.LeaderBoardID = LeaderBoardID;
        Invoke("PrepareForStart", 0.1f);
    }
Exemple #2
0
    IEnumerator LoadLastSave(float delay)
    {
        // Debug.Log("mission - load last save point  " + Game.Instance.GameType);

        StartCoroutine(FadeOutMusic(2));


        yield return(new WaitForSeconds(3));

        GuiManager.Instance.FadeOut();

        yield return(new WaitForSeconds(1));

        Player.Instance.Agent.Transform.position = new Vector3(0, -1000, 0);

        yield return(new WaitForSeconds(0.1f));

        //Player.Instance.Agent.CharacterController()

        CurrentGameZone.Reset();
        CurrentGameZone.Disable();

        // Debug.Log("mission - show last obejcts");

        for (int i = 0; i < ManagedGameObject.Length; i++)
        {
            ManagedGameObject[i].SetActiveRecursively(true);
        }

        SpriteEffectsManager.Instance.ReleaseBloodSprites();

        Game.Instance.Save_Load();

        yield return(new WaitForEndOfFrame());

        //Debug.Log("mission - set current zone" + Game.Instance.CurrentGameZone);
        CurrentGameZone = GameZones[Game.Instance.CurrentGameZone];
        CurrentGameZone.Enable();

        //Debug.Log("Respawning player - currentgamezone" + Game.Instance.CurrentGameZone);

        Player.Instance.Agent.SendMessage("Activate", CurrentGameZone.PlayerSpawn.Transform);

        GuiManager.Instance.ShowMessage(GuiManager.E_HudMessageType.E_NONE);

        //  Debug.Log("mission - set music");
        SetNewMusic(SoundDataManager.Instance.CalmMusic, SoundDataManager.Instance.CalmMusicVolume, SoundDataManager.Instance.CalmMusicFadeOutTime, SoundDataManager.Instance.CalmMusicFadeInTime);

        CurrentGameZone.Restart();

        GuiManager.Instance.Reset();

        GuiManager.Instance.FadeIn(2);


        //Debug.Log("mission - loaded");
    }