<repo_name>HackathonNicaragua2019/Uncover-Maps<file_sep>/UncoverMapsProject/Assets/Scripts/Animaciones.cs
﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Animaciones : MonoBehaviour
{

    public GameObject letreroAzul1, letreroAzul2, letreroAzul3, letreroAzul4;
    public GameObject letreroRojo1, letreroRojo2, letreroRojo3;
    public GameObject letreroVerde1;

    int contador = 0, contadorY = 0;
    float velocidadGiro = -144f, limiteGiro = 180f;
    bool test = false;
    

    // Start is called before the first frame update
    void Start()
    {
        componentesTransparentes();
        inicializacionIconosGiro();
    }

    // Update is called once per frame
    void Update()
    {
        if (contador < 60)
        {
            contador += 1;
        }
        else { 
            fadeTransition();
            giroIconos();
        }
    }

    public void componentesTransparentes() 
    {
        letreroAzul1.GetComponent<Renderer>().material.color = new Color(
            letreroAzul1.GetComponent<Renderer>().material.color.r,
            letreroAzul1.GetComponent<Renderer>().material.color.g,
            letreroAzul1.GetComponent<Renderer>().material.color.b,            
            0.0f);
        letreroAzul2.GetComponent<Renderer>().material.color = new Color(
            letreroAzul2.GetComponent<Renderer>().material.color.r,
            letreroAzul2.GetComponent<Renderer>().material.color.g,
            letreroAzul2.GetComponent<Renderer>().material.color.b,            
            0.0f);
        letreroAzul3.GetComponent<Renderer>().material.color = new Color(
            letreroAzul3.GetComponent<Renderer>().material.color.r,
            letreroAzul3.GetComponent<Renderer>().material.color.g,
            letreroAzul3.GetComponent<Renderer>().material.color.b,            
            0.0f);
        letreroAzul4.GetComponent<Renderer>().material.color = new Color(
            letreroAzul4.GetComponent<Renderer>().material.color.r,
            letreroAzul4.GetComponent<Renderer>().material.color.g,
            letreroAzul4.GetComponent<Renderer>().material.color.b,            
            0.0f);
        letreroRojo1.GetComponent<Renderer>().material.color = new Color(
            letreroRojo1.GetComponent<Renderer>().material.color.r,
            letreroRojo1.GetComponent<Renderer>().material.color.g,
            letreroRojo1.GetComponent<Renderer>().material.color.b,            
            0.0f);
        letreroRojo2.GetComponent<Renderer>().material.color = new Color(
            letreroRojo2.GetComponent<Renderer>().material.color.r,
            letreroRojo2.GetComponent<Renderer>().material.color.g,
            letreroRojo2.GetComponent<Renderer>().material.color.b,            
            0.0f);
        letreroRojo3.GetComponent<Renderer>().material.color = new Color(
            letreroRojo3.GetComponent<Renderer>().material.color.r,
            letreroRojo3.GetComponent<Renderer>().material.color.g,
            letreroRojo3.GetComponent<Renderer>().material.color.b,
            0.0f);
        letreroVerde1.GetComponent<Renderer>().material.color = new Color(
            letreroVerde1.GetComponent<Renderer>().material.color.r,
            letreroVerde1.GetComponent<Renderer>().material.color.g,
            letreroVerde1.GetComponent<Renderer>().material.color.b,
            0.0f);
    }

    public void fadeTransition() 
    {
        if (letreroVerde1.GetComponent<Renderer>().material.color.a < 1f) 
        {
            letreroAzul1.GetComponent<Renderer>().material.color = new Color(
                letreroAzul1.GetComponent<Renderer>().material.color.r,
                letreroAzul1.GetComponent<Renderer>().material.color.g,
                letreroAzul1.GetComponent<Renderer>().material.color.b,
                letreroAzul1.GetComponent<Renderer>().material.color.a + 0.03f);
            letreroAzul2.GetComponent<Renderer>().material.color = new Color(
                letreroAzul2.GetComponent<Renderer>().material.color.r,
                letreroAzul2.GetComponent<Renderer>().material.color.g,
                letreroAzul2.GetComponent<Renderer>().material.color.b,
                letreroAzul2.GetComponent<Renderer>().material.color.a + 0.02f);
            letreroAzul3.GetComponent<Renderer>().material.color = new Color(
                letreroAzul3.GetComponent<Renderer>().material.color.r,
                letreroAzul3.GetComponent<Renderer>().material.color.g,
                letreroAzul3.GetComponent<Renderer>().material.color.b,
                letreroAzul3.GetComponent<Renderer>().material.color.a + 0.015f);
            letreroAzul4.GetComponent<Renderer>().material.color = new Color(
                letreroAzul4.GetComponent<Renderer>().material.color.r,
                letreroAzul4.GetComponent<Renderer>().material.color.g,
                letreroAzul4.GetComponent<Renderer>().material.color.b,
                letreroAzul4.GetComponent<Renderer>().material.color.a + 0.015f);
            letreroRojo1.GetComponent<Renderer>().material.color = new Color(
                letreroRojo1.GetComponent<Renderer>().material.color.r,
                letreroRojo1.GetComponent<Renderer>().material.color.g,
                letreroRojo1.GetComponent<Renderer>().material.color.b,
                letreroRojo1.GetComponent<Renderer>().material.color.a + 0.014f);
            letreroRojo2.GetComponent<Renderer>().material.color = new Color(
                letreroRojo2.GetComponent<Renderer>().material.color.r,
                letreroRojo2.GetComponent<Renderer>().material.color.g,
                letreroRojo2.GetComponent<Renderer>().material.color.b,
                letreroRojo2.GetComponent<Renderer>().material.color.a + 0.012f);
            letreroRojo3.GetComponent<Renderer>().material.color = new Color(
                letreroRojo3.GetComponent<Renderer>().material.color.r,
                letreroRojo3.GetComponent<Renderer>().material.color.g,
                letreroRojo3.GetComponent<Renderer>().material.color.b,
                letreroRojo3.GetComponent<Renderer>().material.color.a + 0.010f);
            letreroVerde1.GetComponent<Renderer>().material.color = new Color(
                letreroVerde1.GetComponent<Renderer>().material.color.r,
                letreroVerde1.GetComponent<Renderer>().material.color.g,
                letreroVerde1.GetComponent<Renderer>().material.color.b,
                letreroVerde1.GetComponent<Renderer>().material.color.a + 0.01f);
        }
    }

    public void inicializacionIconosGiro() 
    {
        letreroAzul1.transform.Rotate(new Vector3(0, 80f, 0));
        letreroAzul2.transform.Rotate(new Vector3(0, 95f, 0));
        letreroAzul3.transform.Rotate(new Vector3(0, 110f, 0));
        letreroAzul4.transform.Rotate(new Vector3(0, 110f, 0));
        letreroRojo1.transform.Rotate(new Vector3(0, 125f, 0));
        letreroRojo2.transform.Rotate(new Vector3(0, 155f, 0));
        letreroRojo3.transform.Rotate(new Vector3(0, 165f, 0));
        letreroVerde1.transform.Rotate(new Vector3(0, 175f, 0));
    }

    public void giroIconos() 
    {
        if (letreroAzul1.transform.localEulerAngles.y < limiteGiro) 
        {
            letreroAzul1.transform.Rotate(new Vector3(0, velocidadGiro, 0) * Time.deltaTime);
        }

        if(letreroAzul2.transform.localEulerAngles.y < limiteGiro)
        {
            letreroAzul2.transform.Rotate(new Vector3(0, velocidadGiro, 0) * Time.deltaTime);
        }

        if(letreroAzul3.transform.localEulerAngles.y < limiteGiro)
        {
            letreroAzul3.transform.Rotate(new Vector3(0, velocidadGiro, 0) * Time.deltaTime);
        }

        if(letreroAzul4.transform.localEulerAngles.y < limiteGiro)
        {
            letreroAzul4.transform.Rotate(new Vector3(0, velocidadGiro, 0) * Time.deltaTime);
        }

        if(letreroRojo1.transform.localEulerAngles.y < limiteGiro)
        {
            letreroRojo1.transform.Rotate(new Vector3(0, velocidadGiro, 0) * Time.deltaTime);
        }

        if(letreroRojo2.transform.localEulerAngles.y < limiteGiro)
        {
            letreroRojo2.transform.Rotate(new Vector3(0, velocidadGiro, 0) * Time.deltaTime);
        }

        if(letreroRojo3.transform.localEulerAngles.y < limiteGiro)
        {
            letreroRojo3.transform.Rotate(new Vector3(0, velocidadGiro, 0) * Time.deltaTime);
        }

        if(letreroVerde1.transform.localEulerAngles.y < limiteGiro)
        {
            letreroVerde1.transform.Rotate(new Vector3(0, velocidadGiro, 0) * Time.deltaTime);
        }
    }
}
<file_sep>/UncoverMapsProject/Assets/Scripts/TouchLetreros.cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;

