Example #1
0
        private IEnumerator EndInteraction()
        {
            player.movementEnabled = false;

            MovableEntity movable = GetComponentInChildren <MovableEntity>();
            var           rb      = movable.GetComponent <Rigidbody2D>();

            rb.bodyType = RigidbodyType2D.Dynamic;
            movable.MoveTo(RpgManager.Player.transform.position);

            yield return(new WaitWhile(() => movable.isMoving));

            character.SetActive(false);

            if (isAltea)
            {
                RpgManager.SetKey(SaveKey.metAltea, 1);
            }
            else
            {
                RpgManager.SetKey(SaveKey.metOrion, 1);
                player.attackEnabled = true;
            }

            RpgManager.SaveGame(isAltea ? "SPA" : "Orion");

            float oldvolume = RpgManager.CurrentStory.GetMusicVolume();

            RpgManager.CurrentStory.SetMusicVolume(0);
            RpgManager.PlaySFX(sfx_jingle);
            bool wait = true;

            player.Talk((isAltea ? "Altea" : "Orion") + " rejoint l'equipe !", () => wait = false);
            yield return(new WaitForSeconds(sfx_jingle.length - 1));

            yield return(new WaitWhile(() => wait));

            gameObject.SetActive(false);

            player.EndTalk();
            RpgManager.CurrentStory.SetMusicVolume(oldvolume);
        }
Example #2
0
        protected override IEnumerator Start()
        {
            yield return(StartCoroutine(base.Start()));

            player.attackEnabled = false;

            if (RpgManager.GetKey(SaveKey.defeatedCerberus) == 0)
            {
                yield return(StartCoroutine(FindMaxime()));
            }
            else if (RpgManager.GetKey(SaveKey.defeatedCerberus) == -1)
            {
                if (playerMovable == null)
                {
                    playerMovable = player.gameObject.GetComponent <MovableEntity>();
                }
                if (playerMovable == null)
                {
                    playerMovable = player.gameObject.AddComponent <MovableEntity>();
                }

                maximeMovable.transform.position = maxPosition;
                alteaMovable.transform.position  = (catsPosition - Vector3.right);
                orionMovable.transform.position  = (catsPosition + Vector3.right);
                luckyMovable.transform.position  = morganePos1 + Vector3.down * 2;
                player.transform.position        = morganePos1;

                player.overrideMovement = true;
                audioSource.clip        = bossMusic;
                audioSource.Play();
                yield return(new WaitForSeconds(1.0f));

                TransitionBattle trbattle = TransitionBattle.Instance;
                trbattle.onClosureFinished = () => { SceneManager.LoadScene("PokemonBattle", LoadSceneMode.Additive); };
                trbattle.StartSpiralCoroutine();
            }
            else if (RpgManager.GetKey(SaveKey.defeatedCerberus) == -2)
            {
                if (playerMovable == null)
                {
                    playerMovable = player.gameObject.GetComponent <MovableEntity>();
                }
                if (playerMovable == null)
                {
                    playerMovable = player.gameObject.AddComponent <MovableEntity>();
                }

                maximeMovable.transform.position = maxPosition;
                alteaMovable.transform.position  = (catsPosition - Vector3.right);
                orionMovable.transform.position  = (catsPosition + Vector3.right);
                luckyMovable.transform.position  = morganePos1 + Vector3.down * 2;
                player.transform.position        = morganePos1;

                player.overrideMovement = true;
                audioSource.Stop();

                yield return(EndPokemonCoroutine());
            }
            else if (RpgManager.GetKey(SaveKey.defeatedCerberus) == 1)
            {
                cerberusMovable.gameObject.SetActive(false);
                alteaMovable.Sleep();
                alteaMovable.Hit();

                StartCoroutine(OrionRoamCoroutine());
            }
        }
