Exemplo n.º 1
0
    void Awake()
    {
        if (Instance)
        {
            Destroy(gameObject);
        }
        else {
            DontDestroyOnLoad(gameObject);
            Instance = this;
        }

        // mark code
        // single audio source
        // load sound effects with resources.load once in Awake
        gameObject.AddComponent<AudioSource>();

        clipHolder = new AudioClip[7];
        clipHolder[0] = Resources.Load("SoundFX/pause") as AudioClip;
        clipHolder[1] = Resources.Load("SoundFX/ascending_tier") as AudioClip;
        clipHolder[2] = Resources.Load("SoundFX/descending_tier") as AudioClip;
        clipHolder[3] = Resources.Load("SoundFX/duckling_pickup") as AudioClip;
        clipHolder[4] = Resources.Load("SoundFX/duckling_death") as AudioClip;
        clipHolder[5] = Resources.Load("SoundFX/duck_zapped") as AudioClip;
        clipHolder[6] = Resources.Load("SoundFX/level_completed") as AudioClip;
    }
Exemplo n.º 2
0
 void Start()
 {
     gearType = "CameraFxTrigger";
     ID = (uint)defaultID;
     handler = gameObject.AddComponent<SfxHandler>();
     AddListeners();
 }
Exemplo n.º 3
0
 public void EvolveToEndlessFX(int fxID,uint start)
 {
     m_fxID = fxID;
     handler = gameObject.AddComponent<SfxHandler>();
     TimerHeap.AddTimer(start, 0, () => { handler.HandleFx(m_fxID, m_transform); });
     
 }
Exemplo n.º 4
0
    private SfxHandler sfxScript;       // Sound effects manager

	public void Start ()
	{
		this.mamaWayPoint = GameObject.Find ("wayPoint");
		this.mamaScript = GameObject.FindGameObjectWithTag ("Player").GetComponent<PlayerControl> ();

        //markcode: set the sfxScript varialbe to the SfxHandler script attached to the game controller
        this.sfxScript = (SfxHandler)GameObject.FindGameObjectWithTag("GameController").GetComponent(typeof(SfxHandler));
	}
Exemplo n.º 5
0
    private SfxHandler sfxScript;       // markcode

	public void Start () {
		player_ref = GameObject.FindGameObjectWithTag ("Player");
		ducklings_ref = GameObject.FindGameObjectsWithTag ("Duckling");
		cc = (CameraController)GameObject.FindGameObjectWithTag ("MainCamera").GetComponent (typeof(CameraController));

        // markcode: set the sfxScript varialbe to the SfxHandler script attached to the game controller
        this.sfxScript = (SfxHandler)GameObject.FindGameObjectWithTag("GameController").GetComponent(typeof(SfxHandler));
    }
Exemplo n.º 6
0
    void Start()
    {
        gearType = "DropRock";
        gameObject.AddComponent<Rigidbody>();
        triggleEnable = true;

        sfxHandler = gameObject.AddComponent<SfxHandler>();
        timerID = uint.MaxValue;
    }
Exemplo n.º 7
0
	void Start()
	{
		gearType = "FxTrigger";
		triggleEnable = true;
		stateOne = true;        
		ID = (uint)defaultID;
		handler = gameObject.AddComponent<SfxHandler>();

		AddListeners();
	}
Exemplo n.º 8
0
    private SfxHandler sfxScript;     // markcode

	public override void Start () {
		base.Start();
		GameObject gc = GameObject.FindGameObjectWithTag ("GameController");
		ih = (InputHandler)gc.GetComponent(typeof(InputHandler));
		ih.UnFreeze ();
		gcs = (GameControllerScript)gc.GetComponent (typeof(GameControllerScript)); 
		tc = (TierController)this.gameObject.GetComponent (typeof(TierController));

        // markcode: set the sfxScript varialbe to the SfxHandler script attached to the game controller
        this.sfxScript = (SfxHandler)GameObject.FindGameObjectWithTag("GameController").GetComponent(typeof(SfxHandler));
    }
Exemplo n.º 9
0
    void Start()
    {
        gearType = "FoggyAbyssDoor";

        ID = (uint)defaultID;

        handler = gameObject.AddComponent<SfxHandler>();
        isOpen = false;

        AddListeners();

        EventDispatcher.TriggerEvent(Events.InstanceUIEvent.GetFoggyAbyssMessage);
    }
Exemplo n.º 10
0
    void Start()
    {
        gearType = "GolemFx";

        ID = (uint)defaultID;

        handler = gameObject.AddComponent<SfxHandler>();

        //EventDispatcher.AddEventListener<uint>(Events.GearEvent.SetGearEnable, SetGearEnable);
        //EventDispatcher.AddEventListener<uint>(Events.GearEvent.SetGearDisable, SetGearDisable);
        //EventDispatcher.AddEventListener<uint>(Events.GearEvent.SetGearStateOne, SetGearStateOne);
        //EventDispatcher.AddEventListener<uint>(Events.GearEvent.SetGearStateTwo, SetGearStateTwo);
    }
Exemplo n.º 11
0
	void Start()
	{
		gearType = "Bomb";
		triggleEnable = true;

		sfxHandler = gameObject.AddComponent<SfxHandler>();

		timerID = uint.MaxValue;

		sfxHandler.HandleFx(6011, null, (go, dbid) =>
		{
			go.transform.position = MogoWorld.thePlayer.Transform.position;
		});
	}
Exemplo n.º 12
0
    void Start()
    {
        gearType = "MagmaGear";

        triggleEnable = true;

        isBurning = false;

        magmaDamageTimer = uint.MaxValue;
        onFireDamageTimer = uint.MaxValue;

        sfxHandler = gameObject.AddComponent<SfxHandler>();

        AddListeners();
    }
Exemplo n.º 13
0
    public IEnumerator respawnHeal()
    {
        if (PlayerMovement.player.setCheckBusyWith(this.gameObject))
        {
            for (int i = 0; i < 6; i++)
            {
                pokeBalls[i].enabled = false;
            }

            yield return(new WaitForSeconds(0.8f));

            Dialog.drawDialogBox();
            yield return(StartCoroutine(Dialog.drawText("First, let's restore your Pokémon\nto full health.")));

            yield return(new WaitForSeconds(0.5f));

            nurse.setDirection(3);

            yield return(new WaitForSeconds(0.2f));

            //place balls on machine, healing as they get shown
            for (int i = 0; i < 6; i++)
            {
                if (SaveData.currentSave.PC.boxes[0][i] != null)
                {
                    SaveData.currentSave.PC.boxes[0][i].healFull();
                    pokeBalls[i].enabled = true;
                    SfxHandler.Play(ballPlaceClip);
                    yield return(new WaitForSeconds(0.45f));
                }
            }
            yield return(new WaitForSeconds(0.25f));

            BgmHandler.main.PlayMFX(healMFX);
            //animate the balls to glow 4 times
            for (int r = 0; r < 4; r++)
            {
                StartCoroutine(flashScreen(0.45f));
                for (int i = 0; i < 5; i++)
                {
                    for (int i2 = 0; i2 < 6; i2++)
                    {
                        pokeBalls[i2].sprite = ballHealSprites[i];
                    }
                    yield return(new WaitForSeconds(0.09f));
                }
            }

            //reset the ball sprites
            for (int i = 0; i < 6; i++)
            {
                pokeBalls[i].sprite = ballHealSprites[0];
            }
            yield return(new WaitForSeconds(1f));

            //remove the balls from the machine
            for (int i = 0; i < 6; i++)
            {
                pokeBalls[i].enabled = false;
            }

            yield return(new WaitForSeconds(0.2f));

            nurse.setDirection(2);

            Dialog.drawDialogBox();
            yield return(StartCoroutine(Dialog.drawText("Your Pokémon have been healed to\nperfect health.")));

            while (!Input.GetButtonDown("Select") && !Input.GetButtonDown("Back"))
            {
                yield return(null);
            }
            Dialog.drawDialogBox();
            yield return
                (StartCoroutine(Dialog.drawText("Please visit a Pokémon Center when your\nPokémon's HP goes down.")));

            while (!Input.GetButtonDown("Select") && !Input.GetButtonDown("Back"))
            {
                yield return(null);
            }
            Dialog.drawDialogBox();
            yield return
                (StartCoroutine(
                     Dialog.drawText("If you're planning to travel any distance,\nyou should stock up on Potions.")));

            while (!Input.GetButtonDown("Select") && !Input.GetButtonDown("Back"))
            {
                yield return(null);
            }

            PlayerMovement.player.followerScript.canMove = true;

            Dialog.drawDialogBox();
            yield return(StartCoroutine(Dialog.drawText("Good luck, Trainer!")));

            while (!Input.GetButtonDown("Select") && !Input.GetButtonDown("Back"))
            {
                yield return(null);
            }

            Dialog.undrawDialogBox();

            PlayerMovement.player.unsetCheckBusyWith(this.gameObject);
        }
    }
Exemplo n.º 14
0
    public IEnumerator control()
    {
        screens.position       = new Vector3(0, 0, 0);
        badgeBoxLid.pixelInset = new Rect(6, 20, 252, 165);
        //sceneTransition.FadeIn();
        StartCoroutine(ScreenFade.main.Fade(true, ScreenFade.defaultSpeed));

        running = true;
        StartCoroutine("animBG");
        StartCoroutine("animColon");

        cancelSelected = false;
        cancel.texture = cancelTex;
        updateData();
        currentScreen     = 1;
        interactingScreen = false;
        badgeSel.enabled  = false;
        currentBadge      = 0;
        updateSelectedBadge();
        badgeSel.pixelInset = badges[0].pixelInset;


        while (running)
        {
            if (Input.GetAxisRaw("Horizontal") > 0)
            {
                if (!interactingScreen)
                {
                    if (currentScreen < 2)
                    {
                        SfxHandler.Play(selectClip);
                        yield return(new WaitForSeconds(moveVisableScreen(1)));

                        currentScreen += 1;
                    }
                }
                else
                {
                    if (currentBadge < 11 && currentBadge != 5 && !cancelSelected)
                    {
                        SfxHandler.Play(selectClip);
                        currentBadge += 1;
                        updateSelectedBadge();
                        yield return(StartCoroutine(moveBadgeSelect(badges[currentBadge])));
                    }
                }
            }
            else if (Input.GetAxisRaw("Horizontal") < 0)
            {
                if (!interactingScreen)
                {
                    if (currentScreen > 1)
                    {
                        SfxHandler.Play(selectClip);
                        yield return(new WaitForSeconds(moveVisableScreen(-1)));

                        currentScreen -= 1;
                    }
                }
                else
                {
                    if (currentBadge > 0 && currentBadge != 6 && !cancelSelected)
                    {
                        SfxHandler.Play(selectClip);
                        currentBadge -= 1;
                        updateSelectedBadge();
                        yield return(StartCoroutine(moveBadgeSelect(badges[currentBadge])));
                    }
                }
            }
            else if (Input.GetAxisRaw("Vertical") > 0)
            {
                if (interactingScreen)
                {
                    if (cancelSelected)
                    {
                        SfxHandler.Play(selectClip);
                        cancelSelected   = false;
                        cancel.texture   = cancelTex;
                        badgeSel.enabled = true;
                        yield return(new WaitForSeconds(0.2f));
                    }
                    else if (currentBadge > 5)
                    {
                        SfxHandler.Play(selectClip);
                        currentBadge -= 6;
                        updateSelectedBadge();
                        yield return(StartCoroutine(moveBadgeSelect(badges[currentBadge])));
                    }
                }
                else
                {
                    if (cancelSelected)
                    {
                        SfxHandler.Play(selectClip);
                        cancelSelected = false;
                        cancel.texture = cancelTex;
                        yield return(new WaitForSeconds(0.2f));
                    }
                }
            }
            else if (Input.GetAxisRaw("Vertical") < 0)
            {
                if (interactingScreen)
                {
                    if (currentBadge < 6)
                    {
                        SfxHandler.Play(selectClip);
                        currentBadge += 6;
                        updateSelectedBadge();
                        yield return(StartCoroutine(moveBadgeSelect(badges[currentBadge])));
                    }
                    else if (!cancelSelected)
                    {
                        SfxHandler.Play(selectClip);
                        cancelSelected   = true;
                        cancel.texture   = cancelHighlightTex;
                        badgeSel.enabled = false;
                        yield return(new WaitForSeconds(0.2f));
                    }
                }
                else if (!cancelSelected)
                {
                    SfxHandler.Play(selectClip);
                    cancelSelected = true;
                    cancel.texture = cancelHighlightTex;
                    yield return(new WaitForSeconds(0.2f));
                }
            }
            else if (Input.GetButton("Select"))
            {
                if (cancelSelected && !interactingScreen)
                {
                    SfxHandler.Play(selectClip);
                    running = false;
                }
                else if (currentScreen == 2)
                {
                    if (!interactingScreen)
                    {
                        SfxHandler.Play(selectClip);
                        yield return(StartCoroutine(moveScreen(new Vector3(-0.92f, 0, 0), 0.2f)));

                        interactingScreen = true;
                        updateSelectedBadge();
                        badgeSel.enabled = true;
                    }
                    else if (cancelSelected)
                    {
                        SfxHandler.Play(selectClip);
                        badgeSel.enabled  = false;
                        interactingScreen = false;
                        updateSelectedBadge();
                        cancelSelected = false;
                        cancel.texture = cancelTex;
                        yield return(StartCoroutine(moveScreen(new Vector3(-0.806f, 0, 0), 0.2f)));
                    }
                }
            }
            else if (Input.GetButton("Back"))
            {
                if (interactingScreen)
                {
                    SfxHandler.Play(selectClip);
                    badgeSel.enabled  = false;
                    interactingScreen = false;
                    updateSelectedBadge();
                    yield return(StartCoroutine(moveScreen(new Vector3(-0.806f, 0, 0), 0.2f)));
                }
                else
                {
                    SfxHandler.Play(selectClip);
                    cancelSelected = true;
                    cancel.texture = cancelHighlightTex;
                    running        = false;
                }
            }
            yield return(null);
        }
        if (currentScreen != 1)
        {
            StartCoroutine("boxLid", true);
        }
        //yield return new WaitForSeconds(sceneTransition.FadeOut());
        yield return(StartCoroutine(ScreenFade.main.Fade(false, ScreenFade.defaultSpeed)));

        this.gameObject.SetActive(false);
    }
