using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Nube : MonoBehaviour
{
    public float Tiempo, Vel;
    Osito TiempoGlobal;
    Collider2D m_Collider;
    // Start is called before the first frame update
    private void Start()
    {
        Vel = -0.2f;
        TiempoGlobal = GameObject.Find("Osito").GetComponent<Osito>();
        m_Collider = GetComponent<Collider2D>();
    }

    // Update is called once per frame
    void Update()
    {
        transform.Translate(Vel * Time.deltaTime, 0, 0);
        Tiempo = Tiempo + 1 * Time.deltaTime;

        if (Tiempo > 360)
        {
            Destroy(this.gameObject);
        }
        if (TiempoGlobal.TiempoGeneral > 10)
        {
            Vel = -0.5f;
        }
        if (TiempoGlobal.TiempoGeneral > 20)
        {
            Vel = -0.8f;
        }
        if (TiempoGlobal.TiempoGeneral > 30)
        {
            Vel = -1;
        }
        if (TiempoGlobal.TiempoGeneral > 40)
        {
            Vel = -1.5f;
        }
        if (TiempoGlobal.TiempoGeneral > 60)
        {
            Vel = -2;
        }
    }
}