public class TouchLetreros : MonoBehaviour
{
    public GameObject letreroAzul1, letreroAzul2, letreroAzul3, letreroAzul4;
    public GameObject letreroRojo1, letreroRojo2, letreroRojo3;
    public GameObject letreroVerde1;
    public GameObject panel1, panel2, panel3, panel4, panel5, panel6, panel7, panel8;
    public GameObject btnCerrarP1;

    bool test1, test2, test3, test4, test5, test6, test7, test8;
    string nombreLetrero, cerrar;
    float velocidadRotacion = -944, limiteGiro = 180;
    int contadorY;

    //// Start is called before the first frame update
    void Start()
    {

    }

    // Update is called once per frame
    void Update()
    {
        Touch();

        if (test1)
        {
            Rotacion1();
        }
        else if (test2)
        {
            Rotacion2();
        }
        else if (test3)
        {
            Rotacion3();
        }
        else if (test4)
        {
            Rotacion4();
        }
        else if (test5)
        {
            Rotacion5();
        }
        else if (test6)
        {
            Rotacion6();
        }
        else if (test7)
        {
            Rotacion7();
        }
        else if (test8)
        {
            Rotacion8();
        }
    }

    public void Touch()
    {
        if (Input.touchCount > 0 && Input.touches[0].phase == TouchPhase.Began && !panel1.activeInHierarchy)
        {
            Ray ray = Camera.main.ScreenPointToRay(Input.GetTouch(0).position);
            RaycastHit hit;
            if (Physics.Raycast(ray, out hit))
            {
                nombreLetrero = hit.transform.name;
                switch (nombreLetrero)
                {
                    case "PlanoTouch1":
                        test1 = true;
                        break;
                    case "PlanoTouch2":
                        test2 = true;
                        break;
                    case "PlanoTouch3":
                        test3 = true;
                        break;
                    case "PlanoTouch4":
                        test4 = true;
                        break;
                    case "PlanoTouch5":
                        test5 = true;
                        break;
                    case "PlanoTouch6":
                        test6 = true;
                        break;
                    case "PlanoTouch7":
                        test7 = true;
                        break;
                    case "PlanoTouch8":
                        test8 = true;
                        break;
                }
            }
        }
    }

