Example #1
0
    private void OnTriggerStay(Collider other)
    {
        if (Input.GetKeyUp(KeyCode.Mouse0))
        {
            Debug.Log("GTFO mundo TOMAR" + other.gameObject.name);

            IActivable activador = other.gameObject.GetComponent <IActivable>();

            if (activador is null)
            {
                return;
            }

            activador.Activar();
            Brazo.LongitudMaxima += Multiplicador;
        }
    }
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyUp(KeyCode.Mouse0))
        {
            alcance.OverlapCollider(new ContactFilter2D().NoFilter(), results);

            IActivable activable = results.FirstOrDefault(c => c.gameObject.GetComponent <IActivable>() != null)?.GetComponent <IActivable>();

            Debug.Log("Click + " + activable?.ToString());
            if (activable is null)
            {
                return;
            }

            activable.Activar();
        }
    }