コード例 #1
0
    private void NextScene()
    {
        sf.FadeIn();

        if (coroutines == null)
        {
            coroutines = FindObjectOfType <Coroutines>();
        }

        coroutines.StopAllCoroutines();

        if (nextScene == "NEXT")
        {
            int n = SceneManager.GetActiveScene().buildIndex;
            coroutines.WaitThenExecute(1.1f, () => {
                SceneManager.LoadScene(n + 1);
            });
        }
        else
        {
            coroutines.WaitThenExecute(1.1f, () => {
                SceneManager.LoadScene(nextScene);
            });
        }
    }
コード例 #2
0
 public void Resume()
 {
     Time.timeScale = 1;
     Hide(pauseText);
     Hide(pauseMenu);
     fader.FadeIn(fadeDuration, 0);
 }
コード例 #3
0
 private void onShowFTUE(GeneralEvent e)
 {
     _fader.FadeOut(FADE_TIME, () =>
     {
         mainMenu.ShowFTUE();
         _fader.FadeIn();
     });
 }
コード例 #4
0
    private IEnumerator Start()
    {
        yield return(StartCoroutine(LoadSceneAndSetActive(sceneToLoad)));

        if (FadeOnSceneLoad)
        {
            m_ScreenFader.FadeIn();
        }
    }
コード例 #5
0
    // Use this for initialization
    void Start()
    {
        GameObject workerCardFab = PrefabManager.instance.workerCardFab;

        screenFader = GameObject.Find("Canvas/ScreenFader").GetComponent <ScreenFader>();
        screenFader.FadeIn();

        card1 = ((GameObject)GameObject.Instantiate(workerCardFab, new Vector2(-5f, 0), Quaternion.identity)).GetComponent <WorkerCard>();
        card2 = ((GameObject)GameObject.Instantiate(workerCardFab, Vector2.zero, Quaternion.identity)).GetComponent <WorkerCard>();
        card3 = ((GameObject)GameObject.Instantiate(workerCardFab, new Vector2(5f, 0), Quaternion.identity)).GetComponent <WorkerCard>();

        List <WorkerType> rolledTypes = new List <WorkerType>();
        Worker            worker1     = CreateRandomWorker(rolledTypes);

        rolledTypes.Add(worker1.type);
        Worker worker2 = CreateRandomWorker(rolledTypes);

        rolledTypes.Add(worker2.type);
        Worker worker3 = CreateRandomWorker(rolledTypes);

        rolledTypes.Add(worker3.type);

        card1.DisplayWorker(worker1, this, 1);
        card2.DisplayWorker(worker2, this, 2);
        card3.DisplayWorker(worker3, this, 3);
    }
コード例 #6
0
    private void Death(bool doDestroy)   // no need to handle the non destructive death, since it never happens
    {
        OnDeath?.Invoke();

        anim.SetBool("isDead", true);
        pc.StopControl();
        Debug.Log("stopped control");
        rb.velocity = Vector2.zero; //prevent sliding
        coroutines.WaitThenExecute(1f, () => {
            sf.FadeIn();
        });
        coroutines.WaitThenExecute(2f, () => {
            hs.FullHealth();
            tr.position = respawnPoint;
        });
        coroutines.WaitThenExecute(3f, () => {
            sf.FadeOut();
        });
        coroutines.WaitThenExecute(3.5f, () => {
            anim.SetBool("isDead", false);
        });
        coroutines.WaitThenExecute(3.8f, () => {
            pc.RegainControl();
            Debug.Log("regained control");
        });
        //TODO finesse this
    }
コード例 #7
0
ファイル: GameOrchestrator.cs プロジェクト: zr3/mrbiscuits
 void Update()
 {
     if (Input.GetKey(KeyCode.LeftShift))
     {
         if (Input.GetKeyDown(KeyCode.PageDown))
         {
             ScreenFader.FadeOutThen(() => {
                 NextPhase();
                 MessageController.AddMessage("CHEAT: Next Phase");
                 ScreenFader.FadeIn();
             });
         }
         if (Input.GetKeyDown(KeyCode.Home))
         {
             MessageController.AddMessage("CHEAT: Clear Save");
             PlayerPrefs.DeleteAll();
         }
         if (Input.GetKeyDown(KeyCode.Escape))
         {
             Application.Quit();
         }
         if (Input.GetKeyDown(KeyCode.End))
         {
             SceneManager.LoadScene("game");
         }
     }
 }
