Esempio n. 1
0
    public IEnumerator transitionToNewLevel(string lvlName)
    {
        player.stopFromMoving();
        soundManager.stopAllAudios();
        //Antes de salir cogemos en que estado de conversacion se han quedado
        if (lvlName.Equals("FirstStage"))
        {
            Koke          = GameObject.FindObjectOfType <Koke>();
            Barbara       = GameObject.FindObjectOfType <Barbara>();
            kokePhases    = new int[] { Koke.conversationPhase, Koke.startingPhase, Koke.repeatedPhase, Koke.negationPhase };
            kokeExtinted  = Koke.extinted;
            barbaraPhases = new int[] { Barbara.conversationPhase, Barbara.startingPhase, Barbara.repeatedPhase, Barbara.negationPhase };
            barbExtinted  = Barbara.extinted;
        }
        if (lvlName.Equals("FirstStageHouse"))
        {
            puzzleGen = FindObjectOfType <GeneticManager>().genPhase;
        }
        if (lvlName.Equals("FirstStageFirstTime"))
        {
            lvlName = "FirstStage";
        }
        yield return(new WaitForSeconds(1f));

        loadScreen.SetActive(!loadScreen.activeSelf);
        SceneManager.LoadSceneAsync(lvlName, LoadSceneMode.Single);
        SceneManager.sceneLoaded += findActualNPCs;
        yield return(new WaitForSeconds(3f));

        //Ponemos la musica segun el nivel
        soundManager.playAudioByScene(lvlName);
        loadScreen.SetActive(!loadScreen.activeSelf);
        player.continueMoving();
        yield return(null);
    }
Esempio n. 2
0
    private IEnumerator waitForTaskEndFirstActHouse(Koke npc, Barbara barbnpc)
    {
        //Triggereamos la primera conversación de koke.
        npc.popUpMeeting();
        //Esperamos a que acabe la conversacion
        isTaskPending = true;
        while (isTaskPending)
        {
            yield return(new WaitForSeconds(0.1f));
        }
        //Cuando acabe le cambiamos la fase de conversacion
        npc.conversationPhase += 1;
        npc.extinted           = false;
        //Movemos a Koke y Barbara a sus posiciones
        barbnpc.MoveToTable();
        npc.MoveToBed();
        canActivatePuzzle = true;
        yield return(new WaitForSeconds(3f));

        //Cogemos sus posiciones para la carga.
        kokeHouse = npc.transform.position;
        barbHouse = barbnpc.transform.position;
        //Activamos el menu para la wiki
        GameObject.FindGameObjectWithTag("Movement").transform.Find("MenuButton").gameObject.SetActive(true);
        GameObject.FindGameObjectWithTag("Movement").transform.Find("Life").gameObject.SetActive(true);
        player.continueMoving();
        player.canAttack = true;
        //Termina la conversacion conjunta y ahora para desactivar las puertas de las granjas Olivia tiene que hablar con el Barbara
        yield return(null);
    }
Esempio n. 3
0
    public void kokeFirstActHouse()
    {
        //Congelamos el movimiento del jugador
        player.stopFromMoving();
        Koke    npc     = Koke.GetComponent <Koke>();
        Barbara barbnpc = Barbara.GetComponent <Barbara>();

        StartCoroutine(waitForTaskEndFirstActHouse(npc, barbnpc));
    }
Esempio n. 4
0
 private void Start()
 {
     //Añadimos al inicio del juego la fase en la que se encuentra cada npc, para mostrar las conversaciones pertinentes
     player       = GameObject.FindObjectOfType <Player>();
     Koke         = GameObject.FindObjectOfType <Koke>();
     Barbara      = GameObject.FindObjectOfType <Barbara>();
     loadScreen   = player.transform.Find("LoadScreen").gameObject;
     soundManager = FindObjectOfType <SoundManager>();
     firstTime    = true;
 }
Esempio n. 5
0
    public void genPuzzleFinished()
    {
        GameObject whereToSpawn = GameObject.FindGameObjectWithTag("spawnLocation");

        whereToSpawn.transform.Find("Koke").gameObject.SetActive(true);
        Koke kokenpc = whereToSpawn.transform.Find("Koke").GetComponent <Koke>();

        whereToSpawn.transform.Find("Barbara").gameObject.SetActive(true);
        Barbara barbnpc = whereToSpawn.transform.Find("Barbara").GetComponent <Barbara>();

        StartCoroutine(genPuzzleEvent(kokenpc, barbnpc));
    }
