public void SetTarget(SimpleLife target) { if (!target.ded) { this.target = target; } }
private void OnTriggerExit(Collider other) { if (other.tag == foeTag || other.tag == "Player") { target = null; } }
// Start is called before the first frame update void Start() { drm = GetComponent <DirectionRelativeMovement>(); sl = GetComponentInChildren <SimpleLife>(); player = GameObject.FindGameObjectWithTag(playerTag).GetComponent <Crowd>(); cc = GetComponent <CharacterController>(); }
private void OnTriggerStay(Collider other) { SimpleLife sl = other.GetComponent <SimpleLife>(); if ((target == null || target.ded) && (other.tag == foeTag || other.tag == "Player") && sl && !sl.ded) { target = sl; if (GetComponentInParent <CrowdEnemy>() && other.GetComponentInParent <CrowdElement>() && other.GetComponentInParent <CrowdElement>().elementEnabled) { attacking = true; //Debug.Log("AAAAAA"); } } }
void Shoot() { flash.Play(); RaycastHit hit; if (Physics.Raycast(fpsCam.transform.position, fpsCam.transform.forward, out hit, range)) { Debug.Log(hit.transform.name); var referencia = GameObject.Instantiate(flash2, hit.point, Quaternion.identity); Destroy(referencia.gameObject, 2); Enemy enemy = hit.transform.GetComponent <Enemy>(); if (enemy != null) { enemy.TakeDamage(damage); } SimpleLife destruible = hit.transform.GetComponent <SimpleLife>(); if (destruible != null) { destruible.TakeDamage(damage); } } }
private void OnTriggerEnter(Collider other) { SimpleLife sl = other.GetComponent <SimpleLife>(); //Debug.Log(transform.parent.name + ": " + other.transform.parent.name); if (GetComponentInParent <CrowdEnemy>()) { if (other.tag == "Player" || (other.tag == foeTag && other.GetComponentInParent <CrowdElement>().elementEnabled)) { target = sl; attacking = true; //Debug.Log("BBBBBBBB"); } } else { if ((other.tag == foeTag) && sl && !sl.ded && target && target.tag != "Player") { target = sl; //Debug.Log(transform.parent.name + ": " + target.transform.parent.name); } } }
void OnEnable() { life = GetComponent <SimpleLife>(); //lifeBarContent = GameObject.FindGameObjectWithTag("UILife").GetComponent<Image>(); }