// Use this for initialization private void Start() { // get the components on the object we need ( should not be null due to require component so no need to check ) agent = GetComponentInChildren<NavMeshAgent>(); character = GetComponent<Enemy01>(); agent.updateRotation = false; agent.updatePosition = true; target = GameObject.FindGameObjectWithTag("Player").transform; }
void OnTriggerEnter2D(Collider2D collision) { Debug.Log(collision.name); Shooting shoot = GameObject.Find("Player").GetComponent <Shooting>(); Enemy01 enemy = collision.GetComponent <Enemy01>(); if (enemy != null) { enemy.TakeDamage(shoot.getWeaponDamage()); this.gameObject.SetActive(false); } }
public void Give_Damage(int attackType) { battleCam.SetActive(true); playerActionCam.SetActive(false); Enemy01.Damage(baseDamage, attackType); StartCoroutine(TempoDeEspera()); empatiaButton.SetActive(false); inteligenciaButton.SetActive(false); agressivoButton.SetActive(false); }
// Start is called before the first frame update void Start() { enemy01 = GameObject.FindWithTag("Enemy01"); enemy02 = GameObject.FindWithTag("Enemy02"); enemy03 = GameObject.FindWithTag("Enemy03"); enemy01rb = enemy01.GetComponent <Rigidbody2D>(); enemy02rb = enemy02.GetComponent <Rigidbody2D>(); enemy03rb = enemy03.GetComponent <Rigidbody2D>(); enemy01s = enemy01.GetComponent <Enemy01>(); enemy02s = enemy02.GetComponent <Enemy02>(); enemy03s = enemy03.GetComponent <Enemy03>(); enemy01anim = enemy01.GetComponent <Animator>(); enemy02anim = enemy02.GetComponent <Animator>(); enemy03anim = enemy03.GetComponent <Animator>(); }