Exemplo n.º 15
0
    private void CreateCharacterModel(AvatarModelData ai, int vocation, CharacterInfoData ci, Action loaded)
    {
        if (m_avatarList.ContainsKey(vocation) && loaded != null)
        {
            if (m_avatarList[vocation].actorParent != null)
            {
                loaded();
                return;
            }
            if (m_avatarList[vocation].gameObject != null)
            {
                AssetCacheMgr.ReleaseInstance(m_avatarList[vocation].gameObject);
            }
        }
        AssetCacheMgr.GetInstanceAutoRelease(ai.prefabName, (prefab, id, go) =>
        {
            var ety                      = new EtyAvatar();
            ety.vocation                 = vocation;
            ety.equipList                = ci.EquipList;
            ety.weapon                   = ci.Weapon;
            ety.CreatePosition           = ci.Location;
            var avatar                   = (go as GameObject);
            ety.gameObject               = avatar;
            avatar.name                  = vocation.ToString();
            var cc                       = avatar.collider as CharacterController;
            cc.radius                    = 0.5f;
            ety.animator                 = avatar.GetComponent <Animator>();
            ety.animator.applyRootMotion = false;
            ety.PlayerShader             = PlayerShader;
            ety.FakeLightShader          = FakeLightShader;
            //MogoFXManager.Instance.AttachShadow(avatar, string.Concat(avatar.name, "_Shadow"), 0, 0, 0, 1.5f, 1.5f, 1);

            if (vocation == 1)
            {
                MogoFXManager.Instance.AttachShadow(avatar, string.Concat(avatar.name, "_Shadow"), 0, 0, 0, 1.5f, 1.5f, 1, -0.4f, 0.01f, -0.5f);
            }
            else if (vocation == 2)
            {
                MogoFXManager.Instance.AttachShadow(avatar, string.Concat(avatar.name, "_Shadow"), 0, 0, 0, 1.5f, 1.5f, 1, 0, 0.01f, 0.2f);
            }
            else if (vocation == 3)
            {
                MogoFXManager.Instance.AttachShadow(avatar, string.Concat(avatar.name, "_Shadow"), 0, 0, 0, 1.5f, 1.5f, 1, 0, 0.01f, 0.2f);
            }
            else if (vocation == 4)
            {
                MogoFXManager.Instance.AttachShadow(avatar, string.Concat(avatar.name, "_Shadow"), 0, 0, 0, 1.5f, 1.5f, 1, 0, 0.01f, 0.2f);
            }
            else if (vocation == 3 || vocation == 4)
            {
                // 敬请期待
                AssetCacheMgr.GetInstanceAutoRelease("fx_jqqd.prefab", (prefabb, idd, goo) =>
                {
                    GameObject goFX           = (GameObject)goo;
                    goFX.transform.parent     = avatar.transform;
                    goFX.transform.localScale = Vector3.one;

                    if (vocation == 3)
                    {
                        goFX.transform.localPosition = new Vector3(0, 2.2f, 0);
                    }
                    else
                    {
                        goFX.transform.localPosition = new Vector3(0, 2f, 0);
                    }
                });
            }

            #region 动作

            if (m_Animators.ContainsKey(vocation))
            {
                m_Animators[vocation] = avatar.GetComponent <Animator>();
            }
            else
            {
                m_Animators.Add(vocation, avatar.GetComponent <Animator>());
            }

            #endregion

            avatar.transform.position   = ci.Location;
            avatar.transform.localScale = Vector3.one;

            ety.sfxHandler = avatar.AddComponent <SfxHandler>();

            #region 特效 和 特效删除函数定时器

            if (!m_sfxHandlers.ContainsKey(vocation))
            {
                SfxHandler handler = avatar.GetComponent <SfxHandler>();
                if (handler == null)
                {
                    handler = avatar.AddComponent <SfxHandler>();
                }
                m_sfxHandlers.Add(vocation, handler);
                uint timer = uint.MaxValue;
                m_fxTimes.Add(vocation, timer);
            }

            #endregion

            ety.actorParent = avatar.AddComponent <ActorParent>();
            ety.actorParent.SetNakedEquid(ai.nakedEquipList);
            ety.InitEquip();

            if (m_avatarList.ContainsKey(vocation))
            {
                m_avatarList[vocation].sfxHandler.RemoveAllFX();
                AssetCacheMgr.ReleaseInstance(m_avatarList[vocation].gameObject);
            }
            ety.Hide();
            m_avatarList[vocation] = ety;
            AssetCacheMgr.GetResource(ci.controller,
                                      (obj) =>
            {
                var controller = obj as RuntimeAnimatorController;
                if (ety.animator)
                {
                    ety.animator.runtimeAnimatorController = controller;
                }
                if (loaded != null)
                {
                    loaded();
                }
            });
        });
    }
Exemplo n.º 16
0
    private IEnumerator LearnMove(Pokemon selectedPokemon, string move)
    {
        int chosenIndex = 1;

        if (chosenIndex == 1)
        {
            bool learning = true;
            while (learning)
            {
                //Moveset is full
                if (selectedPokemon.getMoveCount() == 4)
                {
                    dialog.DrawDialogBox();
                    yield return
                        (StartCoroutine(
                             dialog.DrawText(selectedPokemon.getName() + " wants to learn the \nmove " + move + ".")));

                    while (!Input.GetButtonDown("Select") && !Input.GetButtonDown("Back"))
                    {
                        yield return(null);
                    }
                    dialog.DrawDialogBox();
                    yield return
                        (StartCoroutine(
                             dialog.DrawText("However, " + selectedPokemon.getName() + " already \nknows four moves.")));

                    while (!Input.GetButtonDown("Select") && !Input.GetButtonDown("Back"))
                    {
                        yield return(null);
                    }
                    dialog.DrawDialogBox();
                    yield return
                        (StartCoroutine(dialog.DrawText("Should a move be deleted and \nreplaced with " + move + "?")));

                    yield return(StartCoroutine(dialog.DrawChoiceBox()));

                    chosenIndex = dialog.chosenIndex;
                    dialog.UndrawChoiceBox();
                    if (chosenIndex == 1)
                    {
                        dialog.DrawDialogBox();
                        yield return(StartCoroutine(dialog.DrawText("Which move should \nbe forgotten?")));

                        while (!Input.GetButtonDown("Select") && !Input.GetButtonDown("Back"))
                        {
                            yield return(null);
                        }

                        yield return(StartCoroutine(ScreenFade.main.Fade(false, ScreenFade.defaultSpeed)));

                        //Set SceneSummary to be active so that it appears
                        Scene.main.Summary.gameObject.SetActive(true);
                        StartCoroutine(Scene.main.Summary.control(selectedPokemon, move));
                        //Start an empty loop that will only stop when SceneSummary is no longer active (is closed)
                        while (Scene.main.Summary.gameObject.activeSelf)
                        {
                            yield return(null);
                        }

                        string replacedMove = Scene.main.Summary.replacedMove;
                        yield return(StartCoroutine(ScreenFade.main.Fade(true, ScreenFade.defaultSpeed)));

                        if (!string.IsNullOrEmpty(replacedMove))
                        {
                            dialog.DrawDialogBox();
                            yield return(StartCoroutine(dialog.DrawTextSilent("1, ")));

                            yield return(new WaitForSeconds(0.4f));

                            yield return(StartCoroutine(dialog.DrawTextSilent("2, ")));

                            yield return(new WaitForSeconds(0.4f));

                            yield return(StartCoroutine(dialog.DrawTextSilent("and... ")));

                            yield return(new WaitForSeconds(0.4f));

                            yield return(StartCoroutine(dialog.DrawTextSilent("... ")));

                            yield return(new WaitForSeconds(0.4f));

                            yield return(StartCoroutine(dialog.DrawTextSilent("... ")));

                            yield return(new WaitForSeconds(0.4f));

                            SfxHandler.Play(forgetMoveClip);
                            yield return(StartCoroutine(dialog.DrawTextSilent("Poof!")));

                            while (!Input.GetButtonDown("Select") && !Input.GetButtonDown("Back"))
                            {
                                yield return(null);
                            }

                            dialog.DrawDialogBox();
                            yield return
                                (StartCoroutine(
                                     dialog.DrawText(selectedPokemon.getName() + " forgot how to \nuse " + replacedMove +
                                                     ".")));

                            while (!Input.GetButtonDown("Select") && !Input.GetButtonDown("Back"))
                            {
                                yield return(null);
                            }
                            dialog.DrawDialogBox();
                            yield return(StartCoroutine(dialog.DrawText("And...")));

                            while (!Input.GetButtonDown("Select") && !Input.GetButtonDown("Back"))
                            {
                                yield return(null);
                            }

                            dialog.DrawDialogBox();
                            AudioClip mfx = Resources.Load <AudioClip>("Audio/mfx/GetAverage");
                            BgmHandler.main.PlayMFX(mfx);
                            StartCoroutine(dialog.DrawTextSilent(selectedPokemon.getName() + " learned \n" + move + "!"));
                            yield return(new WaitForSeconds(mfx.length));

                            while (!Input.GetButtonDown("Select") && !Input.GetButtonDown("Back"))
                            {
                                yield return(null);
                            }
                            dialog.UndrawDialogBox();
                            learning = false;
                        }
                        else
                        {
                            //give up?
                            chosenIndex = 0;
                        }
                    }
                    if (chosenIndex == 0)
                    {
                        //NOT ELSE because this may need to run after (chosenIndex == 1) runs
                        dialog.DrawDialogBox();
                        yield return(StartCoroutine(dialog.DrawText("Give up on learning the move \n" + move + "?")));

                        yield return(StartCoroutine(dialog.DrawChoiceBox()));

                        chosenIndex = dialog.chosenIndex;
                        dialog.UndrawChoiceBox();
                        if (chosenIndex == 1)
                        {
                            learning    = false;
                            chosenIndex = 0;
                        }
                    }
                }
                //Moveset is not full, can fit the new move easily
                else
                {
                    selectedPokemon.addMove(move);

                    dialog.DrawDialogBox();
                    AudioClip mfx = Resources.Load <AudioClip>("Audio/mfx/GetAverage");
                    BgmHandler.main.PlayMFX(mfx);
                    StartCoroutine(dialog.DrawTextSilent(selectedPokemon.getName() + " learned \n" + move + "!"));
                    yield return(new WaitForSeconds(mfx.length));

                    while (!Input.GetButtonDown("Select") && !Input.GetButtonDown("Back"))
                    {
                        yield return(null);
                    }
                    dialog.UndrawDialogBox();
                    learning = false;
                }
            }
        }
        if (chosenIndex == 0)
        {
            //NOT ELSE because this may need to run after (chosenIndex == 1) runs
            //cancel learning loop
            dialog.DrawDialogBox();
            yield return(StartCoroutine(dialog.DrawText(selectedPokemon.getName() + " did not learn \n" + move + ".")));

            while (!Input.GetButtonDown("Select") && !Input.GetButtonDown("Back"))
            {
                yield return(null);
            }
        }
    }
Exemplo n.º 17
0
    public IEnumerator interact()
    {
        if (PlayerMovement.player.direction == 0)
        {
            if (PlayerMovement.player.setCheckBusyWith(this.gameObject))
            {
                spriteLight.enabled = true;
                PClight.enabled     = true;
                SfxHandler.Play(onClip);
                yield return(StartCoroutine("onAnim"));

                Dialog.drawDialogBox();
                yield return(Dialog.StartCoroutine("drawTextSilent", SaveData.currentSave.playerName + " turned on the PC!"));

                while (!Input.GetButtonDown("Select") && !Input.GetButtonDown("Back"))
                {
                    yield return(null);
                }
                int accessedPC = -1;
                while (accessedPC != 0)
                {
                    Dialog.drawDialogBox();
                    yield return(Dialog.StartCoroutine("drawText", "Which PC should be accessed?"));

                    Dialog.drawChoiceBox(new string[] { "Someone's", "Switch off" });
                    yield return(Dialog.StartCoroutine("choiceNavigate"));

                    Dialog.undrawChoiceBox();
                    accessedPC = Dialog.chosenIndex;
                    int accessedBox = -1;
                    if (accessedPC != 0)
                    {
                        //if not turning off computer
                        Dialog.drawDialogBox();
                        SfxHandler.Play(openClip);
                        yield return
                            (Dialog.StartCoroutine("drawTextSilent", "The Pokémon Storage System \\was accessed."));

                        while (!Input.GetButtonDown("Select") && !Input.GetButtonDown("Back"))
                        {
                            yield return(null);
                        }
                        while (accessedBox != 0 && accessedPC != 0)
                        {
                            //if not turning off computer
                            string[] choices        = new string[] { "Move", "Log off" };
                            string[] choicesFlavour = new string[]
                            {
                                "You may rearrange Pokémon in and \\between your party and Boxes.",
                                "Log out of the Pokémon Storage \\System."
                            };
                            Dialog.drawChoiceBox(choices);
                            Dialog.drawDialogBox();
                            Dialog.drawTextInstant(choicesFlavour[0]);
                            yield return(new WaitForSeconds(0.2f));

                            yield return(StartCoroutine(Dialog.choiceNavigate(choices, choicesFlavour)));

                            accessedBox = Dialog.chosenIndex;
                            //SceneTransition sceneTransition = Dialog.transform.GetComponent<SceneTransition>();

                            if (accessedBox == 1)
                            {
                                //access Move
                                SfxHandler.Play(selectClip);
                                StartCoroutine(ScreenFade.main.Fade(false, ScreenFade.defaultSpeed));
                                yield return(new WaitForSeconds(ScreenFade.defaultSpeed + 0.4f));

                                //yield return new WaitForSeconds(sceneTransition.FadeOut(0.4f) + 0.4f);
                                SfxHandler.Play(openClip);
                                //Set ScenePC to be active so that it appears
                                Scene.main.PC.gameObject.SetActive(true);
                                StartCoroutine(Scene.main.PC.control());
                                //Start an empty loop that will only stop when ScenePC is no longer active (is closed)
                                while (Scene.main.PC.gameObject.activeSelf)
                                {
                                    yield return(null);
                                }
                                yield return(StartCoroutine(ScreenFade.main.Fade(true, 0.4f)));
                                //yield return new WaitForSeconds(sceneTransition.FadeIn(0.4f));
                            }

                            Dialog.undrawChoiceBox();
                        }
                    }
                }
                Dialog.undrawDialogBox();
                spriteLight.enabled = false;
                PClight.enabled     = false;
                SfxHandler.Play(offClip);
                yield return(new WaitForSeconds(0.2f));

                PlayerMovement.player.unsetCheckBusyWith(this.gameObject);
            }
        }
    }
