void OnCollisionEnter(Collision collider) { if (collider.transform.tag == "Player" && (cabbageBody.transform.position.y - collider.transform.position.y) > 0.5f) { PlayerLife pl = collider.gameObject.GetComponent <PlayerLife>(); pl.Health = 0f; } }
//assigning references private void InitializePlayerComponents() { //get all components to manage _movement = this.GetComponent<PlayerMove>(); _life = this.GetComponent<PlayerLife>(); _pushPull = this.GetComponent<PushPull>(); //tell all components this is their controller AssignController(this); }
public override void Start(RAIN.Core.AI ai) { Debug.Log("Caught!"); GameObject p = GameObject.FindGameObjectWithTag("Player"); PlayerLife pl = p.GetComponent <PlayerLife>(); pl.Health = 0f; //pm.EnableRagdoll(); base.Start(ai); }
//assigning references private void InitializePlayerComponents() { //get all components to manage _movement = this.GetComponent <PlayerMove>(); _life = this.GetComponent <PlayerLife>(); _pushPull = this.GetComponent <PushPull>(); _footStep = this.GetComponentInChildren <Footstep>(); //tell all components this is their controller AssignController(this); }