    public void Rotacion1()
    {
        if (letreroAzul1.transform.localEulerAngles.y < limiteGiro)
        {
            contadorY += 1;
        }

        if (contadorY <= 15)
        {
            letreroAzul1.transform.Rotate(new Vector3(0, velocidadRotacion, 0) * Time.deltaTime);
        }
        else
        {
            test1 = false;
            contadorY = 0;
            panel1.SetActive(true);
            btnCerrarP1.SetActive(true);
        }
    }

    public void Rotacion2()
    {
        if (letreroAzul2.transform.localEulerAngles.y < limiteGiro)
        {
            contadorY += 1;
        }

        if (contadorY <= 15)
        {
            letreroAzul2.transform.Rotate(new Vector3(0, velocidadRotacion, 0) * Time.deltaTime);
        }
        else
        {
            test2 = false;
            contadorY = 0;
            panel1.SetActive(true);
            btnCerrarP1.SetActive(true);
        }
    }

    public void Rotacion3()
    {
        if (letreroRojo1.transform.localEulerAngles.y < limiteGiro)
        {
            contadorY += 1;
        }

        if (contadorY <= 15)
        {
            letreroRojo1.transform.Rotate(new Vector3(0, velocidadRotacion, 0) * Time.deltaTime);
        }
        else
        {
            test3 = false;
            contadorY = 0;
            panel1.SetActive(true);
            btnCerrarP1.SetActive(true);
        }
    }

