Exemple #1
0
    // Use this for initialization
    public virtual void Start()
    {
        playerInputActions = PlayerInputHelper.LoadData(0);
        menuButtons.ForEach(menuButton => menuButton.AddEventListener(this.gameObject));

        SelectFirstButton();
    }
Exemple #2
0
 public virtual void SetActive()
 {
     if (playerInputActions == null)
     {
         playerInputActions = PlayerInputHelper.LoadData(0);
         ActivateMenu();
     }
     else
     {
         ActivateMenu();
     }
 }
        protected virtual void Awake()
        {
            Assert.IsTrue(Owner is IPlayer);
            Assert.IsNotNull(PlayerInputData);
            Assert.IsTrue(PlayerInputData.InputBufferSize > 0);
            Assert.IsTrue(PlayerInputData.InputBufferTimeoutMs > 0);

            InputHelper = GetComponent <PlayerInputHelper>();

            _moveBuffer = new CircularBuffer <Vector3>(PlayerInputData.InputBufferSize);
            _lookBuffer = new CircularBuffer <Vector3>(PlayerInputData.InputBufferSize);
        }
Exemple #4
0
    public static void LoadSceneQuickly(Scene scene)
    {
        PlayerInputHelper.ResetInputHelper();

        PauseHelper.ResumeGame();
        Time.timeScale = 1f;

        Loader.IS_USING_LOADER      = false;
        Loader.HAS_DONE_FULL_RELOAD = false;

        loadingScene = scene;

        SceneManager.LoadScene(scene.ToString());
    }
Exemple #5
0
    public static void LoadSceneAdditive(Scene scene)
    {
        PlayerInputHelper.ResetInputHelper();

        if (GameObject.Find("CameraContainer"))
        {
            GameObject.Find("CameraContainer").SetActive(false);
            GameObject.Find("UICameraContainer").SetActive(false);
        }
        PauseHelper.ResumeGame();
        Time.timeScale = 1f;

        Logger.Log("loading.. " + scene.ToString());
        SceneManager.LoadScene(scene.ToString(), LoadSceneMode.Additive);
    }
Exemple #6
0
    public static void LoadScene(Scene scene)
    {
        PlayerInputHelper.ResetInputHelper();

        PauseHelper.ResumeGame();
        Time.timeScale = 1f;

        Loader.IS_USING_LOADER      = true;
        Loader.HAS_USED_LOADER      = true;
        Loader.HAS_DONE_FULL_RELOAD = true;

        loadingScene = scene;

        SceneManager.LoadScene(Scene.Empty.ToString(), LoadSceneMode.Single);
        SceneManager.LoadScene(Scene.Loading.ToString(), LoadSceneMode.Additive);
    }
Exemple #7
0
    public static void ReloadLevelAndStopLoading()
    {
        PlayerInputHelper.ResetInputHelper();
        Destroy(SceneUtils.FindObject <Loader>().gameObject);

        string sceneToLoad = loadingScene.ToString();

        if (!Loader.HAS_USED_LOADER)
        {
            sceneToLoad = Application.loadedLevelName;
        }

        Scene scene = (Scene)System.Enum.Parse(typeof(Scene), sceneToLoad);

        HAS_DONE_FULL_RELOAD = true;

        Loader.LoadScene(scene);
    }
Exemple #8
0
    public static void ReloadLevelWithoutLoadingScene(bool isUsingLoader = true)
    {
        PlayerInputHelper.ResetInputHelper();

        PauseHelper.ResumeGame();
        Time.timeScale = 1f;

        string sceneToLoad = loadingScene.ToString();

        if (!Loader.HAS_USED_LOADER)
        {
            sceneToLoad = Application.loadedLevelName;
        }

        Loader.IS_USING_LOADER = isUsingLoader;

        HAS_DONE_FULL_RELOAD = false;
        SceneManager.LoadScene(sceneToLoad, LoadSceneMode.Single);
    }
Exemple #9
0
 protected virtual void OnActivated()
 {
     playerInputActions = PlayerInputHelper.LoadData(0);
 }