コード例 #8
0
    public IEnumerator LoadScene(string level)
    {
        ScreenFader sf        = GameObject.FindGameObjectWithTag("Fader").GetComponent <ScreenFader>();
        GameObject  bgm       = GameObject.FindGameObjectWithTag("BGM");
        float       startTime = Time.realtimeSinceStartup;

        if (bgm != null)
        {
            bgm.GetComponent <BGMControl>().FadeOut(fadeDuration);
        }

        sf.FadeOut(fadeDuration);

        while (Time.realtimeSinceStartup < startTime + fadeDuration)
        {
            yield return(null);
        }

        SceneManager.LoadScene(level, LoadSceneMode.Single);
        sf.FadeIn(fadeDuration);
        isLoading = false;

        if (Time.timeScale != 1)
        {
            Time.timeScale = 1;
        }
    }
コード例 #9
0
 void Start()
 {
     if (screenFader != null)
     {
         screenFader.gameObject.SetActive(true);
         screenFader.FadeIn();
     }
 }
コード例 #10
0
    IEnumerator RunDemoClosingCo()
    {
        screenFader.FadeIn(2f);
        yield return(new WaitForSeconds(2f));

        LeanTween.value(gameObject, delegate(float value) {
            AudioListener.volume = value;
        }, 1f, 0f, 3f);
    }
コード例 #11
0
 public void SetCountDown()
 {
     screenFader.FadeIn();
     currentCount   = COUNTDOWN_TIME;
     Time.timeScale = 0f;
     hudSelector.setHud(Hud.COUNT);
     pause = true;
     StartCoroutine(countDownForStartingGame());
 }
コード例 #12
0
        public IEnumerator StoryForDay(int day)
        {
            // fade to black

            var x = fader.FadeOut(4);

            while (x.MoveNext())
            {
                yield return(null);
            }

            var text = new string[] {};

            switch (day)
            {
            case 0:
                text = new[]
                { "Illumination",
                  "The Nine Hundred and Ninety Seventh Night",
                  "Scheherazade stands in the middle of the courtyard with lifeless eyes.",
                  "You stare at her hopelessly, wondering if she would say another word to finish her hanging thought-",
                  "But as always, the morning overtakes her and she remains silent." };
                break;

            case 1:
                text = new[]
                { "The Nine Hundred and Ninety Eighth Night",
                  "Scheherazade stands in the middle of the courtyard.",
                  "\"It's morning. I must go to sleep.\"",
                  "She won't look at you." };
                break;

            case 2:
                break;

            case 3:
                break;

            default:
                break;
            }
            yield return(DisplayText(text, fullTele, true));

            yield return(new WaitForSeconds(2));

            fullTele.Clear();


            x = fader.FadeIn(4);
            while (x.MoveNext())
            {
                yield return(null);
            }

            yield return(DisplayText(new[] { "The Nine Hundred and Ninety Eighth Day", "" }, fullTele, true));
        }
コード例 #13
0
ファイル: PassAndPlaySetupState.cs プロジェクト: Xaer033/tuck
    public void Init(GameStateMachine stateMachine, object changeStateData)
    {
        _stateMachine = stateMachine;

        _passPlaySetupController = new PassPlaySetupController();
        _passPlaySetupController.Start(onStartGame, onPassSetupCancel);

        _fader = Singleton.instance.gui.screenFader;
        _fader.FadeIn(0.35f);
    }
コード例 #14
0
        // Update the player's progress based on the level they just played
        private void UpdateGameProgress()
        {
            Debug.Log("--- Overworld : Update Game Progress ---");

            // Fade in the camera
            _screenFader.FadeIn();

            // Center the camera on the player's base (is overriden later if levelInfo is loaded)
            _cameraController.SetCameraPosition(_playerBase.position);

            // No level progress data was found
            var levelProgressData = LevelProgress.Data;

            if (levelProgressData == null)
            {
                return;
            }

            // No level info data was found
            var levelInfo = GetLevelInfoBySceneName(levelProgressData.SceneName);

            if (levelInfo == null)
            {
                return;
            }

            // Set the level as 'Complete' if it was passed and was not previously finished
            if (levelProgressData.LevelPassed && levelInfo.LevelState == LevelState.Unlocked)
            {
                levelInfo.CompleteLevel();
            }

            // Add any item rewards
            RewardItems(levelProgressData, levelInfo);

            // Add resource rewards
            ItemProgress.AddResources(levelProgressData.Resources);

            // Update tower lifetime stats
            TowerProgress.UpdateTowerLifetimeStats(levelProgressData.TowerStats);

            // Update highest level defeated
            levelInfo.UpdateHighestWaveDefeated(levelProgressData.WavesDefeated);

            // Open the level finished window
            _windowLevelFinished.WindowOpen(levelProgressData);

            // Set the camera to the location of the level on the map
            _cameraController.SetCameraPosition(levelInfo.transform.position);

            // Reset the progress data after it has been used
            LevelProgress.ResetLevelProgress();
        }