Esempio n. 6
0
    private IEnumerator genPuzzleEvent(Koke kokenpc, Barbara barbnpc)
    {
        player.stopFromMoving();
        kokenpc.conversationPhase = 4;
        yield return(new WaitForSeconds(2));

        kokenpc.MoveToGenerator();
        yield return(new WaitForSeconds(1.5f));

        barbnpc.MoveToGenerator();
        yield return(new WaitForSeconds(1f));

        kokenpc.popUpMeeting();
        isTaskPending = true;
        while (isTaskPending)
        {
            yield return(new WaitForSeconds(0.1f));
        }
        kokenpc.conversationPhase += 1;
        kokenpc.extinted           = false;
        //Metemos a Barbara en casa. Cerramos la puerta, abrimos la del bosque y mandamos a Koke al Bosque. Ponemos las habilidades activas
        GameObject abilities = GameObject.FindGameObjectWithTag("AbilitieManager");

        for (int i = 0; i < abilities.transform.childCount; i++)
        {
            abilities.transform.GetChild(i).gameObject.SetActive(true);
        }
        barbnpc.backToHouse();
        kokenpc.MoveToForest();
        yield return(new WaitForSeconds(3f));

        barbnpc.gameObject.SetActive(false);
        kokenpc.gameObject.SetActive(false);
        GameObject barreras = GameObject.FindGameObjectWithTag("barrerasHolder");

        for (int i = 0; i < barreras.transform.childCount; i++)
        {
            barreras.transform.GetChild(i).gameObject.SetActive(true);
        }
        GameObject.FindGameObjectWithTag("BarreraBosque").SetActive(false);
        player.continueMoving();
        //Cuando acabemos le damos los modulos de generador y compilador
        GameObject generalMenu = player.transform.Find("GeneralMenu").gameObject;
        Button     generator   = generalMenu.transform.Find("BotonGenerador").GetComponent <Button>();

        generator.interactable = true;
        generator.GetComponentInChildren <TextMeshProUGUI>().text = "GENERADOR";
        Button compilador = generalMenu.transform.Find("BotonCompilador").GetComponent <Button>();

        compilador.interactable = true;
        compilador.GetComponentInChildren <TextMeshProUGUI>().text = "COMPILADOR";
    }