    public void Rotacion4()
    {
        if (letreroRojo2.transform.localEulerAngles.y < limiteGiro)
        {
            contadorY += 1;
        }

        if (contadorY <= 15)
        {
            letreroRojo2.transform.Rotate(new Vector3(0, velocidadRotacion, 0) * Time.deltaTime);
        }
        else
        {
            test4 = false;
            contadorY = 0;
            panel1.SetActive(true);
            btnCerrarP1.SetActive(true);
        }
    }

    public void Rotacion5()
    {
        if (letreroAzul3.transform.localEulerAngles.y < limiteGiro)
        {
            contadorY += 1;
        }

        if (contadorY <= 15)
        {
            letreroAzul3.transform.Rotate(new Vector3(0, velocidadRotacion, 0) * Time.deltaTime);
        }
        else
        {
            test5 = false;
            contadorY = 0;
            panel1.SetActive(true);
            btnCerrarP1.SetActive(true);
        }
    }

    public void Rotacion6()
    {
        if (letreroRojo3.transform.localEulerAngles.y < limiteGiro)
        {
            contadorY += 1;
        }

        if (contadorY <= 15)
        {
            letreroRojo3.transform.Rotate(new Vector3(0, velocidadRotacion, 0) * Time.deltaTime);
        }
        else
        {
            test6 = false;
            contadorY = 0;
            panel1.SetActive(true);
            btnCerrarP1.SetActive(true);
        }
    }

    public void Rotacion7()
    {
        if (letreroAzul4.transform.localEulerAngles.y < limiteGiro)
        {
            contadorY += 1;
        }

        if (contadorY <= 15)
        {
            letreroAzul4.transform.Rotate(new Vector3(0, velocidadRotacion, 0) * Time.deltaTime);
        }
        else
        {
            test7 = false;
            contadorY = 0;
            panel1.SetActive(true);
            btnCerrarP1.SetActive(true);
        }
    }

    public void Rotacion8()
    {
        if (letreroVerde1.transform.localEulerAngles.y < limiteGiro)
        {
            contadorY += 1;
        }

        if (contadorY <= 15)
        {
            letreroVerde1.transform.Rotate(new Vector3(0, velocidadRotacion, 0) * Time.deltaTime);
        }
        else
        {
            test8 = false;
            contadorY = 0;
            panel1.SetActive(true);
            btnCerrarP1.SetActive(true);
        }
    }
}
<file_sep>/UncoverMapsProject/Assets/Scripts/btnCerrar.cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;

public class btnCerrar : MonoBehaviour, IPointerDownHandler
{
    public GameObject panelCerrar1, panelCerrar2, panelCerrar3, panelCerrar4, panelCerrar5, panelCerrar6, panelCerrar7, panelCerrar8;
    void Start()
    {

    }

    // Update is called once per frame
    void Update()
    {

    }