コード例 #15
0
ファイル: SceneHandler.cs プロジェクト: Talentyre/AnkamaJam
    public void Load(string scene, Action then = null)
    {
        if (LoadingScene)
        {
            return;
        }
        LoadingScene = true;

        PlayerPrefs.Save();
        _screenFader.FadeIn(ScreenFader.DefaultDuration,
                            () => StartCoroutine(LoadScene(scene, then)));
    }
コード例 #16
0
    void Start()
    {
        ScreenFader.FadeIn();

        particles = transform.GetChild(1).gameObject;
        animator  = GetComponentInChildren <Animator>();
        rb        = GetComponent <Rigidbody2D>();
        sprite    = GetComponentInChildren <SpriteRenderer>();
        inputDir  = new Vector2();

        airStorage         = maxAir;
        airImage.sizeDelta = new Vector2(maxAir, maxAir);
    }
コード例 #17
0
    public void Init(GameStateMachine stateMachine, object changeStateData = null)
    {
        _stateMachine = stateMachine;

        _fader = Singleton.instance.gui.screenFader;
        _fader.FadeIn(0.35f);

        _networkManager = Singleton.instance.networkManager;
        _networkManager.onCustomEvent += onCustomEvent;
        _networkManager.Connect();

        _lobbyController = new MultiplayerLobbyController();
        _lobbyController.Start(onJoinRoom, onGoToMainMenu);
    }
コード例 #18
0
 public IEnumerator FadeTransition(string direction)
 {
     if (direction == "In")
     {
         yield return(fader.FadeIn());
     }
     else if (direction == "Out")
     {
         yield return(fader.FadeOut());
     }
     else
     {
         throw new System.Exception("Error: " + direction + " is not a defined direction");
     }
 }
コード例 #19
0
    // Corotina para sincronizar o fade in/out com o carregamento da cena
    public IEnumerator LoadScene(string scene)
    {
        if (GameObject.FindGameObjectWithTag("BGM") != null)
        {
            GameObject.FindGameObjectWithTag("BGM").GetComponent <BGMControl>().FadeOut();
        }
        ScreenFader sf = GameObject.FindGameObjectWithTag("Fader").GetComponent <ScreenFader>();

        sf.FadeOut(fadeDuration);
        yield return(new WaitForSeconds(fadeDuration));

        SceneManager.LoadScene(scene, LoadSceneMode.Single);
        sf.FadeIn(fadeDuration);
        isLoading = false;
    }
コード例 #20
0
    private IEnumerator ToggleLoadingScreenRoutine(bool enable)
    {
        yield return(null);

        if (enable)
        {
            _loadingScreenGroup.gameObject.SetActive(true);
            yield return(ScreenFader.FadeIn(_loadingScreenGroup));
        }
        else
        {
            yield return(ScreenFader.FadeOut(_loadingScreenGroup));

            _loadingScreenGroup.gameObject.SetActive(false);
        }
    }
コード例 #21
0
    IEnumerator OnTriggerEnter2D(Collider2D other)
    {
        if (inTransition == false)
        {
            other.GetComponent <PlayerMovement>().freeze = true;
            ScreenFader af = GameObject.FindWithTag("Fader").GetComponent <ScreenFader> ();
            yield return(StartCoroutine(af.FadeOut()));


            target.GetComponent <Warp>().inTransition = true;
            other.gameObject.transform.position       = target.position;
            Camera.main.transform.position            = target.position;

            yield return(StartCoroutine(af.FadeIn()));
        }
    }
