Example #1
0
    public override void OnLeverEngaged(NewtonVR.NVRLever lever)
    {
        if (LevelManager.Instance.GetCurrentlyLoadedSaveFile() == null)
        {
            hatWarning.SetActive(true);
            hatWarning.transform.localRotation = Quaternion.Euler(0, 0, Random.Range(10, 30) * warningSide);
            warningSide *= -1;
            return;
        }
        Debug.Log("Starting level!", this);
        LevelManager.Instance.menuLevel = UnityEngine.SceneManagement.SceneManager.GetActiveScene().name;
        WaveRules prefab = null;

        switch (LevelManager.Instance.settings.gameMode)
        {
        case LevelSettings.MODE_FAST_FOOD:
            prefab = Instantiate(fastFoodLevelPrefab);
            break;

        case LevelSettings.MODE_EARLY_BIRD:
            prefab = Instantiate(earlyBirdLevelPrefab);
            break;

        case LevelSettings.MODE_LUNCH_RUSH:
            prefab = Instantiate(lunchRushLevelPrefab);
            break;

        case LevelSettings.MODE_FRANCHISE:
            prefab = Instantiate(campaignLevelPrefab);
            break;
        }
        if (prefab == null)
        {
            Debug.LogError("Bad game mode name, no prefab: " + LevelManager.Instance.settings.gameMode);
        }
        DontDestroyOnLoad(prefab);
        if (LevelManager.Instance.levelPrefab != null)
        {
            Destroy(LevelManager.Instance.levelPrefab);
        }
        LevelManager.Instance.levelPrefab = prefab.gameObject;
        Debug.Log("LevelManager has settings: " + LevelManager.Instance.settings);
        LevelManager.Instance.ChangeScene("Main", false, 2);
    }
Example #2
0
 public virtual void OnLeverEngaged(NewtonVR.NVRLever lever)
 {
     Debug.Log("Lever engaged!", this);
 }