public void useEnviroment() { RaycastHit2D raycastHit2D = Physics2D.BoxCast(bodyStraitCollider.bounds.center, bodyStraitCollider.bounds.size, 0f, Vector2.zero, 1, GlobalProperties.gp.usableLayerMask); if (raycastHit2D.collider != null) { Debug.Log("COLLIDED"); IEnviromentUsable usable = (raycastHit2D.collider.gameObject.GetComponent <IEnviromentUsable>()); if (usable != null) { Debug.Log("Trying to use"); useEnviroment(usable); } } Debug.Log("NONE"); }
public void useEnviroment(IEnviromentUsable usable) { usable.beUsed(this); }