コード例 #22
0
    /// <summary>
    /// MonoBehaviour 개체를 초기화합니다.
    /// </summary>
    void Start()
    {
        // 사운드 이펙트 소스를 초기화합니다.
        _seSources = new AudioSource[_soundEffects.Length];
        for (int i = 0; i < _soundEffects.Length; ++i)
        {
            AudioSource seSource = gameObject.AddComponent <AudioSource>();
            seSource.clip = _soundEffects[i];
            _seSources[i] = seSource;
        }

        //
        ChangeItem(0, 0);

        //
        _fader.FadeIn();
    }
コード例 #23
0
    /// <summary>
    /// MonoBehaviour 개체를 초기화합니다.
    /// </summary>
    void Start()
    {
        Time.timeScale = 1;

        // 효과음 리스트를 초기화 합니다.
        _seSources = new AudioSource[soundEffects.Length];
        for (int i = 0, len = _seSources.Length; i < len; ++i)
        {
            _seSources[i]      = gameObject.AddComponent <AudioSource>();
            _seSources[i].clip = soundEffects[i];
        }

        // 페이드인 효과를 실행합니다.
        fader.FadeIn();

        //
        GameManager.Instance.RequestSetTryCount(2);
    }
コード例 #24
0
ファイル: GameOrchestrator.cs プロジェクト: zr3/mrbiscuits
 void Start()
 {
     messagePanel = GameObject.Find("MessagePanel").GetComponent <RectTransform>();
     goalText     = GameObject.Find("GoalText").GetComponent <Text>();
     _instance    = this;
     if (PlayerPrefs.HasKey("level") && PlayerPrefs.GetInt("level") > 0)
     {
         int level = PlayerPrefs.GetInt("level");
         for (int i = 0; i < level; ++i)
         {
             NextPhase(onlyLog: i < level - 1);
         }
     }
     else
     {
         EnterPhase(GamePhase.LearnActions);
     }
     ScreenFader.FadeIn();
 }
コード例 #25
0
    private IEnumerator OnRoomLoad()
    {
        if (SceneManager.GetActiveScene().buildIndex == currentRoom)
        {
            yield break;
        }

        while (SceneManager.GetActiveScene().buildIndex != currentRoom)
        {
            yield return(null);
        }

        fader = FindObjectOfType <ScreenFader>();

        if (fader != null)
        {
            StartCoroutine(fader.FadeIn());
        }
    }
コード例 #26
0
    /// <summary>
    /// MonoBehaviour 개체를 초기화합니다.
    /// </summary>
    void Start()
    {
        // 효과음 리스트를 초기화 합니다.
        _seSources = new AudioSource[_soundEffects.Length];
        for (int i = 0, len = _seSources.Length; i < len; ++i)
        {
            _seSources[i]      = gameObject.AddComponent <AudioSource>();
            _seSources[i].clip = _soundEffects[i];
        }

        // 페이드인 효과를 실행합니다.
        _fader.FadeIn();

        // 필드를 초기화합니다.
        _saveDataCount = PlayerPrefs.GetInt("SaveDataCount", 5);
        if (_saveDataCount > 0)
        {
            ChangeSaveItem(0);
        }
    }
コード例 #27
0
    public void GoToPhase(Phase nextPhase)
    {
        // Revert phase first
        RemoveAllHexes(HexMode.AFFECTED);
        RemoveAllHexes(HexMode.HIGHLIGHT);

        switch (nextPhase)
        {
        case Phase.SCOUT:
            //TODO: Bring back fog of war
            //SetAllHexes(HexMode.FOG);
            RevealHexes(0, 0);
            screenFader.FadeIn();
            break;

        case Phase.PLACEMENT:

            break;

        case Phase.ALIGNMENT:
            break;

        case Phase.GROW:
            StartGrowing();
            break;

        case Phase.RESULTS:
            ShowResultsPanel(true);
            break;

        case Phase.FADEOUT:
            ShowResultsPanel(false);
            break;
        }

        turnButton.GoToPhase(nextPhase);
        phase = nextPhase;
    }