    public void OnPointerDown(PointerEventData eventData)
    {
        if ("btnCerrarP1".Equals(eventData.pointerCurrentRaycast.gameObject.name))
        {
            Debug.Log(gameObject.name);
            panelCerrar1.SetActive(false);
        }
        if ("btnCerrarP1".Equals(eventData.pointerCurrentRaycast.gameObject.name))
        {
            Debug.Log(gameObject.name);
            panelCerrar2.SetActive(false);
        }
        if ("btnCerrarP1".Equals(eventData.pointerCurrentRaycast.gameObject.name))
        {
            Debug.Log(gameObject.name);
            panelCerrar3.SetActive(false);
        }
        if ("btnCerrarP1".Equals(eventData.pointerCurrentRaycast.gameObject.name))
        {
            Debug.Log(gameObject.name);
            panelCerrar4.SetActive(false);
        }
        if ("btnCerrarP1".Equals(eventData.pointerCurrentRaycast.gameObject.name))
        {
            Debug.Log(gameObject.name);
            panelCerrar5.SetActive(false);
        }
        if ("btnCerrarP1".Equals(eventData.pointerCurrentRaycast.gameObject.name))
        {
            Debug.Log(gameObject.name);
            panelCerrar6.SetActive(false);
        }
        if ("btnCerrarP1".Equals(eventData.pointerCurrentRaycast.gameObject.name))
        {
            Debug.Log(gameObject.name);
            panelCerrar7.SetActive(false);
        }
        if ("btnCerrarP1".Equals(eventData.pointerCurrentRaycast.gameObject.name))
        {
            Debug.Log(gameObject.name);
            panelCerrar8.SetActive(false);
        }
    }
}
<file_sep>/UncoverMapsProject/Assets/Scripts/BtnCentral.cs
﻿using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;


public class BtnCentral : MonoBehaviour, IPointerDownHandler
{
    bool transicion = false, clickBus = false, clickTelefono = false, clickComida = false, clickCampamento = false, clickBtnIzquierdo = false;
    public GameObject btnBus, btnCampamento, btnComida, btnTelefono, btnMenu, btnMenuIzquierda, panelBus, panelTelefono, panelComida, panelCampamento;
    float y1, y2, y3, y4, y, x, x1;
    float velocidadMovimiento = 20;
    string btnName;

    // Start is called before the first frame update
    void Start()
    {
        llenadoVariablesXYZ();
        btnBus.transform.position = new Vector2(x, y);
        btnCampamento.transform.position = new Vector2(x, y);
        btnComida.transform.position = new Vector2(x, y);
        btnTelefono.transform.position = new Vector2(x, y);
        btnMenuIzquierda.transform.position = new Vector2(x, y);
    }

    // Update is called once per frame
    void Update()
    {
        if (transicion)
        {
            despliegeMenu();
        }
        else
        {
            retraerMenu();
        }

        if (clickBus)
        {
            transicion = false;
            btnBus.transform.SetAsLastSibling();
            if (btnBus.transform.position.y <= btnMenuIzquierda.transform.position.y)
            {
                if (btnMenuIzquierda.transform.position.x > x1)
                {
                    btnMenuIzquierda.transform.position = new Vector2(btnMenuIzquierda.transform.position.x - velocidadMovimiento, y);
                }
                else
                {
                    panelBus.SetActive(true);
                    clickBus = false;
                }
            }
        }

        if (clickTelefono)
        {
            transicion = false;
            btnTelefono.transform.SetAsLastSibling();
            if (btnTelefono.transform.position.y <= btnMenuIzquierda.transform.position.y)
            {
                if (btnMenuIzquierda.transform.position.x > x1)
                {
                    btnMenuIzquierda.transform.position = new Vector2(btnMenuIzquierda.transform.position.x - velocidadMovimiento, y);
                }
                else
                {
                    panelTelefono.SetActive(true);
                    clickTelefono = false;
                }
            }
        }

        if (clickCampamento)
        {
            transicion = false;
            btnCampamento.transform.SetAsLastSibling();
            if (btnCampamento.transform.position.y <= btnMenuIzquierda.transform.position.y)
            {
                if (btnMenuIzquierda.transform.position.x > x1)
                {
                    btnMenuIzquierda.transform.position = new Vector2(btnMenuIzquierda.transform.position.x - velocidadMovimiento, y);
                }
                else
                {
                    panelCampamento.SetActive(true);
                    clickCampamento = false;
                }
            }
        }

        if (clickComida)
        {
            transicion = false;
            btnComida.transform.SetAsLastSibling();
            if (btnComida.transform.position.y <= btnMenuIzquierda.transform.position.y)
            {
                if (btnMenuIzquierda.transform.position.x > x1)
                {
                    btnMenuIzquierda.transform.position = new Vector2(btnMenuIzquierda.transform.position.x - velocidadMovimiento, y);
                }
                else
                {
                    panelComida.SetActive(true);
                    clickComida = false;
                }
            }
        }

        if (clickBtnIzquierdo)
        {
            if (btnMenuIzquierda.transform.position.x < x)
            {
                btnMenuIzquierda.transform.position = new Vector2(btnMenuIzquierda.transform.position.x + velocidadMovimiento, y);
            }
            else
            {
                panelBus.transform.position = new Vector2(panelBus.transform.position.x, panelBus.transform.position.y - 700);
                panelTelefono.transform.position = new Vector2(panelTelefono.transform.position.x, panelTelefono.transform.position.y - 700);
                panelCampamento.transform.position = new Vector2(panelCampamento.transform.position.x, panelCampamento.transform.position.y - 700);
                panelComida.transform.position = new Vector2(panelComida.transform.position.x, panelComida.transform.position.y - 700);

                panelBus.SetActive(false);
                panelTelefono.SetActive(false);
                panelCampamento.SetActive(false);
                panelComida.SetActive(false);

                clickBtnIzquierdo = false;
                btnMenu.transform.SetAsLastSibling();
            }
        }
    }

