public void Attack() { if (this.isCompanion(selectComp)) { Rigidbody rbSelected = selectComp.transform.parent.GetComponent <Rigidbody>(); Rigidbody rbPlayer = GameObject.Find("Player").transform.parent.parent.GetComponent <Rigidbody>(); rbSelected.isKinematic = false; rbPlayer.isKinematic = false; anim.Play(Animations.WALK); anim[Animations.WALK].wrapMode = WrapMode.Loop; Debug.Log(GameObject.Find("Player").transform.parent.gameObject.tag); model.setCanvas(GameObject.Find("Player").transform.parent.gameObject.tag); model.setWalk(true); // Idle 1 //anim.CrossFadeQueued(Animations.IDLE_1); } }
void OnCollisionEnter(Collision collision) { GameObject collidedComp = collision.gameObject; if (collidedComp.transform.childCount > 0 && controller.isCompanion(collidedComp.transform.GetChild(0).gameObject)) { //Debug.Log("Collided"); //Debug.Log(collidedComp); model.setWalk(false); startAttackTime = Time.time; } }