Example #1
0
    // Update is called once per frame
    private void OnTriggerStay2D(Collider2D col)
    {
        if (col.gameObject.CompareTag("HabitacionElectricidad") ||
            col.gameObject.CompareTag("HabitacionAgua") ||
            col.gameObject.CompareTag("HabitacionComida") ||
            col.gameObject.CompareTag("HabitacionVeterinario") ||
            col.gameObject.CompareTag("HabitacionDormitorio") ||
            col.gameObject.CompareTag("HabitacionPuertaEntrada") ||
            col.gameObject.CompareTag("Habitacion") ||
            col.gameObject.CompareTag("HabitacionExpediciones"))
        {
            if (Mathf.Abs(rb.velocity.x) < velocidadTope)
            {
                rb.AddForce(vectorVelocidad * velocidad);
            }
            scriptSalas = col.GetComponent <ConejosEnSala>();

            if (scriptSalas.conejosDentro.Count < 3)
            {
                habitacionActual  = col.transform;
                fueraDeHabitacion = false;
            }
        }
    }
Example #2
0
 // Start is called before the first frame update
 void Start()
 {
     scriptSalas = GetComponent <ConejosEnSala>();
 }