Пример #1
0
 void OnCollisionEnter(Collision other)
 {
     if (other.collider.gameObject.layer == LayerMask.NameToLayer("Enemy"))
     {
         Debug.Log("pushing");
         StartCoroutine(playerUI.HealthDown());
         Vector3 direction = (transform.position - other.transform.position).normalized;
         rb.AddForce(direction * 5, ForceMode.VelocityChange);
     }
 }