Exemplo n.º 18
0
    public IEnumerator control(Pokemon[] pokemonList, int currentPosition, bool learning, string newMoveString)
    {
        moves.localPosition = (learning)? new Vector3(0, 32) : Vector3.zero;
        newMove.gameObject.SetActive(learning);
        learnScreen.SetActive(learning);

        moveSelector.enabled = false;
        selectedMove.enabled = false;

        forget.SetActive(false);

        pages[1].SetActive(!learning);
        pages[2].SetActive(false);
        pages[3].SetActive(false);
        pages[4].SetActive(learning);
        pages[5].SetActive(false);
        pages[6].SetActive(false);

        updateSelection(pokemonList[currentPosition]);
        if (learning)
        {
            updateMoveToLearn(newMoveString);
        }

        StartCoroutine("animatePokemon");

        bool running       = true;
        int  currentPage   = (learning)? 4 : 1;
        int  checkPosition = currentPosition;

        replacedMove = null;

        yield return(StartCoroutine(ScreenFade.main.Fade(true, ScreenFade.defaultSpeed)));

        if (learning)
        {
            yield return(StartCoroutine(NavigateMoves(pokemonList[currentPosition], true, newMoveString)));
        }
        else
        {
            while (running)
            {
                //cycle through the pages
                if (Input.GetAxisRaw("Horizontal") < 0)
                {
                    if (currentPage > 1)
                    {
                        pages[currentPage - 1].SetActive(true);
                        pages[currentPage].SetActive(false);
                        currentPage -= 1;
                        SfxHandler.Play(scrollClip);
                        yield return(new WaitForSeconds(0.2f));
                    }
                }
                else if (Input.GetAxisRaw("Horizontal") > 0)
                {
                    if (currentPage < 6)
                    {
                        pages[currentPage + 1].SetActive(true);
                        pages[currentPage].SetActive(false);
                        currentPage += 1;
                        SfxHandler.Play(scrollClip);
                        yield return(new WaitForSeconds(0.2f));
                    }
                }
                //cycle through pokemon
                else if (Input.GetAxisRaw("Vertical") > 0)
                {
                    checkPosition = currentPosition;
                    if (checkPosition > 0)
                    {
                        checkPosition -= 1;
                    }
                    while (checkPosition > 0 && pokemonList[checkPosition] == null)
                    {
                        checkPosition -= 1;
                    }
                    if (pokemonList[checkPosition] != null && checkPosition != currentPosition)
                    {
                        currentPosition = checkPosition;
                        updateSelection(pokemonList[checkPosition]);
                        //SfxHandler.Play(scrollClip);
                        yield return(new WaitForSeconds(0.2f));
                    }
                }
                else if (Input.GetAxisRaw("Vertical") < 0)
                {
                    checkPosition = currentPosition;
                    if (checkPosition < pokemonList.Length - 1)
                    {
                        checkPosition += 1;
                    }
                    while (checkPosition < pokemonList.Length - 1 && pokemonList[checkPosition] == null)
                    {
                        checkPosition += 1;
                    }
                    if (pokemonList[checkPosition] != null && checkPosition != currentPosition)
                    {
                        currentPosition = checkPosition;
                        updateSelection(pokemonList[checkPosition]);
                        //SfxHandler.Play(scrollClip);
                        yield return(new WaitForSeconds(0.2f));
                    }
                }
                //rearrange moves/close summary
                else if (Input.GetButton("Select"))
                {
                    if (currentPage == 4)
                    {
                        if (pokemonList[currentPosition].getMoveset()[0] != null)                         //if there are moves to rearrange
                        {
                            SfxHandler.Play(selectClip);
                            yield return(StartCoroutine(NavigateMoves(pokemonList[currentPosition], false, "")));
                        }
                    }
                    else if (currentPage == 6)
                    {
                        running = false;
                    }
                }
                else if (Input.GetButton("Back"))
                {
                    running = false;
                }

                yield return(null);
            }
        }

        yield return(StartCoroutine(ScreenFade.main.Fade(false, ScreenFade.defaultSpeed)));

        this.gameObject.SetActive(false);
    }
    public IEnumerator control()
    {
        yield return(StartCoroutine(ScreenFade.main.Fade(true, 0f)));

        GlobalVariables.global.SetRPCLargeImageKey("main_menu", "Main Menu");
        GlobalVariables.global.SetRPCState("In the Main Menu");
        GlobalVariables.global.UpdatePresence();
        if (!newGame)
        {
            int fileCount = SaveLoad.getSavedGamesCount();
            if (fileCount == 0)
            {
                updateButton(1);
                continueButton.SetActive(false);
                fileDataPanel.SetActive(false);
                for (int i = 1; i < 3; i++)
                {
                    button[i].pixelInset = new Rect(button[i].pixelInset.x, button[i].pixelInset.y + 64f,
                                                    button[i].pixelInset.width, button[i].pixelInset.height);
                    buttonHighlight[i].pixelInset = new Rect(buttonHighlight[i].pixelInset.x,
                                                             buttonHighlight[i].pixelInset.y + 64f, buttonHighlight[i].pixelInset.width,
                                                             buttonHighlight[i].pixelInset.height);
                    buttonText[i].pixelOffset       = new Vector2(buttonText[i].pixelOffset.x, buttonText[i].pixelOffset.y + 64f);
                    buttonTextShadow[i].pixelOffset = new Vector2(buttonTextShadow[i].pixelOffset.x,
                                                                  buttonTextShadow[i].pixelOffset.y + 64f);
                }
            }
            else
            {
                updateButton(0);
                updateFile(0);

                StartCoroutine(animateIcons());

                if (fileCount == 1)
                {
                    fileNumbersText.text = "File     1";
                }
                else if (fileCount == 2)
                {
                    fileNumbersText.text = "File     1   2";
                }
                else if (fileCount == 3)
                {
                    fileNumbersText.text = "File     1   2   3";
                }
            }

            bool running = true;
            while (running)
            {
                if (newGame)
                {
                    running = false;
                }
                if (Input.GetButtonDown("Select"))
                {
                    if (selectedButton == 0)             //CONTINUE
                    {
                        SfxHandler.Play(selectClip);
                        SaveData.currentSave = SaveLoad.savedGames[selectedFile];
                        yield return(StartCoroutine("openAnim"));
                    }
                    else if (selectedButton == 1)        //NEW GAME
                    {
                        SfxHandler.Play(selectClip);
                        yield return(StartCoroutine("openAnimNewGame"));
                    }
                    else if (selectedButton == 2)
                    {
                        //SETTINGS
                        SfxHandler.Play(selectClip);
                        //yield return new WaitForSeconds(sceneTransition.FadeOut(0.4f));
                        yield return(StartCoroutine(ScreenFade.main.Fade(false, 0.4f)));

                        Scene.main.Settings.gameObject.SetActive(true);
                        StartCoroutine(Scene.main.Settings.control());
                        while (Scene.main.Settings.gameObject.activeSelf)
                        {
                            yield return(null);
                        }

                        //yield return new WaitForSeconds(sceneTransition.FadeIn(0.4f));
                        yield return(StartCoroutine(ScreenFade.main.Fade(true, 0.4f)));
                    }
                }
                else if (Input.GetKeyDown(KeyCode.Delete))
                {
                    Dialog.drawDialogBox();
                    yield return(Dialog.StartCoroutine("drawText", "Are you sure you want to delete Save #" + (selectedFile + 1) + "?"));

                    Dialog.drawChoiceBoxNo();
                    yield return(new WaitForSeconds(0.2f));

                    yield return(StartCoroutine(Dialog.choiceNavigateNo()));

                    int chosenIndex = Dialog.chosenIndex;
                    if (chosenIndex == 1)
                    {
                        SaveLoad.resetSaveGame(selectedFile);
                        GlobalVariables.global.debug("Save " + (selectedFile + 1) + " was deleted!");
                        Dialog.undrawDialogBox();
                        Dialog.undrawChoiceBox();
                        Dialog.drawDialogBox();
                        yield return(Dialog.StartCoroutine("drawText", "Save #" + (selectedFile + 1) + " was deleted!"));

                        yield return(new WaitForSeconds(2f));

                        yield return(StartCoroutine(ScreenFade.main.Fade(false, 0.4f)));

                        UnityEngine.SceneManagement.SceneManager.LoadScene(UnityEngine.SceneManagement.SceneManager.GetActiveScene().name);
                    }
                    else
                    {
                        Dialog.undrawDialogBox();
                        Dialog.undrawChoiceBox();
                    }
                }
                else
                {
                    if (Input.GetAxisRaw("Vertical") > 0)
                    {
                        float minimumButton = (continueButton.activeSelf) ? 0 : 1;
                        if (selectedButton > minimumButton)
                        {
                            updateButton(selectedButton - 1);
                            SfxHandler.Play(selectClip);
                            yield return(new WaitForSeconds(0.2f));
                        }
                    }
                    else if (Input.GetAxisRaw("Vertical") < 0)
                    {
                        if (selectedButton < 2)
                        {
                            updateButton(selectedButton + 1);
                            SfxHandler.Play(selectClip);
                            yield return(new WaitForSeconds(0.2f));
                        }
                    }
                    if (Input.GetAxisRaw("Horizontal") > 0)
                    {
                        if (selectedButton == 0)
                        {
                            if (selectedFile < fileCount - 1)
                            {
                                updateFile(selectedFile + 1);
                                SfxHandler.Play(selectClip);
                                yield return(new WaitForSeconds(0.2f));
                            }
                        }
                    }
                    else if (Input.GetAxisRaw("Horizontal") < 0)
                    {
                        if (selectedButton == 0)
                        {
                            if (selectedFile > 0)
                            {
                                updateFile(selectedFile - 1);
                                SfxHandler.Play(selectClip);
                                yield return(new WaitForSeconds(0.2f));
                            }
                        }
                    }
                }


                yield return(null);
            }
        }
    }
    //When the textBox should display flavour text for each choice.
    public IEnumerator choiceNavigate(string[] choices, string[] flavour)
    {
        chosenIndex = choices.Length - 1; //0 is the vertically lowest choice
        bool selected = false;

        while (!selected)
        {
            if (Input.GetButtonDown("Select"))
            {
                selected = true;
            }
            else if (Input.GetButtonDown("Back"))
            {
                while (chosenIndex > 0)
                {
                    chosenIndex -= 1;
                    ChoiceBoxSelect.pixelInset = new Rect(ChoiceBoxSelect.pixelInset.x,
                                                          ChoiceBoxSelect.pixelInset.y - 14f, ChoiceBoxSelect.pixelInset.width,
                                                          ChoiceBoxSelect.pixelInset.height);
                }
                drawDialogBox();
                drawTextInstant(flavour[flavour.Length - 1 - chosenIndex]);
                SfxHandler.Play(selectClip);
                yield return(new WaitForSeconds(0.2f));

                selected = true;
            }
            else
            {
                if (chosenIndex < choices.Length - 1)
                {
                    if (Input.GetAxisRaw("Vertical") > 0)
                    {
                        chosenIndex += 1;
                        ChoiceBoxSelect.pixelInset = new Rect(ChoiceBoxSelect.pixelInset.x,
                                                              ChoiceBoxSelect.pixelInset.y + 14f, ChoiceBoxSelect.pixelInset.width,
                                                              ChoiceBoxSelect.pixelInset.height);
                        SfxHandler.Play(selectClip);
                        drawDialogBox();
                        drawTextInstant(flavour[flavour.Length - 1 - chosenIndex]);
                        yield return(new WaitForSeconds(0.2f));
                    }
                }
                if (chosenIndex > 0)
                {
                    if (Input.GetAxisRaw("Vertical") < 0)
                    {
                        chosenIndex -= 1;
                        ChoiceBoxSelect.pixelInset = new Rect(ChoiceBoxSelect.pixelInset.x,
                                                              ChoiceBoxSelect.pixelInset.y - 14f, ChoiceBoxSelect.pixelInset.width,
                                                              ChoiceBoxSelect.pixelInset.height);
                        SfxHandler.Play(selectClip);
                        drawDialogBox();
                        drawTextInstant(flavour[flavour.Length - 1 - chosenIndex]);
                        yield return(new WaitForSeconds(0.2f));
                    }
                }
            }
            yield return(null);
        }
    }
Exemplo n.º 21
0
 private void PlayCry(Pokemon pokemon)
 {
     SfxHandler.Play(pokemon.GetCry(), pokemon.GetCryPitch());
 }
Exemplo n.º 22
0
 private void TriggerCues(SfxHandler cueHandler, int cuesID)
 {
     if (cueHandler)
         cueHandler.HandleFx(cuesID);
 }
Exemplo n.º 23
0
 public void EvolveToEndlessFX(int fxID, uint start)
 {
     m_fxID  = fxID;
     handler = gameObject.AddComponent <SfxHandler>();
     TimerHeap.AddTimer(start, 0, () => { handler.HandleFx(m_fxID, m_transform); });
 }
Exemplo n.º 24
0
    private SfxHandler sfxScript;       //mark code

    void Start()
    {
        //markcode: set the sfxScript varialbe to the SfxHandler script attached to the game controller
        this.sfxScript = (SfxHandler)GameObject.FindGameObjectWithTag("GameController").GetComponent(typeof(SfxHandler));
    }
Exemplo n.º 25
0
    public IEnumerator interact()
    {
        if (PlayerMovement.player.setCheckBusyWith(this.gameObject))
        {
            for (int i = 0; i < 6; i++)
            {
                pokeBalls[i].enabled = false;
            }

            Dialog.drawDialogBox();
            yield return(StartCoroutine(Dialog.drawText("Hello, and welcome to \nthe Pokémon Center.")));

            while (!Input.GetButtonDown("Select") && !Input.GetButtonDown("Back"))
            {
                yield return(null);
            }
            Dialog.drawDialogBox();
            yield return(StartCoroutine(Dialog.drawText("We restore your tired Pokémon \nto full health.")));

            while (!Input.GetButtonDown("Select") && !Input.GetButtonDown("Back"))
            {
                yield return(null);
            }
            Dialog.drawDialogBox();
            yield return(StartCoroutine(Dialog.drawText("Would you like to rest your Pokémon?")));

            Dialog.drawChoiceBox();
            yield return(StartCoroutine(Dialog.choiceNavigate()));

            int chosenIndex = Dialog.chosenIndex;
            Dialog.undrawChoiceBox();

            if (chosenIndex == 1)
            {
                Dialog.drawDialogBox();
                yield return(StartCoroutine(Dialog.drawText("Okay, I'll take your Pokémon for \na few seconds.")));

                yield return(new WaitForSeconds(0.1f));

                StartCoroutine(PlayerMovement.player.followerScript.withdrawToBall());
                yield return(new WaitForSeconds(0.5f));

                nurse.setDirection(3);

                yield return(new WaitForSeconds(0.2f));

                //place balls on machine, healing as they get shown
                for (int i = 0; i < 6; i++)
                {
                    if (SaveData.currentSave.PC.boxes[0][i] != null)
                    {
                        SaveData.currentSave.PC.boxes[0][i].healFull();
                        pokeBalls[i].enabled = true;
                        SfxHandler.Play(ballPlaceClip);
                        yield return(new WaitForSeconds(0.45f));
                    }
                }
                yield return(new WaitForSeconds(0.25f));

                BgmHandler.main.PlayMFX(healMFX);
                //animate the balls to glow 4 times
                for (int r = 0; r < 4; r++)
                {
                    StartCoroutine(flashScreen(0.45f));
                    for (int i = 0; i < 5; i++)
                    {
                        for (int i2 = 0; i2 < 6; i2++)
                        {
                            pokeBalls[i2].sprite = ballHealSprites[i];
                        }
                        yield return(new WaitForSeconds(0.09f));
                    }
                }

                //reset the ball sprites
                for (int i = 0; i < 6; i++)
                {
                    pokeBalls[i].sprite = ballHealSprites[0];
                }
                yield return(new WaitForSeconds(1f));

                //remove the balls from the machine
                for (int i = 0; i < 6; i++)
                {
                    pokeBalls[i].enabled = false;
                }

                yield return(new WaitForSeconds(0.2f));

                nurse.setDirection(2);

                Dialog.drawDialogBox();
                yield return(StartCoroutine(Dialog.drawText("Thank you for waiting.")));

                while (!Input.GetButtonDown("Select") && !Input.GetButtonDown("Back"))
                {
                    yield return(null);
                }
                Dialog.drawDialogBox();
                yield return(StartCoroutine(Dialog.drawText("We've restored your Pokémon \nto full health.")));

                while (!Input.GetButtonDown("Select") && !Input.GetButtonDown("Back"))
                {
                    yield return(null);
                }

                PlayerMovement.player.followerScript.canMove = true;
            }

            Dialog.drawDialogBox();
            yield return(StartCoroutine(Dialog.drawText("We hope to see you again!")));

            while (!Input.GetButtonDown("Select") && !Input.GetButtonDown("Back"))
            {
                yield return(null);
            }

            Dialog.undrawDialogBox();

            PlayerMovement.player.unsetCheckBusyWith(this.gameObject);
        }
    }