    public void OnPointerDown(PointerEventData eventData)
    {
        if ("BtnCentral".Equals(eventData.pointerCurrentRaycast.gameObject.name))
        {
            if (transicion)
            {
                transicion = false;
            }
            else
            {
                transicion = true;
            }
        }

        if ("BtnTransporte".Equals(eventData.pointerCurrentRaycast.gameObject.name))
        {
            if (!clickBus)
            {
                clickBus = true;
            }
        }

        if ("BtnLlamadas".Equals(eventData.pointerCurrentRaycast.gameObject.name))
        {
            if (!clickTelefono)
            {
                clickTelefono = true;
            }
        }

        if ("BtnRestaurante".Equals(eventData.pointerCurrentRaycast.gameObject.name))
        {
            if (!clickComida)
            {
                clickComida = true;
            }
        }

        if ("BtnHospedaje".Equals(eventData.pointerCurrentRaycast.gameObject.name))
        {
            if (!clickCampamento)
            {
                clickCampamento = true;
            }
        }

        if ("BtnRegresar".Equals(eventData.pointerCurrentRaycast.gameObject.name))
        {
            if (!clickBtnIzquierdo)
            {
                clickBtnIzquierdo = true;
            }
        }

    }

    public void llenadoVariablesXYZ()
    {
        x = btnMenu.transform.position.x;
        y = btnMenu.transform.position.y;

        x1 = btnMenuIzquierda.transform.position.x;

        y1 = btnBus.transform.position.y;
        y2 = btnCampamento.transform.position.y;
        y3 = btnComida.transform.position.y;
        y4 = btnTelefono.transform.position.y;
    }

    public void desplegarBotonInicioIzquierda()
    {
        if (btnMenuIzquierda.transform.position.x > x1)
        {
            btnMenuIzquierda.transform.position = new Vector2(btnMenuIzquierda.transform.position.x - velocidadMovimiento, y);
        }
    }

    public void retraerBotonInicioIzquierda()
    {
        if (btnMenuIzquierda.transform.position.x < x)
        {
            btnMenuIzquierda.transform.position = new Vector2(btnMenuIzquierda.transform.position.x + velocidadMovimiento, y);
        }
    }

    public void despliegeMenu()
    {

        if (btnBus.transform.position.y < y1)
        {
            btnBus.transform.position = new Vector2(btnMenu.transform.position.x, btnBus.transform.position.y + velocidadMovimiento);
        }
        if (btnCampamento.transform.position.y < y2)
        {
            btnCampamento.transform.position = new Vector2(btnMenu.transform.position.x, btnCampamento.transform.position.y + velocidadMovimiento);
        }
        if (btnComida.transform.position.y < y3)
        {
            btnComida.transform.position = new Vector2(btnMenu.transform.position.x, btnComida.transform.position.y + velocidadMovimiento);
        }
        if (btnTelefono.transform.position.y < y4)
        {
            btnTelefono.transform.position = new Vector2(btnMenu.transform.position.x, btnTelefono.transform.position.y + velocidadMovimiento);
        }
    }

