Ejemplo n.º 1
0
    public void kokeFirstAct()
    {
        //Congelamos el movimiento del jugador
        player.stopFromMoving();
        Koke npc = Koke.GetComponent <Koke>();

        StartCoroutine(waitForTaskEndFirstAct(npc));
    }
Ejemplo n.º 2
0
    private IEnumerator startCredits()
    {
        soundManager.stopAllAudios();
        loadScreen.transform.Find("LoadingSprite").gameObject.SetActive(false);
        Image fondoBlanco = loadScreen.transform.Find("FondoNegro").GetComponent <Image>();

        fondoBlanco.color = new Color(255, 255, 255, 0);
        loadScreen.SetActive(!loadScreen.activeSelf);
        float transparency = 0.05f;

        while (fondoBlanco.color.a < 1)
        {
            fondoBlanco.color = new Color(255, 255, 255, transparency);
            transparency     += 0.05f;
            yield return(new WaitForSeconds(0.1f));
        }
        //Transportamos a Olivia y Koke
        player.transform.position = GameObject.FindGameObjectWithTag("Respawn").transform.position;
        player.transform.Find("VirtualCam").GetComponent <CinemachineVirtualCamera>().m_Lens.OrthographicSize = 1.4f;
        player.transform.Find("VirtualCam").GetComponent <CinemachineConfiner>().InvalidatePathCache();
        player.transform.Find("VirtualCam").GetComponent <CinemachineConfiner>().m_BoundingShape2D = GameObject.FindGameObjectWithTag("barrerasHolder").GetComponent <PolygonCollider2D>();
        Animator playerAnim = player.GetComponent <Animator>();

        player.transform.Find("MnACanvas").gameObject.SetActive(false);
        player.transform.Find("Abilities").gameObject.SetActive(false);
        playerAnim.SetFloat("IdleState", 1);
        playerAnim.SetFloat("IdleStateY", 0);
        Koke Koke = FindObjectOfType <Koke>();

        Koke.transform.position = new Vector3(22.147f, 23.322f, -526.798f);
        Animator kokeAnim = Koke.GetComponent <Animator>();

        kokeAnim.SetFloat("Horizontal", -1);
        kokeAnim.SetFloat("Vertical", 0);
        yield return(new WaitForSeconds(3));

        while (fondoBlanco.color.a > 0)
        {
            fondoBlanco.color = new Color(255, 255, 255, transparency);
            transparency     -= 0.05f;
            yield return(new WaitForSeconds(0.1f));
        }
        player.setDashing(true);
        Rigidbody2D olivRb = player.GetComponent <Rigidbody2D>();

        olivRb.drag = 0;
        playerAnim.SetFloat("Speed", 1);
        playerAnim.SetFloat("Horizontal", 1);
        playerAnim.SetFloat("Vertical", 1);
        olivRb.AddForce(new Vector2(40, 0));
        Rigidbody2D kokeRb = Koke.GetComponent <Rigidbody2D>();

        kokeRb.AddForce(new Vector2(-40, 0));
        yield return(new WaitForSeconds(3.3f));

        playerAnim.SetFloat("Speed", 0);
        olivRb.velocity = Vector3.zero;
        kokeRb.velocity = Vector3.zero;
        yield return(new WaitForSeconds(2f));

        playerAnim.SetFloat("IdleState", 0);
        playerAnim.SetFloat("IdleStateY", 1);
        kokeAnim.SetFloat("Horizontal", 0);
        kokeAnim.SetFloat("Vertical", 1);
        //Activamos las letras de credito
        GameObject canvasFinish = GameObject.FindGameObjectWithTag("Finish");

        canvasFinish.transform.GetChild(0).gameObject.SetActive(true);
        yield return(new WaitForSeconds(5));

        canvasFinish.transform.GetChild(0).gameObject.SetActive(false);
        canvasFinish.transform.GetChild(1).gameObject.SetActive(true);
        yield return(new WaitForSeconds(5));

        canvasFinish.transform.GetChild(1).gameObject.SetActive(false);
        yield return(new WaitForSeconds(2));

        Application.Quit();
        yield return(null);
    }
Ejemplo n.º 3
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;
     }
 }