Exemplo n.º 26
0
    public IEnumerator control()
    {
        cursorPosition = Vector2.zero;
        boxNum         = 0;
        updateBox((int)boxNum);
        StartCoroutine(ScreenFade.main.Fade(true, ScreenFade.defaultSpeed));
        bool running = true;

        while (running)
        {
            // Input


            if (cursorPosition.y == -1 && screen2 != true)
            {
                if (Input.GetAxis("Horizontal") > 0 && boxNum != 18)
                {
                    boxNum += 1;
                    updateBox((int)boxNum);
                    SfxHandler.Play(selectClip);
                    yield return(new WaitForSeconds(0.2f));
                }
                else if (Input.GetAxis("Horizontal") < 0 && boxNum != 0)
                {
                    boxNum -= 1;
                    updateBox((int)boxNum);
                    SfxHandler.Play(selectClip);
                    yield return(new WaitForSeconds(0.2f));
                }
            }
            else
            {
                if (Input.GetAxis("Horizontal") > 0 && cursorPosition.x != 8 && cursorPosition.y != -1 && cursorPosition.y != 6 && screen2 != true)
                {
                    cursorPosition += new Vector2(1, 0);
                    SfxHandler.Play(selectClip);
                    yield return(new WaitForSeconds(0.2f));
                }
                else if (Input.GetAxis("Horizontal") < 0 && cursorPosition.x != 0 && cursorPosition.y != -1 && cursorPosition.y != 6 && screen2 != true)
                {
                    cursorPosition -= new Vector2(1, 0);
                    SfxHandler.Play(selectClip);
                    yield return(new WaitForSeconds(0.2f));
                }

                if (Input.GetButton("Select"))
                {
                    yield return(StartCoroutine(informationScreen()));
                }
            }

            if (Input.GetAxis("Vertical") > 0 && cursorPosition.y != -1 && screen2 != true)
            {
                cursorPosition -= new Vector2(0, 1);
                SfxHandler.Play(selectClip);
                yield return(new WaitForSeconds(0.2f));
            }
            else if (Input.GetAxis("Vertical") < 0 && cursorPosition.y != 5 && screen2 != true)
            {
                cursorPosition += new Vector2(0, 1);
                SfxHandler.Play(selectClip);
                yield return(new WaitForSeconds(0.2f));
            }

            // Cursor Position
            if (screen2 != true)
            {
                if (cursorPosition.y == -1)
                {
                    //cursor.transform.position = new Vector3(200, 307, 13);
                }
                else if (cursorPosition.y == 5)
                {
                }
                else
                {
                    float y = 5f - cursorPosition.y;
                    float x = cursorPosition.x;
                    //cursor.transform.position = new Vector3(64 + x * 42f, 128 - 38 + y * 38, 13);
                    yield return(StartCoroutine(moveCursor(new Vector2(25 + x * 24, 25 + y * 24))));

                    y          = cursorPosition.y;
                    pokemonNum = boxNum * 45f + y * 9f + x + 1;
                    updatePreview((int)pokemonNum, (int)(y * 9 + x));
                }
            }



            yield return(null);
        }

        StopCoroutine("animateIcons");
        //yield return new WaitForSeconds(sceneTransition.FadeOut());
        yield return(StartCoroutine(ScreenFade.main.Fade(false, ScreenFade.defaultSpeed)));

        GlobalVariables.global.resetFollower();
        this.gameObject.SetActive(false);
    }
Exemplo n.º 27
0
    public IEnumerator control()
    {
        //sceneTransition.FadeIn();
        StartCoroutine(ScreenFade.main.Fade(true, ScreenFade.defaultSpeed));

        running = true;
        loadSettings();
        int[] originalIndexes = new int[]
        {
            selectedOptionIndex[0],
            selectedOptionIndex[1],
            selectedOptionIndex[2],
            selectedOptionIndex[3],
            selectedOptionIndex[4],
            selectedOptionIndex[5],
            selectedOptionIndex[6],
            selectedOptionIndex[7]
        };
        //	float originalMVol = PlayerPrefs.GetFloat("musicVolume");
//		float originalSVol = PlayerPrefs.GetFloat("sfxVolume");
        selectedOption       = 0;
        selectRow.pixelInset = new Rect(51, 144, selectRow.pixelInset.width, selectRow.pixelInset.height);
        drawDialogBox();
        drawTextInstant(selectedOptionText[0]);
        while (running)
        {
            if (Input.GetAxisRaw("Vertical") > 0)
            {
                if (selectedOption > 0)
                {
                    selectedOption -= 1;
                    drawDialogBox();
                    if (selectedOption == 0)
                    {
                        StartCoroutine("drawText", selectedOptionText[selectedOption]);
                    }
                    else
                    {
                        drawTextInstant(selectedOptionText[selectedOption]);
                    }
                    SfxHandler.Play(selectClip);
                    yield return(StartCoroutine("moveSelection", 1));
                }
            }
            else if (Input.GetAxisRaw("Vertical") < 0)
            {
                if (selectedOption < 7)
                {
                    selectedOption += 1;
                    StopCoroutine("drawText");
                    drawDialogBox();
                    drawTextInstant(selectedOptionText[selectedOption]);
                    SfxHandler.Play(selectClip);
                    yield return(StartCoroutine("moveSelection", -1));
                }
            }
            else if (Input.GetAxisRaw("Horizontal") > 0)
            {
                if (selectedOption == 1)
                {
                    if (selectedOptionIndex[selectedOption] < selectedOptionSize[selectedOption] - 1)
                    {
                        selectedOptionIndex[selectedOption] += 1;
                        updateOption();
                        yield return(new WaitForSeconds(0.05f));
                    }
                }
                else if (selectedOption == 2)
                {
                    if (selectedOptionIndex[selectedOption] < selectedOptionSize[selectedOption] - 1)
                    {
                        selectedOptionIndex[selectedOption] += 1;
                        updateOption();
                        SfxHandler.Play(selectClip);
                        yield return(new WaitForSeconds(0.05f));
                    }
                }
                else if (selectedOption == 3)
                {
                    selectedOptionIndex[selectedOption] += 1;
                    SfxHandler.Play(selectClip);
                    if (selectedOptionIndex[selectedOption] > selectedOptionSize[selectedOption] - 1)
                    {
                        selectedOptionIndex[selectedOption] = 0;
                    }
                    updateOption();
                    yield return(new WaitForSeconds(0.2f));
                }
                else
                {
                    if (selectedOptionIndex[selectedOption] < selectedOptionSize[selectedOption] - 1)
                    {
                        selectedOptionIndex[selectedOption] += 1;
                        SfxHandler.Play(selectClip);
                        updateOption();
                        if (selectedOption == 0)
                        {
                            StopCoroutine("drawText");
                            drawDialogBox();
                            StartCoroutine("drawText", selectedOptionText[selectedOption]);
                        }
                        yield return(new WaitForSeconds(0.2f));
                    }
                }
            }
            else if (Input.GetAxisRaw("Horizontal") < 0)
            {
                if (selectedOption == 1)
                {
                    if (selectedOptionIndex[selectedOption] > 0)
                    {
                        selectedOptionIndex[selectedOption] -= 1;
                        updateOption();
                        yield return(new WaitForSeconds(0.05f));
                    }
                }
                else if (selectedOption == 2)
                {
                    if (selectedOptionIndex[selectedOption] > 0)
                    {
                        selectedOptionIndex[selectedOption] -= 1;
                        updateOption();
                        SfxHandler.Play(selectClip);
                        yield return(new WaitForSeconds(0.05f));
                    }
                }
                else if (selectedOption == 3)
                {
                    selectedOptionIndex[selectedOption] -= 1;
                    SfxHandler.Play(selectClip);
                    if (selectedOptionIndex[selectedOption] < 0)
                    {
                        selectedOptionIndex[selectedOption] = selectedOptionSize[selectedOption] - 1;
                    }
                    updateOption();
                    yield return(new WaitForSeconds(0.2f));
                }
                else
                {
                    if (selectedOptionIndex[selectedOption] > 0)
                    {
                        selectedOptionIndex[selectedOption] -= 1;
                        SfxHandler.Play(selectClip);
                        updateOption();
                        if (selectedOption == 0)
                        {
                            StopCoroutine("drawText");
                            drawDialogBox();
                            StartCoroutine("drawText", selectedOptionText[selectedOption]);
                        }
                        yield return(new WaitForSeconds(0.2f));
                    }
                }
            }
            else if (Input.GetButton("Back"))
            {
                Dialog.drawDialogBox();
                yield return
                    (Dialog.StartCoroutine("drawText", "Would you like to save the currently \\selected settings?"));

                Dialog.drawChoiceBoxNo();
                yield return(new WaitForSeconds(0.2f));

                yield return(StartCoroutine(Dialog.choiceNavigateNo()));

                int chosenIndex = Dialog.chosenIndex;
                if (chosenIndex == 1)
                {
                    saveSettings();
                }
                else
                {
                    //set music and sfx volume back
                    //	PlayerPrefs.SetFloat("musicVolume",originalMVol);
                    //	PlayerPrefs.SetFloat("sfxVolume",originalSVol);
                    //	PlayerPrefs.Save();
                    selectedOptionIndex = originalIndexes;
                    saveSettings();
                    GlobalVariables.global.updateResolution();
                }
                Dialog.undrawDialogBox();
                Dialog.undrawChoiceBox();
                //yield return new WaitForSeconds(sceneTransition.FadeOut());
                yield return(StartCoroutine(ScreenFade.main.Fade(false, ScreenFade.defaultSpeed)));

                running = false;
            }
            yield return(null);
        }
        this.gameObject.SetActive(false);
    }
