Пример #1
0
    private void Start()
    {
        Time.timeScale = 0;

        Cursor.visible   = false;
        Cursor.lockState = CursorLockMode.Locked;

        sceneChoice = GameObject.Find("SceneChoice");
        SceneChoice sceneChoiceScript = sceneChoice.GetComponent <SceneChoice>();

        pressSpace.SetActive(true);

        switch (sceneChoiceScript.Choice)
        {
        case (int)SceneChoice.GameMode.AI:
            racketRight.GetComponent <EnemyController>().enabled = true;
            AI.SetActive(true);
            break;

        case (int)SceneChoice.GameMode.Player:
            racketRight.GetComponent <MoveRacket>().enabled = true;
            P2.SetActive(true);
            break;
        }

        textScoreLeft.text  = scoreLeft.ToString();
        textScoreRight.text = scoreRight.ToString();

        racketLeftStartPosition  = racketLeft.transform.position;
        racketRightStartPosition = racketRight.transform.position;
        ballStartPosition        = ball.transform.position;
    }
Пример #2
0
        private IEnumerator LoadAsync(SceneChoice sceneChoice)
        {
            if (sceneChoice == SceneChoice.Quit)
            {
                Application.Quit();
            }

            yield return(new WaitForSeconds(m_initialDelay));

            m_fadeOverlay.CrossFadeAlpha(1f, m_fadeSpeed, false);

            yield return(new WaitForSeconds(m_fadeSpeed));

            m_loadingIcon.gameObject.SetActive(true);
            m_progressSlider.gameObject.SetActive(true);
            m_progressText.gameObject.SetActive(true);

            AsyncOperation operation = SceneManager.LoadSceneAsync((int)sceneChoice);

            while (!operation.isDone)
            {
                float progress = Mathf.Clamp01(operation.progress / 0.9f);
                m_progressText.text = (progress * 100f).ToString("00") + "%";

                m_progressSlider.value = progress;

                yield return(null);
            }
        }
Пример #3
0
 private void Awake()
 {
     if (sceneChoice == null)
     {
         sceneChoice = this;
     }
     else
     {
         Destroy(this.gameObject);
     }
     DontDestroyOnLoad(sceneChoice);
 }
Пример #4
0
 public void ChoiceDone(SceneChoice who)
 {
     mChoiceDone=true;
     if(who==null) {
         ChoiceDoneEnd();
         return;
     }
     Lerper.RegisterLerper(SetBackAlpha, minAlpha, mStartAlpha, warpTime, ChoiceDoneEnd);
     if(who.sound!=null) {
         who.sound.gameObject.SetActive(true);
     }
     mActiveChoice=who;
 }
    public SceneChoice ChoicesHandle(SceneChoice choice)
    {
        if (!ChoicesHandlers.TryGetValue(choice.Caption, out var choiceHandler))
        {
            return(choice);
        }

        var newChose = new SceneChoice
        {
            Caption = choice.Caption,
            SceneId = choice.SceneId
        };

        choiceHandler(newChose);
        return(newChose);
    }
Пример #6
0
 public void ChoiceDoneEnd()
 {
     mBack.gameObject.SetActive(false);
     if(mCachedSceneUI!=null) {
         mCachedSceneUI.SetActive(false);
     }
     mCachedSceneUI=null;
     if(mActiveChoice!=null) {
         mActiveChoice.sound.gameObject.SetActive(false);
         mPlayer.DeltaStress(mActiveChoice.deltaStress);
         mPlayer.DeltaHealth(mActiveChoice.deltaHealth);
         mPlayer.DeltaMorality(mActiveChoice.deltaMorality);
         if(mActiveChoice.choiceText!="") {
             StartCoroutine(TimerChoice(mActiveChoice.choiceTextDelay, DefaultChoice));
         }
     }
     mActiveChoice=null;
     if(null!=mCallback) {
         mCallback();
     }
     mCallback=null;
 }
Пример #7
0
 private void Awake()
 {
     sceneChoice       = GameObject.Find("SceneChoice");
     sceneChoiceScript = sceneChoice.GetComponent <SceneChoice>();
 }