Example #3
0
        private IEnumerator FindMaxime()
        {
            entrance.gameObject.SetActive(false);
            player.overrideMovement = true;

            if (playerMovable == null)
            {
                playerMovable = player.gameObject.GetComponent <MovableEntity>();
            }
            if (playerMovable == null)
            {
                playerMovable = player.gameObject.AddComponent <MovableEntity>();
            }

            maximeMovable.transform.position   = maxPosition;
            alteaMovable.transform.position    = startPos;
            orionMovable.transform.position    = startPos;
            cerberusMovable.transform.position = startPos;
            cerberusMovable.gameObject.SetActive(false);
            luckyMovable.transform.position = morganePos1 + Vector3.down * 2;
            luckyMovable.gameObject.SetActive(false);

            playerMovable.LookTowards(Vector3.up);
            alteaMovable.MoveTo(startPos - Vector3.right);
            orionMovable.MoveTo(startPos + Vector3.right);
            yield return(new WaitWhile(() => alteaMovable.isMoving));

            alteaMovable.LookTowards(Vector3.up);
            orionMovable.LookTowards(Vector3.up);
            wait = true;
            player.Talk("Max ?", () => wait = false);
            yield return(new WaitWhile(() => wait));

            player.EndTalk();
            playerMovable.MoveTo(morganePos1, speed_walk);
            yield return(new WaitWhile(() => playerMovable.isMoving));

            wait = true;
            player.Talk("Maxime !", () => wait = false);
            yield return(new WaitWhile(() => wait));

            player.EndTalk();
            playerMovable.MoveTo(morganePos2, speed_run);
            yield return(new WaitUntil(() => playerMovable.isMoving == false));

            RpgManager.Instance.discussionInterface.SetImage(false, maximeSprite);
            counter = 0;
            while (counter < firstDialogue.Count)
            {
                wait = true;
                bool isMorgane = firstDialogue[counter].Split(':')[0] == "Morgane ";
                player.Dialog(isMorgane, firstDialogue[counter], () => wait = false);
                counter++;
                yield return(new WaitWhile(() => wait));
            }

            player.EndTalk();
            alteaMovable.MoveTo(catsPosition - Vector3.right);
            orionMovable.MoveTo(catsPosition + Vector3.right);
            yield return(new WaitWhile(() => alteaMovable.isMoving));

            orionMovable.LookTowards(Vector3.down);
            RpgManager.Instance.discussionInterface.SetImage(false, alteaSprite);
            wait = true;
            player.Dialog(false, talk_altea, () => wait = false);
            yield return(new WaitWhile(() => wait));

            playerMovable.LookTowards(Vector3.down);
            RpgManager.Instance.discussionInterface.SetImage(false, orionSprite);
            wait = true;
            player.Dialog(false, talk_orion, () => wait = false);
            yield return(new WaitWhile(() => wait));

            player.EndTalk();
            audioSource.clip = bossMusic;
            audioSource.Play();
            cerberusMovable.gameObject.SetActive(true);
            cerberusMovable.LookTowards(Vector3.up);
            alteaMovable.LookTowards(Vector3.down);
            playerMovable.MoveTo(morganePos1, speed_walk);
            yield return(new WaitWhile(() => playerMovable.isMoving));

            wait = true;
            player.Dialog(false, talk_orion_dog1, () => wait = false);
            yield return(new WaitWhile(() => wait));

            wait = true;
            player.Dialog(false, talk_orion_dog2, () => wait = false);
            yield return(new WaitWhile(() => wait));

            player.EndTalk();
            wait = true;
            player.Talk(talk_dog, () => wait = false);
            yield return(new WaitWhile(() => wait));

            player.EndTalk();
            cerberusMovable.MoveTo(morganePos1 + Vector3.down, speed_walk);
            yield return(new WaitWhile(() => cerberusMovable.isMoving));

            cerberusMovable.Hit();

            RpgManager.SetKey(SaveKey.defeatedCerberus, -1);

            RpgManager.Instance.gameState = RpgManager.Instance.gameState ^ RpgManager.GameState.Minigame;
            TransitionBattle trbattle = TransitionBattle.Instance;

            trbattle.onClosureFinished = () => { SceneManager.LoadScene("PokemonBattle", LoadSceneMode.Additive); };
            trbattle.StartSpiralCoroutine();
        }