Exemplo n.º 28
0
    private IEnumerator runEvent(CustomEventTree[] treesArray, int index)
    {
        CustomEventDetails currentEvent = treesArray[eventTreeIndex].events[index];
        CustomEventDetails nextEvent    = null;

        if (index + 1 < treesArray[eventTreeIndex].events.Length)
        {
            //if not the last event
            nextEvent = treesArray[eventTreeIndex].events[index + 1];
        }

        NPCHandler targetNPC = null;

        CustomEventDetails.CustomEventType ty = currentEvent.eventType;

        Debug.Log("Run event. Type: " + ty.ToString());

        switch (ty)
        {
        case (CustomEventDetails.CustomEventType.Wait):
            yield return(new WaitForSeconds(currentEvent.float0));

            break;

        case (CustomEventDetails.CustomEventType.Walk):
            if (currentEvent.object0.GetComponent <NPCHandler>() != null)
            {
                targetNPC = currentEvent.object0.GetComponent <NPCHandler>();

                int initialDirection = targetNPC.direction;
                targetNPC.direction = (int)currentEvent.dir;
                for (int i = 0; i < currentEvent.int0; i++)
                {
                    targetNPC.direction = (int)currentEvent.dir;
                    Vector3 forwardsVector = targetNPC.getForwardsVector(true);
                    if (currentEvent.bool0)
                    {
                        //if direction locked in
                        targetNPC.direction = initialDirection;
                    }
                    while (forwardsVector == new Vector3(0, 0, 0))
                    {
                        targetNPC.direction = (int)currentEvent.dir;
                        forwardsVector      = targetNPC.getForwardsVector(true);
                        if (currentEvent.bool0)
                        {
                            //if direction locked in
                            targetNPC.direction = initialDirection;
                        }
                        yield return(new WaitForSeconds(0.1f));
                    }

                    targetNPC.setOverrideBusy(true);
                    yield return(StartCoroutine(targetNPC.move(forwardsVector, currentEvent.float0)));

                    targetNPC.setOverrideBusy(false);
                }
                targetNPC.setFrameStill();
            }     //Move the player if set to player
            if (currentEvent.object0 == PlayerMovement.player.gameObject)
            {
                int initialDirection = PlayerMovement.player.direction;

                PlayerMovement.player.speed = (currentEvent.float0 > 0)
                        ? PlayerMovement.player.walkSpeed / currentEvent.float0
                        : PlayerMovement.player.walkSpeed;
                for (int i = 0; i < currentEvent.int0; i++)
                {
                    PlayerMovement.player.updateDirection((int)currentEvent.dir);
                    Vector3 forwardsVector = PlayerMovement.player.getForwardVector();
                    if (currentEvent.bool0)
                    {
                        //if direction locked in
                        PlayerMovement.player.updateDirection(initialDirection);
                    }

                    PlayerMovement.player.setOverrideAnimPause(true);
                    yield return
                        (StartCoroutine(PlayerMovement.player.move(forwardsVector, false, currentEvent.bool0)));

                    PlayerMovement.player.setOverrideAnimPause(false);
                }
                PlayerMovement.player.speed = PlayerMovement.player.walkSpeed;
            }
            break;

        case (CustomEventDetails.CustomEventType.TurnTo):
            int   direction;
            float xDistance;
            float zDistance;
            if (currentEvent.object0.GetComponent <NPCHandler>() != null)
            {
                targetNPC = currentEvent.object0.GetComponent <NPCHandler>();
            }
            if (targetNPC != null)
            {
                if (currentEvent.object1 != null)
                {
                    //calculate target objects's position relative to this objects's and set direction accordingly.
                    xDistance = targetNPC.hitBox.position.x - currentEvent.object1.transform.position.x;
                    zDistance = targetNPC.hitBox.position.z - currentEvent.object1.transform.position.z;
                    if (xDistance >= Mathf.Abs(zDistance))
                    {
                        //Mathf.Abs() converts zDistance to a positive always.
                        direction = 3;
                    }     //this allows for better accuracy when checking orientation.
                    else if (xDistance <= Mathf.Abs(zDistance) * -1)
                    {
                        direction = 1;
                    }
                    else if (zDistance >= Mathf.Abs(xDistance))
                    {
                        direction = 2;
                    }
                    else
                    {
                        direction = 0;
                    }
                    targetNPC.setDirection(direction);
                }
                if (currentEvent.int0 != 0)
                {
                    direction = targetNPC.direction + currentEvent.int0;
                    while (direction > 3)
                    {
                        direction -= 4;
                    }
                    while (direction < 0)
                    {
                        direction += 4;
                    }
                    targetNPC.setDirection(direction);
                }
            }
            break;

        case (CustomEventDetails.CustomEventType.Dialog):
            for (int i = 0; i < currentEvent.strings.Length; i++)
            {
                Dialog.drawDialogBox();
                yield return(StartCoroutine(Dialog.drawText(currentEvent.strings[i])));

                if (i < currentEvent.strings.Length - 1)
                {
                    while (!Input.GetButtonDown("Select") && !Input.GetButtonDown("Back"))
                    {
                        yield return(null);
                    }
                }
            }
            if (nextEvent != null)
            {
                if (nextEvent.eventType != CustomEventDetails.CustomEventType.Choice)
                {
                    while (!Input.GetButtonDown("Select") && !Input.GetButtonDown("Back"))
                    {
                        yield return(null);
                    }
                    if (!EventRequiresDialogBox(nextEvent.eventType))
                    {
                        Dialog.undrawDialogBox();
                    }     // do not undraw the box if the next event needs it
                }
            }
            else
            {
                while (!Input.GetButtonDown("Select") && !Input.GetButtonDown("Back"))
                {
                    yield return(null);
                }
                Dialog.undrawDialogBox();
            }
            break;

        case (CustomEventDetails.CustomEventType.Choice):
            if (currentEvent.strings.Length > 1)
            {
                Dialog.drawChoiceBox(currentEvent.strings);
                yield return(StartCoroutine(Dialog.choiceNavigate(currentEvent.strings)));
            }
            else
            {
                Dialog.drawChoiceBox();
                yield return(StartCoroutine(Dialog.choiceNavigate()));
            }
            int chosenIndex = Dialog.chosenIndex;
            chosenIndex = currentEvent.ints.Length - 1 - chosenIndex;     //flip it to reflect the original input
            Dialog.undrawChoiceBox();
            Dialog.undrawDialogBox();
            if (chosenIndex < currentEvent.ints.Length)
            {
                //only change tree if index is valid
                if (currentEvent.ints[chosenIndex] != eventTreeIndex &&
                    currentEvent.ints[chosenIndex] < treesArray.Length)
                {
                    JumpToTree(currentEvent.ints[chosenIndex]);
                }
            }
            break;

        case CustomEventDetails.CustomEventType.Sound:
            SfxHandler.Play(currentEvent.sound);
            break;

        case CustomEventDetails.CustomEventType.ReceiveItem:
            //Play Good for TM, Average for Item
            AudioClip itemGetMFX = (currentEvent.bool0)
                    ? Resources.Load <AudioClip>("Audio/mfx/GetGood")
                    : Resources.Load <AudioClip>("Audio/mfx/GetDecent");
            BgmHandler.main.PlayMFX(itemGetMFX);

            string firstLetter = currentEvent.string0.Substring(0, 1).ToLowerInvariant();
            Dialog.drawDialogBox();
            if (currentEvent.bool0)
            {
                Dialog.StartCoroutine("drawText",
                                      SaveData.currentSave.playerName + " received TM" +
                                      ItemDatabase.getItem(currentEvent.string0).getTMNo() + ": " + currentEvent.string0 + "!");
            }
            else
            {
                if (currentEvent.int0 > 1)
                {
                    Dialog.StartCoroutine("drawText",
                                          SaveData.currentSave.playerName + " received " + currentEvent.string0 + "s!");
                }
                else if (firstLetter == "a" || firstLetter == "e" || firstLetter == "i" || firstLetter == "o" ||
                         firstLetter == "u")
                {
                    Dialog.StartCoroutine("drawText",
                                          SaveData.currentSave.playerName + " received an " + currentEvent.string0 + "!");
                }
                else
                {
                    Dialog.StartCoroutine("drawText",
                                          SaveData.currentSave.playerName + " received a " + currentEvent.string0 + "!");
                }
            }
            yield return(new WaitForSeconds(itemGetMFX.length));

            bool itemAdd = SaveData.currentSave.Bag.addItem(currentEvent.string0, currentEvent.int0);

            Dialog.drawDialogBox();
            if (itemAdd)
            {
                if (currentEvent.bool0)
                {
                    yield return
                        (Dialog.StartCoroutine("drawTextSilent",
                                               SaveData.currentSave.playerName + " put the TM" +
                                               ItemDatabase.getItem(currentEvent.string0).getTMNo() + " \\away into the bag."));
                }
                else
                {
                    if (currentEvent.int0 > 1)
                    {
                        yield return
                            (Dialog.StartCoroutine("drawTextSilent",
                                                   SaveData.currentSave.playerName + " put the " + currentEvent.string0 +
                                                   "s \\away into the bag."));
                    }
                    else
                    {
                        yield return
                            (Dialog.StartCoroutine("drawTextSilent",
                                                   SaveData.currentSave.playerName + " put the " + currentEvent.string0 +
                                                   " \\away into the bag."));
                    }
                }
                while (!Input.GetButtonDown("Select") && !Input.GetButtonDown("Back"))
                {
                    yield return(null);
                }
            }
            else
            {
                yield return(Dialog.StartCoroutine("drawTextSilent", "But there was no room..."));

                while (!Input.GetButtonDown("Select") && !Input.GetButtonDown("Back"))
                {
                    yield return(null);
                }
            }
            Dialog.undrawDialogBox();
            break;

        case CustomEventDetails.CustomEventType.ReceivePokemon:
            if (SaveData.currentSave.PC.hasSpace(0))
            {
                //Play Great for Pokemon
                AudioClip pokeGetMFX = Resources.Load <AudioClip>("Audio/mfx/GetGreat");

                var pkmn = GameController.Instance.PokemonDb.GetPokemonSpeciesByGameId(currentEvent.ints[0].ToString());

                string        pkName   = pkmn.Name;
                PokemonGender pkGender = PokemonGender.CALCULATE;

                if (pkmn.MaleRatio < 0)
                {
                    pkGender = PokemonGender.NONE;
                }
                else if (pkmn.MaleRatio == 0)
                {
                    pkGender = PokemonGender.FEMALE;
                }
                else if (pkmn.MaleRatio == 100)
                {
                    pkGender = PokemonGender.MALE;
                }
                else
                {
                    //if not a set gender
                    if (currentEvent.ints[2] == 0)
                    {
                        pkGender = PokemonGender.MALE;
                    }
                    else if (currentEvent.ints[2] == 1)
                    {
                        pkGender = PokemonGender.FEMALE;
                    }
                }

                Dialog.drawDialogBox();
                yield return
                    (Dialog.StartCoroutine("drawText",
                                           SaveData.currentSave.playerName + " received the " + pkName + "!"));

                BgmHandler.main.PlayMFX(pokeGetMFX);
                yield return(new WaitForSeconds(pokeGetMFX.length));

                string nickname = currentEvent.strings[0];
                if (currentEvent.strings[1].Length == 0)
                {
                    //If no OT set, allow nicknaming of Pokemon

                    Dialog.drawDialogBox();
                    yield return
                        (StartCoroutine(
                             Dialog.drawTextSilent("Would you like to give a nickname to \nthe " + pkName +
                                                   " you received?")));

                    Dialog.drawChoiceBox();
                    yield return(StartCoroutine(Dialog.choiceNavigate()));

                    int nicknameCI = Dialog.chosenIndex;
                    Dialog.undrawDialogBox();
                    Dialog.undrawChoiceBox();

                    if (nicknameCI == 1)
                    {
                        //give nickname
                        //SfxHandler.Play(selectClip);
                        yield return(StartCoroutine(ScreenFade.main.Fade(false, 0.4f)));

                        PKUScene.main.Typing.gameObject.SetActive(true);
                        StartCoroutine(PKUScene.main.Typing.control(10, "", pkGender,
                                                                    OwnedPokemon.GetIconsFromID_(currentEvent.ints[0].ToString(), currentEvent.bool0)));
                        while (PKUScene.main.Typing.gameObject.activeSelf)
                        {
                            yield return(null);
                        }
                        if (PKUScene.main.Typing.typedString.Length > 0)
                        {
                            nickname = PKUScene.main.Typing.typedString;
                        }

                        yield return(StartCoroutine(ScreenFade.main.Fade(true, 0.4f)));
                    }
                }
                if (!EventRequiresDialogBox(nextEvent.eventType))
                {
                    Dialog.undrawDialogBox();
                }

                int[] IVs = new int[]
                {
                    Random.Range(0, 32), Random.Range(0, 32), Random.Range(0, 32),
                    Random.Range(0, 32), Random.Range(0, 32), Random.Range(0, 32)
                };
                if (currentEvent.bool1)
                {
                    //if using Custom IVs
                    IVs[0] = currentEvent.ints[5];
                    IVs[1] = currentEvent.ints[6];
                    IVs[2] = currentEvent.ints[7];
                    IVs[3] = currentEvent.ints[8];
                    IVs[4] = currentEvent.ints[9];
                    IVs[5] = currentEvent.ints[10];
                }

                //PokemonNature pkNature = (currentEvent.ints[3] == 0)
                //    ? PokemonNatureHelper.GetRandomNature()
                //    : (PokemonNature)currentEvent.ints[3] - 1;

                //string[] pkMoveset = pkd.GenerateMoveset(currentEvent.ints[1]);
                //for (int i = 0; i < 4; i++)
                //{
                //    if (currentEvent.strings[4 + i].Length > 0)
                //    {
                //        pkMoveset[i] = currentEvent.strings[4 + i];
                //    }
                //}

                //Debug.Log(pkMoveset[0] + ", " + pkMoveset[1] + ", " + pkMoveset[2] + ", " + pkMoveset[3]);


                //OwnedPokemon pk = new OwnedPokemon(currentEvent.ints[0], nickname, pkGender, currentEvent.ints[1],
                //    currentEvent.bool0, currentEvent.strings[2], currentEvent.strings[3],
                //    currentEvent.strings[1], IVs[0], IVs[1], IVs[2], IVs[3], IVs[4], IVs[5], 0, 0, 0, 0, 0, 0,
                //    pkNature, currentEvent.ints[4],
                //    pkMoveset, new int[4]);

                //SaveData.currentSave.PC.addPokemon(pk);
            }
            else
            {
                //jump to new tree
                JumpToTree(currentEvent.int0);
            }
            break;

        case (CustomEventDetails.CustomEventType.SetActive):
            if (currentEvent.bool0)
            {
                currentEvent.object0.SetActive(true);
            }
            else
            {
                if (currentEvent.object0 == this.gameObject)
                {
                    deactivateOnFinish = true;
                }
                else if (currentEvent.object0 != PlayerMovement.player.gameObject)
                {
                    //important to never deactivate the player
                    currentEvent.object0.SetActive(false);
                }
            }
            break;

        case CustomEventDetails.CustomEventType.SetCVariable:
            SaveData.currentSave.setCVariable(currentEvent.string0, currentEvent.float0);
            break;

        case (CustomEventDetails.CustomEventType.LogicCheck):
            bool passedCheck = false;

            CustomEventDetails.Logic lo = currentEvent.logic;

            switch (lo)
            {
            case CustomEventDetails.Logic.CVariableEquals:
                if (currentEvent.float0 == SaveData.currentSave.getCVariable(currentEvent.string0))
                {
                    passedCheck = true;
                }
                break;

            case CustomEventDetails.Logic.CVariableGreaterThan:
                if (SaveData.currentSave.getCVariable(currentEvent.string0) > currentEvent.float0)
                {
                    passedCheck = true;
                }
                break;

            case CustomEventDetails.Logic.CVariableLessThan:
                if (SaveData.currentSave.getCVariable(currentEvent.string0) < currentEvent.float0)
                {
                    passedCheck = true;
                }
                break;

            case CustomEventDetails.Logic.GymBadgeNoOwned:
                if (Mathf.FloorToInt(currentEvent.float0) < SaveData.currentSave.gymsBeaten.Length &&
                    Mathf.FloorToInt(currentEvent.float0) >= 0)
                {
                    //ensure input number is valid
                    if (SaveData.currentSave.gymsBeaten[Mathf.FloorToInt(currentEvent.float0)])
                    {
                        passedCheck = true;
                    }
                }
                break;

            case CustomEventDetails.Logic.GymBadgesEarned:
                int badgeCount = 0;
                for (int bi = 0; bi < SaveData.currentSave.gymsBeaten.Length; bi++)
                {
                    if (SaveData.currentSave.gymsBeaten[bi])
                    {
                        badgeCount += 1;
                    }
                }
                if (badgeCount >= currentEvent.float0)
                {
                    passedCheck = true;
                }
                break;

            case CustomEventDetails.Logic.PokemonIDIsInParty:
                for (int pi = 0; pi < 6; pi++)
                {
                    if (SaveData.currentSave.PC.boxes[0][pi] != null)
                    {
                        // ToDo: Update this script so it uses the right ID.
                        //if (SaveData.currentSave.PC.boxes[0][pi].getID() ==
                        //    Mathf.FloorToInt(currentEvent.float0))
                        //{
                        //    passedCheck = true;
                        //    pi = 6;
                        //}
                    }
                }
                break;

            case CustomEventDetails.Logic.SpaceInParty:
                if (currentEvent.bool0)
                {
                    if (!SaveData.currentSave.PC.hasSpace(0))
                    {
                        passedCheck = true;
                    }
                }
                else
                {
                    if (SaveData.currentSave.PC.hasSpace(0))
                    {
                        passedCheck = true;
                    }
                }
                break;
            }

            if (passedCheck)
            {
                int newTreeIndex = currentEvent.int0;
                if (newTreeIndex != eventTreeIndex &&     //only change tree if index is valid
                    newTreeIndex < treesArray.Length)
                {
                    JumpToTree(newTreeIndex);
                }
            }
            break;

        case CustomEventDetails.CustomEventType.TrainerBattle:

            //custom cutouts not yet implemented
            StartCoroutine(ScreenFade.main.FadeCutout(false, ScreenFade.slowedSpeed, null));

            //Automatic LoopStart usage not yet implemented
            PKUScene.main.Battle.gameObject.SetActive(true);

            Trainer trainer = currentEvent.object0.GetComponent <Trainer>();

            if (trainer.battleBGM != null)
            {
                Debug.Log(trainer.battleBGM.name);
                BgmHandler.main.PlayOverlay(trainer.battleBGM, trainer.samplesLoopStart);
            }
            else
            {
                BgmHandler.main.PlayOverlay(PKUScene.main.Battle.defaultTrainerBGM,
                                            PKUScene.main.Battle.defaultTrainerBGMLoopStart);
            }
            PKUScene.main.Battle.gameObject.SetActive(false);
            yield return(new WaitForSeconds(1.6f));

            PKUScene.main.Battle.gameObject.SetActive(true);
            StartCoroutine(PKUScene.main.Battle.control(true, trainer, currentEvent.bool0));

            while (PKUScene.main.Battle.gameObject.activeSelf)
            {
                yield return(null);
            }

            //yield return new WaitForSeconds(sceneTransition.FadeIn(0.4f));
            yield return(StartCoroutine(ScreenFade.main.Fade(true, 0.4f)));

            if (currentEvent.bool0)
            {
                if (PKUScene.main.Battle.victor == 1)
                {
                    int newTreeIndex = currentEvent.int0;
                    if (newTreeIndex != eventTreeIndex &&     //only change tree if index is valid
                        newTreeIndex < treesArray.Length)
                    {
                        JumpToTree(newTreeIndex);
                    }
                }
            }

            break;
        }
    }
Exemplo n.º 29
0
    public IEnumerator control(Pokemon pokemonToEvolve, string methodOfEvolution)
    {
        selectedPokemon = pokemonToEvolve;
        evolutionMethod = methodOfEvolution;
        evolutionID     = selectedPokemon.getEvolutionID(evolutionMethod);
        string selectedPokemonName = selectedPokemon.getName();

        pokemonSpriteAnimation   = selectedPokemon.GetFrontAnim_();
        evolutionSpriteAnimation = Pokemon.GetFrontAnimFromID_(evolutionID, selectedPokemon.getGender(),
                                                               selectedPokemon.getIsShiny());
        pokemonSprite.sprite   = pokemonSpriteAnimation[0];
        evolutionSprite.sprite = evolutionSpriteAnimation[0];
        StartCoroutine(animatePokemon());

        pokemonSprite.rectTransform.sizeDelta   = new Vector2(128, 128);
        evolutionSprite.rectTransform.sizeDelta = new Vector2(0, 0);

        pokemonSprite.color   = new Color(0.5f, 0.5f, 0.5f, 0.5f);
        evolutionSprite.color = new Color(0.5f, 0.5f, 0.5f, 0.5f);

        topBorder.rectTransform.sizeDelta    = new Vector2(342, 0);
        bottomBorder.rectTransform.sizeDelta = new Vector2(342, 0);

        glow.rectTransform.sizeDelta = new Vector2(0, 0);

        stopAnimations = false;


        StartCoroutine(ScreenFade.main.Fade(true, 1f));
        yield return(new WaitForSeconds(1f));

        dialog.DrawDialogBox();
        yield return(StartCoroutine(dialog.DrawText("What?")));

        while (!Input.GetButtonDown("Select") && !Input.GetButtonDown("Back"))
        {
            yield return(null);
        }
        yield return(StartCoroutine(dialog.DrawText("\n" + selectedPokemon.getName() + " is evolving!")));

        while (!Input.GetButtonDown("Select") && !Input.GetButtonDown("Back"))
        {
            yield return(null);
        }

        dialog.UndrawDialogBox();
        evolving = true;

        AudioClip cry = selectedPokemon.GetCry();

        SfxHandler.Play(cry);
        yield return(new WaitForSeconds(cry.length));

        BgmHandler.main.PlayOverlay(evolutionBGM, 753100);
        yield return(new WaitForSeconds(0.4f));

        c_animateEvolution = StartCoroutine(animateEvolution());
        SfxHandler.Play(evolvingClip);

        yield return(new WaitForSeconds(0.4f));

        while (evolving)
        {
            if (Input.GetButtonDown("Back"))
            {
                evolving = false;

                //fadeTime = sceneTransition.FadeOut();
                //yield return new WaitForSeconds(fadeTime);
                yield return(StartCoroutine(ScreenFade.main.Fade(false, ScreenFade.defaultSpeed)));

                stopAnimateEvolution();

                //fadeTime = sceneTransition.FadeIn();
                //yield return new WaitForSeconds(fadeTime);
                yield return(StartCoroutine(ScreenFade.main.Fade(true, ScreenFade.defaultSpeed)));


                dialog.DrawDialogBox();
                yield return(StartCoroutine(dialog.DrawText("Huh?")));

                while (!Input.GetButtonDown("Select") && !Input.GetButtonDown("Back"))
                {
                    yield return(null);
                }
                yield return(StartCoroutine(dialog.DrawText("\n" + selectedPokemon.getName() + " stopped evolving.")));

                while (!Input.GetButtonDown("Select") && !Input.GetButtonDown("Back"))
                {
                    yield return(null);
                }
                dialog.UndrawDialogBox();
            }

            yield return(null);
        }

        if (evolved)
        {
            selectedPokemon.evolve(evolutionMethod);

            yield return(new WaitForSeconds(3.2f));

            cry = selectedPokemon.GetCry();
            BgmHandler.main.PlayMFX(cry);
            yield return(new WaitForSeconds(cry.length));

            AudioClip evoMFX = Resources.Load <AudioClip>("Audio/mfx/GetGreat");
            BgmHandler.main.PlayMFXConsecutive(evoMFX);

            dialog.DrawDialogBox();
            yield return(StartCoroutine(dialog.DrawTextSilent("Congratulations!")));

            yield return(new WaitForSeconds(0.8f));

            StartCoroutine(
                dialog.DrawTextSilent("\nYour " + selectedPokemonName + " evolved into " +
                                      PokemonDatabase.getPokemon(evolutionID).getName() + "!"));

            //wait for MFX to stop
            float extraTime = (evoMFX.length - 0.8f > 0) ? evoMFX.length - 0.8f : 0;
            yield return(new WaitForSeconds(extraTime));

            while (!Input.GetButtonDown("Select") && !Input.GetButtonDown("Back"))
            {
                yield return(null);
            }

            string newMove = selectedPokemon.MoveLearnedAtLevel(selectedPokemon.getLevel());
            if (!string.IsNullOrEmpty(newMove) && !selectedPokemon.HasMove(newMove))
            {
                yield return(StartCoroutine(LearnMove(selectedPokemon, newMove)));
            }

            dialog.UndrawDialogBox();
            bool running = true;
            while (running)
            {
                if (Input.GetButtonDown("Select") || Input.GetButtonDown("Back"))
                {
                    running = false;
                }

                yield return(null);
            }

            yield return(new WaitForSeconds(0.4f));
        }

        StartCoroutine(ScreenFade.main.Fade(false, 1f));
        BgmHandler.main.ResumeMain(1.2f);
        yield return(new WaitForSeconds(1.2f));

        this.gameObject.SetActive(false);
    }
