void OnCollisionEnter(Collision collision) { Debug.Log(collision.transform.name); if (Sun.Instance.rotation >= 180 && Sun.Instance.rotation <= 270 && collision.transform.CompareTag("HumanBodypart")) // Check human layer during nighttime. { var _human = collision.gameObject.GetComponentInParent <HumanAI>(); if (_human._house == this.gameObject) { hasRun = false; human = collision.gameObject.GetComponentInParent <RagdollAnimator>(); AI = collision.gameObject.GetComponentInParent <HumanAI>(); collision.gameObject.GetComponentInParent <RagdollAnimator>().gameObject.SetActive(false); } } }
void Start() { slider = GetComponent <UnityEngine.UI.Slider>(); animator = FindObjectOfType <RagdollAnimator>(); }