コード例 #28
0
    IEnumerator LoadOpponent()
    {
        description.text = "상대 정보를 불러오는 중입니다";
        WWW w = new WWW("http://106.248.205.164:92/CrayonGame/gamedata.txt");

        yield return(w);

        if (!string.IsNullOrEmpty(w.error))
        {
            Debug.Log(w.error);
        }
        else
        {
            print("Card Info ->" + w.text);
        }

        fader.FadeIn();
        yield return(StartCoroutine(processBattle.DataLoading()));

        yield return(new WaitForSeconds(1.5f));

        fader.FadeOut();
        sceneManager.ChangeScene(SceneManager.ProcessType.Battle);
    }
コード例 #29
0
 // Use this for initialization
 void Start()
 {
     screenFader = GameObject.Find("Canvas/ScreenFader").GetComponent <ScreenFader>();
     screenFader.FadeIn();
 }
コード例 #30
0
    /// <summary>
    /// 스크립트에 따라 액션을 수행하는 코루틴입니다.
    /// </summary>
    /// <returns>DoNextScript() 함수 호출의 결과입니다.</returns>
    IEnumerator ActWithCoroutine()
    {
        string[] action  = _actionScriptList[_actionScriptIndex++];
        string   command = action[0];

        int     index;
        float   _time;
        float   fadeSpeed;
        string  levelName;
        Vector2 position;

        // 명령에 따라 액션을 수행합니다.
        switch (command)
        {
        // 일정 시간동안 대기합니다.
        case "WaitForSeconds":
            _time = float.Parse(action[1]);
            yield return(new WaitForSeconds(_time));

            break;

        // 레벨을 불러옵니다.
        case "Load":
            levelName = action[1];
            LoadingSceneManager.LoadLevel(levelName);
            break;

        // 이미지를 슬라이드합니다.
        case "SlideImage":
            index    = int.Parse(action[1]);
            _time    = float.Parse(action[2]);
            position = new Vector2(float.Parse(action[3]), float.Parse(action[4]));
            {
                SpriteRenderer image       = _cutsceneImages[index];
                Rigidbody2D    image_rbody = image.GetComponent <Rigidbody2D>();
                Vector2        diff        = position - new Vector2(image.transform.position.x, image.transform.position.y);
                image_rbody.velocity = diff / _time;
                yield return(new WaitForSeconds(_time));

                image_rbody.velocity = Vector2.zero;
            }
            break;

        // 이미지를 화면에 표시합니다.
        case "EnableImage":
            index = int.Parse(action[1]);
            _cutsceneImages[index].enabled = true;
            break;

        // 화면에 표시한 이미지를 disable합니다.
        case "DisableImage":
            index = int.Parse(action[1]);
            _cutsceneImages[index].enabled = false;
            break;

        // 장면에 페이드인 효과를 부여합니다.
        case "SceneFadeIn":
            fadeSpeed = float.Parse(action[1]);
            _fader.FadeIn(fadeSpeed);
            break;

        // 장면에 페이드아웃 효과를 부여합니다.
        case "SceneFadeOut":
            fadeSpeed = float.Parse(action[1]);
            _fader.FadeOut(fadeSpeed);
            break;

        // 배경 음악을 재생합니다.
        case "PlayMusic":
            index = int.Parse(action[1]);
            if (action.Length > 2)
            {
                _bgmSource.volume = float.Parse(action[2]);
            }
            else
            {
                _bgmSource.volume = 1;
            }

            _bgmSource.clip = _audioSources[index].clip;
            _bgmSource.Play();
            break;

        // 음악 재생을 중지합니다.
        case "StopMusic":
            _bgmSource.Stop();
            break;

        // 효과음을 재생합니다.
        case "PlaySound":
            index = int.Parse(action[1]);
            _time = float.Parse(action[2]);
            _audioSources[index].Play();
            yield return(new WaitForSeconds(_time));

            break;

        //
        case "FadeOutMusic":
            while (_bgmSource.volume > 0)
            {
                _bgmSource.volume -= Time.deltaTime;
                yield return(new WaitForSeconds(0.5f));
            }
            break;
        }

        // 액션 수행이 모두 종료되었으므로 스위치를 닫습니다.
        _actionScriptPlaying = false;

        /**
         * // CHECK: 문제가 발생할 때 이 부분을 먼저 확인하세요.
         * // 원래는 이런 구문이 없었습니다.
         * {
         *  StopCoroutine(_actionScriptCoroutine);
         *  _actionScriptCoroutine = null;
         * }
         */

        // 다음 스크립트를 수행합니다.
        DoNextScript();
    }