Exemplo n.º 30
0
    public IEnumerator control()
    {
        int fileCount = SaveLoad.getSavedGamesCount();

        //NEW GAME
        #region NEW GAME
        if (fileCount == 0)
        {
            BgmHandler.main.PlayMain(menuBGM, 0);
            newGame = true;
            importantThings.SetActive(true);
            updateButton(1);
            continueButton.SetActive(false);
            fileDataPanel.SetActive(false);
            for (int i = 1; i < 3; i++)
            {
                button[i].pixelInset            = new Rect(button[i].pixelInset.x, button[i].pixelInset.y + 64f, button[i].pixelInset.width, button[i].pixelInset.height);
                buttonHighlight[i].pixelInset   = new Rect(buttonHighlight[i].pixelInset.x, buttonHighlight[i].pixelInset.y + 64f, buttonHighlight[i].pixelInset.width, buttonHighlight[i].pixelInset.height);
                buttonText[i].pixelOffset       = new Vector2(buttonText[i].pixelOffset.x, buttonText[i].pixelOffset.y + 64f);
                buttonTextShadow[i].pixelOffset = new Vector2(buttonTextShadow[i].pixelOffset.x, buttonTextShadow[i].pixelOffset.y + 64f);
            }
            transform.Find("NewGame").gameObject.SetActive(false);
            transform.Find("Settings").gameObject.SetActive(false);
            StartCoroutine("animBG");
            yield return(new WaitForSeconds(2f));

            SaveData.currentSave.startTime = System.DateTime.UtcNow;
            yield return(StartCoroutine(ScreenFade.main.Fade(false, 0.4f)));

            importantThings.SetActive(false);
            transform.Find("OpeningLecture").gameObject.SetActive(true);
            yield return(StartCoroutine(ScreenFade.main.Fade(true, 0f)));

            yield return(StartCoroutine("openAnimNewGame"));
        }
        #endregion
        else
        {
            BgmHandler.main.PlayMain(menuBGM, 0);
            updateButton(0);
            updateFile(0);

            StartCoroutine(animateIcons());

            if (fileCount == 1)
            {
                fileNumbersText.text       = "File     1";
                fileNumbersTextShadow.text = "File     1";
            }
            else if (fileCount == 2)
            {
                fileNumbersText.text       = "File     1   2";
                fileNumbersTextShadow.text = "File     1   2";
            }
            else if (fileCount == 3)
            {
                fileNumbersText.text       = "File     1   2   3";
                fileNumbersTextShadow.text = "File     1   2";
            }
        }

        running = true;
        //bool introup = true;
        StartCoroutine("animBG");

        /*if(introup == true) {
         *      yield return new WaitForSeconds(3.2f);
         *      yield return StartCoroutine(ScreenFade.main.Fade(false, 0.2f));
         *      yield return new WaitForSeconds(0.2f);
         *      yield return StartCoroutine(ScreenFade.main.Fade(true, 0.2f));
         *      yield return new WaitForSeconds(3.2f);
         *      yield return StartCoroutine(ScreenFade.main.Fade(false, 0.2f));
         *      yield return new WaitForSeconds(0.2f);
         *      introBackground.color = new UnityEngine.Color(0.5f,0.5f,0.5f);
         *      yield return StartCoroutine(ScreenFade.main.Fade(true, 0.2f));
         *      yield return new WaitForSeconds(15.5f);
         *      yield return StartCoroutine(ScreenFade.main.Fade(false, 0.2f));
         *      yield return new WaitForSeconds(0.2f);
         *      introup = false;
         *      intro.SetActive(false);
         *      yield return StartCoroutine(ScreenFade.main.Fade(true, 0.2f));
         *      //yield return StartCoroutine(ScreenFade.main.Fade(true, 0.4f));
         * }*/
        while (running)
        {
            if (Input.GetButtonDown("Select"))
            {
                if (selectedButton == 0)                                //CONTINUE
                {
                    SfxHandler.Play(selectClip);
                    yield return(StartCoroutine("openAnim"));
                }
                else if (selectedButton == 1)                   //NEW GAME
                {
                    SfxHandler.Play(selectClip);
                    yield return(StartCoroutine("openAnimNewGame"));
                }
                else if (selectedButton == 2)                   //SETTINGS
                {
                    SfxHandler.Play(selectClip);
                    //yield return new WaitForSeconds(sceneTransition.FadeOut(0.4f));
                    yield return(StartCoroutine(ScreenFade.main.Fade(false, 0.4f)));

                    Scene.main.Settings.gameObject.SetActive(true);
                    StartCoroutine(Scene.main.Settings.control());
                    while (Scene.main.Settings.gameObject.activeSelf)
                    {
                        yield return(null);
                    }

                    //yield return new WaitForSeconds(sceneTransition.FadeIn(0.4f));
                    yield return(StartCoroutine(ScreenFade.main.Fade(true, 0.4f)));
                }
            }

            /*else if(Input.GetKeyDown(KeyCode.Delete)){ //delete save file
             *      SfxHandler.Play(selectClip2);
             *      float time = Time.time;
             *      bool released = false;
             *      Debug.Log("Save "+(selectedFile+1)+" will be deleted! Release 'Delete' key to prevent this!");
             *      while(Time.time < time+4 && !released){
             *              if(Input.GetKeyUp(KeyCode.Delete)){
             *                      released = true;
             *                      SfxHandler.Play(selectClip3);
             *              }
             *              yield return null;}
             *
             *      if(Input.GetKey(KeyCode.Delete) && !released){
             *              SfxHandler.Play(selectClip4);
             *              SaveLoad.resetSaveGame(selectedFile);
             *              Debug.Log("Save "+(selectedFile+1)+" was deleted!");
             *
             *              yield return new WaitForSeconds(1f);
             *
             *              Application.LoadLevel(Application.loadedLevel);
             *      }
             *      else{
             *              Debug.Log("'Delete' key was released!");
             *      }
             * yield return null;
             * }*/
            else if (Input.GetKeyDown(KeyCode.Delete))
            {
                Dialog.drawDialogBox();
                yield return(Dialog.StartCoroutine("drawText", "Are you sure you want to delete Save #" + (selectedFile + 1) + "?"));

                Dialog.drawChoiceBoxNo();
                yield return(new WaitForSeconds(0.2f));

                yield return(StartCoroutine(Dialog.choiceNavigateNo()));

                int chosenIndex = Dialog.chosenIndex;
                if (chosenIndex == 1)
                {
                    SaveLoad.resetSaveGame(selectedFile);
                    Debug.Log("Save " + (selectedFile + 1) + " was deleted!");
                    Dialog.undrawDialogBox();
                    Dialog.undrawChoiceBox();
                    Dialog.drawDialogBox();
                    yield return(Dialog.StartCoroutine("drawText", "Save #" + (selectedFile + 1) + " was deleted!"));

                    yield return(new WaitForSeconds(2f));

                    yield return(StartCoroutine(ScreenFade.main.Fade(false, 0.4f)));

                    UnityEngine.SceneManagement.SceneManager.LoadScene(UnityEngine.SceneManagement.SceneManager.GetActiveScene().name);
                }
                else
                {
                    Dialog.undrawDialogBox();
                    Dialog.undrawChoiceBox();
                }
            }
            else
            {
                if (Input.GetAxisRaw("Vertical") > 0)
                {
                    float minimumButton = (continueButton.activeSelf)? 0 : 1;
                    if (selectedButton > minimumButton)
                    {
                        updateButton(selectedButton - 1);
                        SfxHandler.Play(selectClip);
                        yield return(new WaitForSeconds(0.2f));
                    }
                }
                else if (Input.GetAxisRaw("Vertical") < 0)
                {
                    if (selectedButton < 2)
                    {
                        updateButton(selectedButton + 1);
                        SfxHandler.Play(selectClip);
                        yield return(new WaitForSeconds(0.2f));
                    }
                }
                if (Input.GetAxisRaw("Horizontal") > 0)
                {
                    if (selectedButton == 0)
                    {
                        if (selectedFile < fileCount - 1)
                        {
                            updateFile(selectedFile + 1);
                            SfxHandler.Play(selectClip);
                            yield return(new WaitForSeconds(0.2f));
                        }
                    }
                }
                else if (Input.GetAxisRaw("Horizontal") < 0)
                {
                    if (selectedButton == 0)
                    {
                        if (selectedFile > 0)
                        {
                            updateFile(selectedFile - 1);
                            SfxHandler.Play(selectClip);
                            yield return(new WaitForSeconds(0.2f));
                        }
                    }
                }
            }


            yield return(null);
        }
    }
Exemplo n.º 31
0
 protected virtual void Initialize()
 {
     propertyManager = new PropertyManager();
     //sfxManager = new SfxManager(this);
     sfxHandler = this.gameObject.AddComponent <SfxHandler>();
 }
Exemplo n.º 32
0
 private void CancelRunning()
 {
     SfxHandler.Play(selectClip);
     running = false;
 }
Exemplo n.º 33
0
	void Awake()
	{
		fxList = new Dictionary<string, List<KeyValuePair<int, int>>>();
		handler = gameObject.GetComponent<SfxHandler>();
	}
Exemplo n.º 34
0
 private object MakeSoundAndWait()
 {
     SfxHandler.Play(selectClip);
     return(new WaitForSeconds(0.2f));
 }