    public void retraerMenu()
    {
        if (btnBus.transform.position.y > y)
        {
            btnBus.transform.position = new Vector2(btnMenu.transform.position.x, btnBus.transform.position.y - velocidadMovimiento);
        }
        if (btnCampamento.transform.position.y > y)
        {
            btnCampamento.transform.position = new Vector2(btnMenu.transform.position.x, btnCampamento.transform.position.y - velocidadMovimiento);
        }
        if (btnComida.transform.position.y > y)
        {
            btnComida.transform.position = new Vector2(btnMenu.transform.position.x, btnComida.transform.position.y - velocidadMovimiento);
        }
        if (btnTelefono.transform.position.y > y)
        {
            btnTelefono.transform.position = new Vector2(btnMenu.transform.position.x, btnTelefono.transform.position.y - velocidadMovimiento);
        }
    }

}
<file_sep>/UncoverMapsProject/Assets/Scripts/ControlClima.cs
﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class ControlClima : MonoBehaviour
{
    public GameObject luna, sol, nubesClaras;
    Animation animacionSol, animacionLuna, animacionNubesClaras;
    public AnimationClip solIn, solOut, lunaIn, lunaOut, nubesClarasIn, nubesClarasOut;
    int count = 0;
    bool inSol = false, outSol = false, inLuna = false, outLuna = false, inNubes = false, outNubes = false;

    // Start is called before the first frame update
    void Start()
    {
        initialObject();
        animacionSol = sol.AddComponent<Animation>();
        animacionSol.AddClip(solIn, "solIN");
        animacionSol.AddClip(solOut, "solOut");
        animacionLuna = luna.AddComponent<Animation>();
        animacionLuna.AddClip(lunaIn, "lunaIn");
        animacionLuna.AddClip(lunaOut, "lunaOut");
        animacionNubesClaras = nubesClaras.AddComponent<Animation>();
        animacionNubesClaras.AddClip(nubesClarasIn, "nubesIn");
        animacionNubesClaras.AddClip(nubesClarasOut, "nubesOut");

    }

    // Update is called once per frame
    void Update()
    {
        count++;
        if (count == 200)
        {
            Debug.Log("sol true");
            inSol = true;

        }
        if (count == 600)
        {
            Debug.Log("luna true");
            inLuna = true;


        }
        if (count == 1000)
        {
            Debug.Log("nubes true");
            inNubes = true;
            count = 0;

        }

        if (inSol)
        {
            inSol = false;
            outSol = true;
            animacionSol.Play("solIN");
        }
        if (outSol)
        {
            outSol = false;
            animacionSol.Play("solOut");
        }
        if (inLuna)
        {
            inLuna = false;
            outLuna = true;
            animacionLuna.Play("lunaIn");
        }
        if (outLuna)
        {
            outLuna = false;
            animacionLuna.Play("lunaOut");
        }
        if (inNubes)
        {
            inNubes = false;
            outNubes = true;
            animacionNubesClaras.Play("nubesIn");
        }
        if (outNubes)
        {
            outNubes = false;
            animacionNubesClaras.Play("nubesOut");
        }
    }

    public void initialObject()
    {
        luna.GetComponent<Renderer>().material.color = new Color(luna.GetComponent<Renderer>().material.color.r,
            luna.GetComponent<Renderer>().material.color.g, luna.GetComponent<Renderer>().material.color.b, 0.0f);
        sol.GetComponent<Renderer>().material.color = new Color(sol.GetComponent<Renderer>().material.color.r,
            sol.GetComponent<Renderer>().material.color.g, sol.GetComponent<Renderer>().material.color.b, 0.0f);
        nubesClaras.GetComponent<Renderer>().material.color = new Color(nubesClaras.GetComponent<Renderer>().material.color.r,
            nubesClaras.GetComponent<Renderer>().material.color.g, nubesClaras.GetComponent<Renderer>().material.color.b, 0.0f);
    }
}