Esempio n. 7
0
 private void findActualNPCs(Scene scene, LoadSceneMode mode)
 {
     if (scene.name.Equals("CuteTown"))
     {
         player.transform.Find("VirtualCam").GetComponent <CinemachineConfiner>().InvalidatePathCache();
         player.transform.Find("VirtualCam").GetComponent <CinemachineConfiner>().m_BoundingShape2D = GameObject.FindGameObjectWithTag("Confiner").GetComponent <PolygonCollider2D>();
     }
     if (scene.name.Equals("FirstStage") && firstTime)
     {
         Koke = GameObject.FindObjectOfType <Koke>();
         player.transform.Find("VirtualCam").GetComponent <CinemachineConfiner>().InvalidatePathCache();
         player.transform.Find("VirtualCam").GetComponent <CinemachineConfiner>().m_BoundingShape2D = GameObject.FindGameObjectWithTag("Confiner").GetComponent <PolygonCollider2D>();
     }
     //Con esto mantenemos el estado de la escena abierta
     if (canActivatePuzzle && scene.name.Equals("FirstStage") && !firstTime)
     {
         //Reactivamos los colisionadores para los pilares
         Debug.Log("Conseguimos los pilares");
         PilarMatrix[] pilars = FindObjectsOfType <PilarMatrix>();
         for (int i = 0; i < pilars.Length; i++)
         {
             pilars[i].reactivateCollider();
         }
         //Activamos el collider para el generador
         BoxCollider2D genManagerCollider = FindObjectOfType <GeneticManager>().gameObject.GetComponent <BoxCollider2D>();
         genManagerCollider.enabled = true;
         GameObject[] barrerasGranja = GameObject.FindGameObjectsWithTag("barreraGranja");
         for (int i = 0; i < barrerasGranja.Length; i++)
         {
             barrerasGranja[i].SetActive(!barrerasGranja[i].gameObject.activeSelf);
         }
         GameObject[] storyTriggers = GameObject.FindGameObjectsWithTag("DontComeBack");
         for (int i = 0; i < storyTriggers.Length; i++)
         {
             storyTriggers[i].SetActive(!storyTriggers[i].gameObject.activeSelf);
         }
         GameObject[] firstWalls = GameObject.FindGameObjectsWithTag("FirstWall");
         for (int i = 0; i < firstWalls.Length; i++)
         {
             firstWalls[i].SetActive(false);
         }
         //Koke = GameObject.FindObjectOfType<Koke>();
         //Koke.gameObject.SetActive(false);
         FindObjectOfType <GeneticManager>().genPhase = puzzleGen;
         player.transform.Find("VirtualCam").GetComponent <CinemachineConfiner>().m_BoundingShape2D = GameObject.FindGameObjectWithTag("Confiner").GetComponent <PolygonCollider2D>();
         //Ponemos a koke en su sitio para el evento de finalizacion
         Koke = GameObject.FindObjectOfType <Koke>();
         Koke.gameObject.SetActive(false);
         GameObject whereToSpawn = GameObject.FindGameObjectWithTag("spawnLocation");
         Koke.gameObject.transform.position = whereToSpawn.transform.position;
         Koke.gameObject.transform.SetParent(whereToSpawn.transform);
         //canActivatePuzzle = false;
     }
     if (canActivatePuzzle && scene.name.Equals("FirstStageHouse"))
     {
         Koke    = GameObject.FindObjectOfType <Koke>();
         Barbara = GameObject.FindObjectOfType <Barbara>();
         Koke.transform.position    = kokeHouse;
         Barbara.transform.position = barbHouse;
         Koke.GetComponent <Animator>().SetFloat("Horizontal", -1);
         Koke.GetComponent <Animator>().SetFloat("Vertical", 0);
         GameObject.FindGameObjectWithTag("DontComeBack").SetActive(false);
         Koke.extinted    = kokeExtinted;
         Barbara.extinted = barbExtinted;
         kokePhases[0]    = Koke.conversationPhase;
         kokePhases[1]    = Koke.startingPhase;
         kokePhases[2]    = Koke.repeatedPhase;
         kokePhases[3]    = Koke.negationPhase;
         barbaraPhases[0] = Barbara.conversationPhase;
         barbaraPhases[1] = Barbara.startingPhase;
         barbaraPhases[2] = Barbara.repeatedPhase;
         barbaraPhases[3] = Barbara.negationPhase;
     }
     if (!canActivatePuzzle && scene.name.Equals("FirstStageHouse"))
     {
         Koke    = GameObject.FindObjectOfType <Koke>();
         Barbara = GameObject.FindObjectOfType <Barbara>();
         player.transform.Find("VirtualCam").GetComponent <CinemachineConfiner>().InvalidatePathCache();
         player.transform.Find("VirtualCam").GetComponent <CinemachineConfiner>().m_BoundingShape2D = GameObject.FindGameObjectWithTag("Confiner").GetComponent <PolygonCollider2D>();
         firstTime = false;
     }
     if (!canActivatePuzzle && scene.name.Equals("FirstStage") && !firstTime)
     {
         player.transform.Find("VirtualCam").GetComponent <CinemachineConfiner>().InvalidatePathCache();
         player.transform.Find("VirtualCam").GetComponent <CinemachineConfiner>().m_BoundingShape2D = GameObject.FindGameObjectWithTag("Confiner").GetComponent <PolygonCollider2D>();
         GameObject[] storyTriggers = GameObject.FindGameObjectsWithTag("DontComeBack");
         for (int i = 0; i < storyTriggers.Length; i++)
         {
             storyTriggers[i].SetActive(!storyTriggers[i].gameObject.activeSelf);
         }
         GameObject[] firstWalls = GameObject.FindGameObjectsWithTag("FirstWall");
         for (int i = 0; i < firstWalls.Length; i++)
         {
             firstWalls[i].SetActive(false);
         }
         Koke = GameObject.FindObjectOfType <Koke>();
         Koke.gameObject.SetActive(false);
     }
     if (scene.name.Equals("Bosque"))
     {
         player.transform.Find("VirtualCam").GetComponent <CinemachineConfiner>().InvalidatePathCache();
         player.transform.Find("VirtualCam").GetComponent <CinemachineConfiner>().m_BoundingShape2D = GameObject.FindGameObjectWithTag("Confiner").GetComponent <PolygonCollider2D>();
         Koke = FindObjectOfType <Koke>();
         Koke.GetComponent <Animator>().SetFloat("Horizontal", 1);
         Koke.GetComponent <Animator>().SetFloat("Vertical", 0);
     }
     if (scene.name.Equals("SecondStage"))
     {
         player.transform.Find("VirtualCam").GetComponent <CinemachineConfiner>().InvalidatePathCache();
         PolygonCollider2D collider = GameObject.FindGameObjectWithTag("Confiner").transform.Find("confinerBotas").GetComponent <PolygonCollider2D>();
         player.transform.Find("VirtualCam").GetComponent <CinemachineConfiner>().m_BoundingShape2D = collider;
     }
     if (scene.name.Equals("FinalBoss"))
     {
         player.transform.Find("VirtualCam").GetComponent <CinemachineConfiner>().InvalidatePathCache();
         player.transform.Find("VirtualCam").GetComponent <CinemachineConfiner>().m_BoundingShape2D            = GameObject.FindGameObjectWithTag("Confiner").GetComponent <PolygonCollider2D>();
         player.transform.Find("VirtualCam").GetComponent <CinemachineVirtualCamera>().m_Lens.OrthographicSize = 1.8f;
     }
     player.transform.position = GameObject.FindGameObjectWithTag("spawnLocation").gameObject.transform.position;
     if (scene.name.Equals("FirstStage") && firstTime)
     {
         player.transform.position = GameObject.FindGameObjectWithTag("Respawn").gameObject.transform.position;
     }
 }