Exemplo n.º 35
0
    public IEnumerator control()
    {
        //sceneTransition.FadeIn();
        StartCoroutine(ScreenFade.main.Fade(true, ScreenFade.defaultSpeed));

        running         = true;
        switching       = false;
        swapPosition    = -1;
        currentPosition = 0;
        SaveData.currentSave.PC.packParty();
        updateParty();
        updateFrames();
        Dialog.drawDialogBox();
        Dialog.drawTextInstant("Choose a Pokémon.");
        StartCoroutine("animateIcons");
        while (running)
        {
            if (Input.GetAxisRaw("Horizontal") > 0)
            {
                if (currentPosition < 6)
                {
                    shiftPosition(1);
                    SfxHandler.Play(selectClip);
                    yield return(new WaitForSeconds(0.2f));
                }
            }
            else if (Input.GetAxisRaw("Horizontal") < 0)
            {
                if (currentPosition > 0)
                {
                    shiftPosition(-1);
                    SfxHandler.Play(selectClip);
                    yield return(new WaitForSeconds(0.2f));
                }
            }
            else if (Input.GetAxisRaw("Vertical") > 0)
            {
                if (currentPosition > 0)
                {
                    if (currentPosition == 6)
                    {
                        shiftPosition(-1);
                    }
                    else
                    {
                        shiftPosition(-2);
                    }
                    SfxHandler.Play(selectClip);
                    yield return(new WaitForSeconds(0.2f));
                }
            }
            else if (Input.GetAxisRaw("Vertical") < 0)
            {
                if (currentPosition < 6)
                {
                    shiftPosition(2);
                    SfxHandler.Play(selectClip);
                    yield return(new WaitForSeconds(0.2f));
                }
            }
            else if (Input.GetButton("Select"))
            {
                if (currentPosition == 6)
                {
                    if (switching)
                    {
                        switching    = false;
                        swapPosition = -1;
                        updateFrames();
                        Dialog.undrawChoiceBox();
                        Dialog.drawDialogBox();
                        Dialog.drawTextInstant("Choose a Pokémon.");
                        yield return(new WaitForSeconds(0.2f));
                    }
                    else
                    {
                        SfxHandler.Play(selectClip);
                        running = false;
                    }
                }
                else if (switching)
                {
                    if (currentPosition == swapPosition)
                    {
                        switching    = false;
                        swapPosition = -1;
                        updateFrames();
                        Dialog.undrawChoiceBox();
                        Dialog.drawDialogBox();
                        Dialog.drawTextInstant("Choose a Pokémon.");
                        yield return(new WaitForSeconds(0.2f));
                    }
                    else
                    {
                        yield return(StartCoroutine(switchPokemon(swapPosition, currentPosition)));

                        switching    = false;
                        swapPosition = -1;
                        updateFrames();
                        Dialog.undrawChoiceBox();
                        Dialog.drawDialogBox();
                        Dialog.drawTextInstant("Choose a Pokémon.");
                        yield return(new WaitForSeconds(0.2f));
                    }
                }
                else
                {
                    Pokemon selectedPokemon = SaveData.currentSave.PC.boxes[0][currentPosition];
                    int     chosenIndex     = -1;
                    while (chosenIndex != 0)
                    {
                        string[] choices = new string[]
                        {
                            "Summary", "Switch", "Item", "Cancel"
                        };
                        chosenIndex = -1;

                        SfxHandler.Play(selectClip);

                        Dialog.drawDialogBox();
                        Dialog.drawTextInstant("Do what with " + selectedPokemon.getName() + "?");
                        Dialog.drawChoiceBox(choices);
                        yield return(new WaitForSeconds(0.2f));

                        yield return(StartCoroutine(Dialog.choiceNavigate(choices)));

                        chosenIndex = Dialog.chosenIndex;
                        if (chosenIndex == 3)
                        {
                            //Summary
                            SfxHandler.Play(selectClip);
                            //yield return new WaitForSeconds(sceneTransition.FadeOut(0.4f));
                            yield return(StartCoroutine(ScreenFade.main.Fade(false, 0.4f)));

                            //Set SceneSummary to be active so that it appears
                            Scene.main.Summary.gameObject.SetActive(true);
                            StartCoroutine(Scene.main.Summary.control(SaveData.currentSave.PC.boxes[0], currentPosition));
                            //Start an empty loop that will only stop when SceneSummary is no longer active (is closed)
                            while (Scene.main.Summary.gameObject.activeSelf)
                            {
                                yield return(null);
                            }
                            chosenIndex = 0;
                            Dialog.undrawChoiceBox();
                            Dialog.drawDialogBox();
                            Dialog.drawTextInstant("Choose a Pokémon.");
                            //yield return new WaitForSeconds(sceneTransition.FadeIn(0.4f));
                            yield return(StartCoroutine(ScreenFade.main.Fade(true, 0.4f)));
                        }
                        else if (chosenIndex == 2)
                        {
                            //Switch
                            switching    = true;
                            swapPosition = currentPosition;
                            updateFrames();
                            chosenIndex = 0;
                            Dialog.undrawChoiceBox();
                            Dialog.drawDialogBox();
                            Dialog.drawTextInstant("Move " + selectedPokemon.getName() + " to where?");
                            yield return(new WaitForSeconds(0.2f));
                        }
                        else if (chosenIndex == 1)
                        {
                            //Item
                            Dialog.undrawChoiceBox();
                            Dialog.drawDialogBox();
                            if (!string.IsNullOrEmpty(selectedPokemon.getHeldItem()))
                            {
                                yield return
                                    (StartCoroutine(
                                         Dialog.drawText(selectedPokemon.getName() + " is holding " +
                                                         selectedPokemon.getHeldItem() + ".")));

                                choices = new string[]
                                {
                                    "Swap", "Take", "Cancel"
                                };
                                chosenIndex = -1;
                                Dialog.drawChoiceBox(choices);
                                yield return(new WaitForSeconds(0.2f));

                                yield return(StartCoroutine(Dialog.choiceNavigate(choices)));

                                chosenIndex = Dialog.chosenIndex;

                                if (chosenIndex == 2)
                                {
                                    //Swap
                                    SfxHandler.Play(selectClip);
                                    //yield return new WaitForSeconds(sceneTransition.FadeOut(0.4f));
                                    yield return(StartCoroutine(ScreenFade.main.Fade(false, 0.4f)));

                                    Scene.main.Bag.gameObject.SetActive(true);
                                    StartCoroutine(Scene.main.Bag.control(false, true));
                                    while (Scene.main.Bag.gameObject.activeSelf)
                                    {
                                        yield return(null);
                                    }

                                    string chosenItem = Scene.main.Bag.chosenItem;

                                    Dialog.undrawChoiceBox();
                                    Dialog.drawDialogBox();
                                    if (string.IsNullOrEmpty(chosenItem))
                                    {
                                        Dialog.drawTextInstant("Choose a Pokémon.");
                                    }
                                    //yield return new WaitForSeconds(sceneTransition.FadeIn(0.4f));
                                    yield return(StartCoroutine(ScreenFade.main.Fade(true, 0.4f)));

                                    if (!string.IsNullOrEmpty(chosenItem))
                                    {
                                        Dialog.drawDialogBox();
                                        yield return
                                            (StartCoroutine(
                                                 Dialog.drawText("Swap " + selectedPokemon.getHeldItem() + " for " +
                                                                 chosenItem + "?")));

                                        Dialog.drawChoiceBox();
                                        yield return(StartCoroutine(Dialog.choiceNavigate()));

                                        chosenIndex = Dialog.chosenIndex;
                                        Dialog.undrawChoiceBox();

                                        if (chosenIndex == 1)
                                        {
                                            string receivedItem = selectedPokemon.swapHeldItem(chosenItem);
                                            SaveData.currentSave.Bag.addItem(receivedItem, 1);
                                            SaveData.currentSave.Bag.removeItem(chosenItem, 1);

                                            Dialog.drawDialogBox();
                                            yield return
                                                (Dialog.StartCoroutine("drawText",
                                                                       "Gave " + chosenItem + " to " + selectedPokemon.getName() + ","));

                                            while (!Input.GetButtonDown("Select") && !Input.GetButtonDown("Back"))
                                            {
                                                yield return(null);
                                            }
                                            Dialog.drawDialogBox();
                                            yield return
                                                (Dialog.StartCoroutine("drawText",
                                                                       "and received " + receivedItem + " in return."));

                                            while (!Input.GetButtonDown("Select") && !Input.GetButtonDown("Back"))
                                            {
                                                yield return(null);
                                            }
                                        }
                                    }
                                }
                                else if (chosenIndex == 1)
                                {
                                    //Take
                                    Dialog.undrawChoiceBox();
                                    string receivedItem = selectedPokemon.swapHeldItem("");
                                    SaveData.currentSave.Bag.addItem(receivedItem, 1);

                                    updateParty();
                                    updateFrames();

                                    Dialog.drawDialogBox();
                                    yield return
                                        (StartCoroutine(
                                             Dialog.drawText("Took " + receivedItem + " from " +
                                                             selectedPokemon.getName() + ".")));

                                    while (!Input.GetButtonDown("Select") && !Input.GetButtonDown("Back"))
                                    {
                                        yield return(null);
                                    }
                                }
                            }
                            else
                            {
                                yield return
                                    (StartCoroutine(
                                         Dialog.drawText(selectedPokemon.getName() + " isn't holding anything.")));

                                choices = new string[]
                                {
                                    "Give", "Cancel"
                                };
                                chosenIndex = -1;
                                Dialog.drawChoiceBox(choices);
                                yield return(new WaitForSeconds(0.2f));

                                yield return(StartCoroutine(Dialog.choiceNavigate(choices)));

                                chosenIndex = Dialog.chosenIndex;

                                if (chosenIndex == 1)
                                {
                                    //Give
                                    SfxHandler.Play(selectClip);
                                    //yield return new WaitForSeconds(sceneTransition.FadeOut(0.4f));
                                    yield return(StartCoroutine(ScreenFade.main.Fade(false, 0.4f)));

                                    Scene.main.Bag.gameObject.SetActive(true);
                                    StartCoroutine(Scene.main.Bag.control(false, true));
                                    while (Scene.main.Bag.gameObject.activeSelf)
                                    {
                                        yield return(null);
                                    }

                                    string chosenItem = Scene.main.Bag.chosenItem;

                                    Dialog.undrawChoiceBox();
                                    Dialog.drawDialogBox();
                                    if (string.IsNullOrEmpty(chosenItem))
                                    {
                                        Dialog.drawTextInstant("Choose a Pokémon.");
                                    }
                                    //yield return new WaitForSeconds(sceneTransition.FadeIn(0.4f));
                                    yield return(StartCoroutine(ScreenFade.main.Fade(true, 0.4f)));

                                    if (!string.IsNullOrEmpty(chosenItem))
                                    {
                                        selectedPokemon.swapHeldItem(chosenItem);
                                        SaveData.currentSave.Bag.removeItem(chosenItem, 1);

                                        updateParty();
                                        updateFrames();

                                        Dialog.drawDialogBox();
                                        yield return
                                            (Dialog.StartCoroutine("drawText",
                                                                   "Gave " + chosenItem + " to " + selectedPokemon.getName() + "."));

                                        while (!Input.GetButtonDown("Select") && !Input.GetButtonDown("Back"))
                                        {
                                            yield return(null);
                                        }
                                    }
                                }
                            }


                            chosenIndex = 0;
                            yield return(new WaitForSeconds(0.2f));
                        }
                    }
                    if (!switching)
                    {
                        Dialog.undrawChoiceBox();
                        Dialog.drawDialogBox();
                        Dialog.drawTextInstant("Choose a Pokémon.");
                    }
                }
            }
            else if (Input.GetButton("Back"))
            {
                if (switching)
                {
                    switching    = false;
                    swapPosition = -1;
                    updateFrames();
                    Dialog.undrawChoiceBox();
                    Dialog.drawDialogBox();
                    Dialog.drawTextInstant("Choose a Pokémon.");
                    yield return(new WaitForSeconds(0.2f));
                }
                else
                {
                    currentPosition = 6;
                    updateFrames();
                    SfxHandler.Play(selectClip);
                    running = false;
                }
            }
            yield return(null);
        }
        StopCoroutine("animateIcons");
        //yield return new WaitForSeconds(sceneTransition.FadeOut());
        yield return(StartCoroutine(ScreenFade.main.Fade(false, ScreenFade.defaultSpeed)));

        GlobalVariables.global.resetFollower();
        this.gameObject.SetActive(false);
    }
Exemplo n.º 36
0
    public IEnumerator control()
    {
        selectedIcon = 0;
        unhideIcons();
        StartCoroutine("updateIcon", selectedIcon);
        SfxHandler.Play(openClip);
        yield return(StartCoroutine("openAnim"));

        running = true;
        while (running)
        {
            if (selectedIcon == 0)
            {
                if (Input.GetAxisRaw("Vertical") > 0)
                {
                    selectedIcon = 2;
                    StartCoroutine("updateIcon", selectedIcon);
                    SfxHandler.Play(selectClip);
                }
                else if (Input.GetAxisRaw("Horizontal") < 0)
                {
                    selectedIcon = 1;
                    StartCoroutine("updateIcon", selectedIcon);
                    SfxHandler.Play(selectClip);
                }
                else if (Input.GetAxisRaw("Vertical") < 0)
                {
                    selectedIcon = 5;
                    StartCoroutine("updateIcon", selectedIcon);
                    SfxHandler.Play(selectClip);
                }
                else if (Input.GetAxisRaw("Horizontal") > 0)
                {
                    selectedIcon = 3;
                    StartCoroutine("updateIcon", selectedIcon);
                    SfxHandler.Play(selectClip);
                }
            }
            else
            {
                if (Input.GetAxisRaw("Vertical") > 0)
                {
                    if (selectedIcon > 3)
                    {
                        selectedIcon -= 3;
                        StartCoroutine("updateIcon", selectedIcon);
                        SfxHandler.Play(selectClip);
                        yield return(new WaitForSeconds(0.2f));
                    }
                }
                else if (Input.GetAxisRaw("Horizontal") > 0)
                {
                    if (selectedIcon != 3 && selectedIcon != 6)
                    {
                        selectedIcon += 1;
                        StartCoroutine("updateIcon", selectedIcon);
                        SfxHandler.Play(selectClip);
                        yield return(new WaitForSeconds(0.2f));
                    }
                }
                else if (Input.GetAxisRaw("Vertical") < 0)
                {
                    if (selectedIcon < 4)
                    {
                        selectedIcon += 3;
                        StartCoroutine("updateIcon", selectedIcon);
                        SfxHandler.Play(selectClip);
                        yield return(new WaitForSeconds(0.2f));
                    }
                }
                else if (Input.GetAxisRaw("Horizontal") < 0)
                {
                    if (selectedIcon != 1 && selectedIcon != 4)
                    {
                        selectedIcon -= 1;
                        StartCoroutine("updateIcon", selectedIcon);
                        SfxHandler.Play(selectClip);
                        yield return(new WaitForSeconds(0.2f));
                    }
                }
                else if (Input.GetButton("Select"))
                {
                    if (selectedIcon == 1)
                    {
                        //Pokedex
                        Debug.Log("Pokédex not yet implemented");
                        yield return(new WaitForSeconds(0.2f));
                    }
                    else if (selectedIcon == 2)
                    {
                        //Party
                        SfxHandler.Play(selectClip);
                        //StartCoroutine(fadeIcons(0.4f));
                        //yield return new WaitForSeconds(sceneTransition.FadeOut(0.4f));
                        yield return(StartCoroutine(ScreenFade.main.Fade(false, 0.4f)));

                        hideIcons();

                        yield return(StartCoroutine(runSceneUntilDeactivated(Scene.main.Party.gameObject)));

                        unhideIcons();
                        //StartCoroutine(unfadeIcons(0.4f));
                        //yield return new WaitForSeconds(sceneTransition.FadeIn(0.4f));
                        yield return(StartCoroutine(ScreenFade.main.Fade(true, 0.4f)));
                    }
                    else if (selectedIcon == 3)
                    {
                        //Bag
                        SfxHandler.Play(selectClip);
                        //StartCoroutine(fadeIcons(0.4f));
                        //yield return new WaitForSeconds(sceneTransition.FadeOut(0.4f));
                        yield return(StartCoroutine(ScreenFade.main.Fade(false, 0.4f)));

                        hideIcons();

                        yield return(StartCoroutine(runSceneUntilDeactivated(Scene.main.Bag.gameObject)));

                        unhideIcons();
                        //StartCoroutine(unfadeIcons(0.4f));
                        //yield return new WaitForSeconds(sceneTransition.FadeIn(0.4f));
                        yield return(StartCoroutine(ScreenFade.main.Fade(true, 0.4f)));
                    }
                    else if (selectedIcon == 4)
                    {
                        //TrainerCard
                        SfxHandler.Play(selectClip);
                        //StartCoroutine(fadeIcons(0.4f));
                        //yield return new WaitForSeconds(sceneTransition.FadeOut(0.4f));
                        yield return(StartCoroutine(ScreenFade.main.Fade(false, 0.4f)));

                        hideIcons();

                        yield return(StartCoroutine(runSceneUntilDeactivated(Scene.main.Trainer.gameObject)));

                        unhideIcons();
                        //StartCoroutine(unfadeIcons(0.4f));
                        //yield return new WaitForSeconds(sceneTransition.FadeIn(0.4f));
                        yield return(StartCoroutine(ScreenFade.main.Fade(true, 0.4f)));
                    }
                    else if (selectedIcon == 5)
                    {
                        //Save
                        saveDataDisplay.gameObject.SetActive(true);
                        saveDataDisplay.texture =
                            Resources.Load <Texture>("Frame/choice" + PlayerPrefs.GetInt("frameStyle"));
                        iconPokedex.hide = true; //hide this icon as it is in the way
                        int badgeTotal = 0;
                        for (int i = 0; i < 12; i++)
                        {
                            if (SaveData.currentSave.gymsBeaten[i])
                            {
                                badgeTotal += 1;
                            }
                        }
                        string playerTime = "" + SaveData.currentSave.playerMinutes;
                        if (playerTime.Length == 1)
                        {
                            playerTime = "0" + playerTime;
                        }
                        playerTime = SaveData.currentSave.playerHours + " : " + playerTime;

                        mapName.text  = PlayerMovement.player.accessedMapSettings.mapName;
                        dataText.text = SaveData.currentSave.playerName + "\n" +
                                        badgeTotal + "\n" +
                                        "0" + "\n" + //pokedex not yet implemented
                                        playerTime;
                        mapNameShadow.text  = mapName.text;
                        dataTextShadow.text = dataText.text;

                        Dialog.drawDialogBox();
                        yield return(StartCoroutine(Dialog.drawText("Would you like to save the game?")));

                        Dialog.drawChoiceBoxNo();
                        yield return(new WaitForSeconds(0.2f));

                        yield return(StartCoroutine(Dialog.choiceNavigateNo()));

                        int chosenIndex = Dialog.chosenIndex;
                        if (chosenIndex == 1)
                        {
                            //update save file
                            Dialog.undrawChoiceBox();
                            Dialog.drawDialogBox();

                            SaveData.currentSave.levelName       = Application.loadedLevelName;
                            SaveData.currentSave.playerPosition  = new SeriV3(PlayerMovement.player.transform.position);
                            SaveData.currentSave.playerDirection = PlayerMovement.player.direction;
                            SaveData.currentSave.mapName         = PlayerMovement.player.accessedMapSettings.mapName;

                            NonResettingHandler.saveDataToGlobal();

                            SaveLoad.Save();

                            yield return
                                (StartCoroutine(Dialog.drawText(SaveData.currentSave.playerName + " saved the game!")));

                            while (!Input.GetButtonDown("Select") && !Input.GetButtonDown("Back"))
                            {
                                yield return(null);
                            }
                        }
                        Dialog.undrawDialogBox();
                        Dialog.undrawChoiceBox();
                        iconPokedex.hide = false;
                        saveDataDisplay.gameObject.SetActive(false);
                        yield return(new WaitForSeconds(0.2f));
                    }
                    else if (selectedIcon == 6)
                    {
                        //Settings
                        SfxHandler.Play(selectClip);
                        //StartCoroutine(fadeIcons(0.4f));
                        //yield return new WaitForSeconds(sceneTransition.FadeOut(0.4f));
                        yield return(StartCoroutine(ScreenFade.main.Fade(false, 0.4f)));

                        hideIcons();

                        yield return(StartCoroutine(runSceneUntilDeactivated(Scene.main.Settings.gameObject)));

                        unhideIcons();
                        //StartCoroutine(unfadeIcons(0.4f));
                        //yield return new WaitForSeconds(sceneTransition.FadeIn(0.4f));
                        yield return(StartCoroutine(ScreenFade.main.Fade(true, 0.4f)));
                    }
                }
            }
            if (Input.GetButton("Start") || Input.GetButton("Back"))
            {
                running = false;
            }

            yield return(null);
        }

        yield return(StartCoroutine("closeAnim"));

        this.gameObject.SetActive(false);
    }
