//check if you should punch that box public bool ValidatePunch(BoxController other) { if (other == this) { return(false); } other.KnockBack((other.Position - this.Position).normalized * knockBackStrength); other.Damage(attackDamage); return(true); }
public void Damage(Vector3 v, float atk) { mBox.Damage(v); HP -= atk; if (HP <= 0) { mBox.Death(); } // onDamage = true; // damageDir = Vector3.Cross(v,new Vector3(0,1.0f,0)); // endDir = new Vector3(0,-1,0) ;//damageDir*40 ; // startDir = transform.forward; // gameObject.GetComponent<Animator>().Play("Damaged"); }