Exemplo n.º 37
0
    private IEnumerator NavigateMoves(Pokemon pokemon, bool learning, string newMoveString)
    {
        learnScreen.SetActive(learning);
        newMove.gameObject.SetActive(learning);
        Vector3 positionMod = (learning)? new Vector3(0, 32) : new Vector3(0, 0);

        moves.localPosition = positionMod;
        if (learning)
        {
            updateMoveToLearn(newMoveString);
        }

        string[] pokeMoveset = pokemon.getMoveset();
        string[] moveset     = new string[] {
            pokeMoveset[0], pokeMoveset[1],
            pokeMoveset[2], pokeMoveset[3],
            newMoveString, newMoveString
        };
        Vector3[] positions = new Vector3[] {
            new Vector3(21, 32), new Vector3(108, 32),
            new Vector3(21, 0), new Vector3(108, 0),
            new Vector3(64, -32), new Vector3(64, -32)
        };

        moveSelector.enabled = true;
        selectedMove.enabled = false;

        bool navigatingMoves    = true;
        bool selectingMove      = false;
        int  currentMoveNumber  = 0;
        int  selectedMoveNumber = -1;

        moveSelector.rectTransform.localPosition = positions[0] + positionMod;
        updateSelectedMove(moveset[currentMoveNumber]);
        yield return(null);

        while (navigatingMoves)
        {
            if (Input.GetAxisRaw("Horizontal") < 0)
            {
                if (currentMoveNumber == 1)
                {
                    currentMoveNumber = 0;
                    updateSelectedMove(moveset[currentMoveNumber]);
                    SfxHandler.Play(scrollClip);
                    yield return(StartCoroutine(moveMoveSelector(positions[currentMoveNumber] + positionMod)));
                }
                else if (currentMoveNumber == 3)
                {
                    if (!string.IsNullOrEmpty(moveset[2]))
                    {
                        currentMoveNumber = 2;
                        updateSelectedMove(moveset[currentMoveNumber]);
                        SfxHandler.Play(scrollClip);
                        yield return(StartCoroutine(moveMoveSelector(positions[currentMoveNumber] + positionMod)));
                    }
                }
                else if (learning)
                {
                    if (currentMoveNumber == 5)
                    {
                        currentMoveNumber = 4;
                    }
                }
            }
            else if (Input.GetAxisRaw("Horizontal") > 0)
            {
                if (currentMoveNumber == 0)
                {
                    if (!string.IsNullOrEmpty(moveset[1]))
                    {
                        currentMoveNumber = 1;
                        updateSelectedMove(moveset[currentMoveNumber]);
                        SfxHandler.Play(scrollClip);
                        yield return(StartCoroutine(moveMoveSelector(positions[currentMoveNumber] + positionMod)));
                    }
                }
                else if (currentMoveNumber == 2)
                {
                    if (!string.IsNullOrEmpty(moveset[3]))
                    {
                        currentMoveNumber = 3;
                        updateSelectedMove(moveset[currentMoveNumber]);
                        SfxHandler.Play(scrollClip);
                        yield return(StartCoroutine(moveMoveSelector(positions[currentMoveNumber] + positionMod)));
                    }
                }
                else if (learning)
                {
                    if (currentMoveNumber == 4)
                    {
                        currentMoveNumber = 5;
                    }
                }
            }
            else if (Input.GetAxisRaw("Vertical") > 0)
            {
                if (currentMoveNumber == 2)
                {
                    currentMoveNumber = 0;
                    updateSelectedMove(moveset[currentMoveNumber]);
                    SfxHandler.Play(scrollClip);
                    yield return(StartCoroutine(moveMoveSelector(positions[currentMoveNumber] + positionMod)));
                }
                else if (currentMoveNumber == 3)
                {
                    if (!string.IsNullOrEmpty(moveset[1]))
                    {
                        currentMoveNumber = 1;
                        updateSelectedMove(moveset[currentMoveNumber]);
                        SfxHandler.Play(scrollClip);
                        yield return(StartCoroutine(moveMoveSelector(positions[currentMoveNumber] + positionMod)));
                    }
                }
                else if (learning)
                {
                    if (currentMoveNumber == 4)
                    {
                        if (!string.IsNullOrEmpty(moveset[2]))
                        {
                            currentMoveNumber = 2;
                        }
                        else
                        {
                            currentMoveNumber = 0;
                        }
                        updateSelectedMove(moveset[currentMoveNumber]);
                        SfxHandler.Play(scrollClip);
                        yield return(StartCoroutine(moveMoveSelector(positions[currentMoveNumber] + positionMod)));
                    }
                    else if (currentMoveNumber == 5)
                    {
                        if (!string.IsNullOrEmpty(moveset[3]))
                        {
                            currentMoveNumber = 3;
                        }
                        else if (!string.IsNullOrEmpty(moveset[1]))
                        {
                            currentMoveNumber = 1;
                        }
                        else
                        {
                            currentMoveNumber = 0;
                        }
                        updateSelectedMove(moveset[currentMoveNumber]);
                        SfxHandler.Play(scrollClip);
                        yield return(StartCoroutine(moveMoveSelector(positions[currentMoveNumber] + positionMod)));
                    }
                }
            }
            else if (Input.GetAxisRaw("Vertical") < 0)
            {
                if (currentMoveNumber == 0)
                {
                    if (!string.IsNullOrEmpty(moveset[2]))
                    {
                        currentMoveNumber = 2;
                        updateSelectedMove(moveset[currentMoveNumber]);
                        SfxHandler.Play(scrollClip);
                        yield return(StartCoroutine(moveMoveSelector(positions[currentMoveNumber] + positionMod)));
                    }
                    else if (learning)
                    {
                        currentMoveNumber = 4;
                        updateSelectedMove(moveset[currentMoveNumber]);
                        SfxHandler.Play(scrollClip);
                        yield return(StartCoroutine(moveMoveSelector(positions[currentMoveNumber] + positionMod)));
                    }
                }
                else if (currentMoveNumber == 1)
                {
                    if (!string.IsNullOrEmpty(moveset[3]))
                    {
                        currentMoveNumber = 3;
                        updateSelectedMove(moveset[currentMoveNumber]);
                        SfxHandler.Play(scrollClip);
                        yield return(StartCoroutine(moveMoveSelector(positions[currentMoveNumber] + positionMod)));
                    }
                    else if (learning)
                    {
                        currentMoveNumber = 5;
                        updateSelectedMove(moveset[currentMoveNumber]);
                        SfxHandler.Play(scrollClip);
                        yield return(StartCoroutine(moveMoveSelector(positions[currentMoveNumber] + positionMod)));
                    }
                }
                else if (learning)
                {
                    if (currentMoveNumber == 2)
                    {
                        currentMoveNumber = 4;
                        updateSelectedMove(moveset[currentMoveNumber]);
                        SfxHandler.Play(scrollClip);
                        yield return(StartCoroutine(moveMoveSelector(positions[currentMoveNumber] + positionMod)));
                    }
                    else if (currentMoveNumber == 3)
                    {
                        currentMoveNumber = 5;
                        updateSelectedMove(moveset[currentMoveNumber]);
                        SfxHandler.Play(scrollClip);
                        yield return(StartCoroutine(moveMoveSelector(positions[currentMoveNumber] + positionMod)));
                    }
                }
            }
            else if (Input.GetButtonDown("Back"))
            {
                if (!learning)
                {
                    if (selectingMove)
                    {
                        selectingMove        = false;
                        selectedMove.enabled = false;
                        yield return(new WaitForSeconds(0.2f));
                    }
                    else
                    {
                        navigatingMoves      = false;
                        moveSelector.enabled = false;
                        updateSelectedMove(null);
                        SfxHandler.Play(returnClip);
                        yield return(new WaitForSeconds(0.2f));
                    }
                }
                else                    //Cancel learning move
                {
                    navigatingMoves = false;
                    SfxHandler.Play(returnClip);
                    yield return(new WaitForSeconds(0.2f));
                }
            }
            else if (Input.GetButtonDown("Select"))
            {
                if (!learning)
                {
                    if (selectingMove)
                    {
                        pokemon.swapMoves(selectedMoveNumber, currentMoveNumber);
                        selectingMove        = false;
                        selectedMove.enabled = false;
                        moveset = pokemon.getMoveset();
                        updateSelectionMoveset(pokemon);
                        updateSelectedMove(moveset[currentMoveNumber]);
                        SfxHandler.Play(selectClip);
                        yield return(new WaitForSeconds(0.2f));
                    }
                    else
                    {
                        selectedMoveNumber = currentMoveNumber;
                        selectingMove      = true;
                        selectedMove.rectTransform.localPosition = positions[currentMoveNumber] + positionMod;
                        selectedMove.enabled = true;
                        SfxHandler.Play(selectClip);
                        yield return(new WaitForSeconds(0.2f));
                    }
                }
                else
                {
                    if (currentMoveNumber < 4)                          //Forget learned move
                    {
                        forget.SetActive(true);
                        selectedMove.enabled = true;
                        selectedMove.rectTransform.localPosition = positions[currentMoveNumber] + positionMod;
                        moveSelector.rectTransform.localPosition = positions[4] + positionMod;
                        SfxHandler.Play(selectClip);
                        yield return(new WaitForSeconds(0.2f));

                        bool forgetPrompt = true;
                        while (forgetPrompt)
                        {
                            if (Input.GetButtonDown("Select"))
                            {
                                replacedMove = moveset[currentMoveNumber];
                                pokemon.replaceMove(currentMoveNumber, newMoveString);

                                forgetPrompt    = false;
                                navigatingMoves = false;
                                SfxHandler.Play(selectClip);
                                yield return(new WaitForSeconds(0.2f));
                            }
                            else if (Input.GetButtonDown("Back"))
                            {
                                forget.SetActive(false);
                                selectedMove.enabled = false;
                                moveSelector.rectTransform.localPosition = positions[currentMoveNumber] + positionMod;

                                forgetPrompt = false;
                                SfxHandler.Play(returnClip);
                                yield return(new WaitForSeconds(0.2f));
                            }
                            yield return(null);
                        }
                    }
                    else                        //Cancel learning move
                    {
                        navigatingMoves = false;
                        SfxHandler.Play(selectClip);
                        yield return(new WaitForSeconds(0.2f));
                    }
                }
            }

            yield return(null);
        }
    }
Exemplo n.º 38
0
        public IEnumerator control()
        {
            setup.carousel.position = 0;
            setSelectedText("Bag");
            SfxHandler.Play(setup.openClip);
            yield return(StartCoroutine(openAnim()));

            state = PauseState.Open; //set elsewhere not just here
            while (state == PauseState.Open)
            {
                if (Input.GetAxisRaw("Horizontal") != 0)
                {
                    SfxHandler.Play(setup.selectClip);
                    yield return(StartCoroutine(updatePosition(Input.GetAxisRaw("Horizontal"))));
                }
                else if (Input.GetButton("Select"))
                {
                    switch (pauseIcons[setup.carousel.selectedPosition].mode)
                    {
                    case ImageMode.RunScene:
                        SfxHandler.Play(setup.selectClip);
                        yield return(StartCoroutine(ScreenFade.main.Fade(false, 0.4f)));

                        yield return(StartCoroutine(runSceneUntilDeactivated(SceneScript.main.CastToScene(pauseIcons[setup.carousel.position].scene))));

                        break;

                    case ImageMode.RunEvent:
                        pauseIcons[setup.carousel.position].activatorEvent.Invoke();
                        break;

                    case ImageMode.Save:
                        setup.saveDataDisplay.gameObject.SetActive(true);
                        setup.saveDataDisplay.sprite =
                            Resources.Load <Sprite>("Frame/choice" + PlayerPrefs.GetInt("frameStyle"));

                        int badgeTotal = 0;
                        for (int i = 0; i < 12; i++)
                        {
                            if (SaveData.currentSave.gymsBeaten[i])
                            {
                                badgeTotal += 1;
                            }
                        }
                        string playerTime = "" + SaveData.currentSave.playerMinutes;
                        if (playerTime.Length == 1)
                        {
                            playerTime = "0" + playerTime;
                        }
                        playerTime = SaveData.currentSave.playerHours + " : " + playerTime;

                        setup.mapName.text  = Player.player.accessedMapSettings.mapName;
                        setup.dataText.text = SaveData.currentSave.playerName + "\n" +
                                              badgeTotal + "\n" +
                                              "0" + "\n" + //pokedex not yet implemented
                                              playerTime;

                        SceneScript.main.Dialog.DrawDialogBox();
                        yield return(StartCoroutine(SceneScript.main.Dialog.DrawText("Would you like to save the game?")));

                        yield return(StartCoroutine(SceneScript.main.Dialog.DrawChoiceBox(0)));

                        int chosenIndex = SceneScript.main.Dialog.chosenIndex;
                        if (chosenIndex == 1)
                        {
                            //update save file
                            SceneScript.main.Dialog.UndrawChoiceBox();
                            SaveData.currentSave.levelName       = SceneManager.GetActiveScene().name;
                            SaveData.currentSave.playerPosition  = new SeriV3(Player.player.transform.position);
                            SaveData.currentSave.playerDirection = (int)Player.player.direction;
                            SaveData.currentSave.mapName         = Player.player.accessedMapSettings.mapName;

                            NonResettingHandler.saveDataToGlobal();

                            SaveLoad.Save();
                            SceneScript.main.Dialog.DrawDialogBox();
                            yield return
                                (StartCoroutine(SceneScript.main.Dialog.DrawText(SaveData.currentSave.playerName + " saved the game!")));

                            while (!Input.GetButtonDown("Select") && !Input.GetButtonDown("Back"))
                            {
                                yield return(null);
                            }
                        }
                        SceneScript.main.Dialog.UnDrawDialogBox();
                        SceneScript.main.Dialog.UndrawChoiceBox();
                        setup.saveDataDisplay.gameObject.SetActive(false);
                        yield return(new WaitForSeconds(0.2f));

                        break;

                    case ImageMode.NotImplemented:
                        SceneScript.main.Dialog.DrawDialogBox();
                        yield return(StartCoroutine(SceneScript.main.Dialog.DrawText("This menu has not yet been implemented.")));

                        while (!Input.GetButtonDown("Select") && !Input.GetButtonDown("Back"))
                        {
                            yield return(null);
                        }
                        SceneScript.main.Dialog.UnDrawDialogBox();
                        yield return(new WaitForSeconds(0.2f));

                        break;
                    }
                }

                if (Input.GetButton("Start") || Input.GetButton("Back"))
                {
                    state = PauseState.Closing;
                }
                yield return(null);
            }
            yield return(StartCoroutine(closeAnim()));

            setup.pauseBottom.gameObject.SetActive(false);
            gameObject.SetActive(false);
        }