void Start() { zombieAnimation = GetComponent <Animator>(); dañoDelZombie = GetComponentInChildren <ZombieDamege>(); if (sombi) { zombieIa = GetComponent <ZombieIA>(); } if (enemigo) { enemyIa = GetComponent <Enemigo>(); } rbSombi = GetComponent <Rigidbody2D>(); }
private void fire(int num) { GameObject obj = new GameObject(); obj.AddComponent <LineShoot>(); obj.GetComponent <LineShoot>().CreateTrailLine(obj); if (Physics.Raycast(myCam.transform.position, myCam.transform.forward, out hit)) { ZombieIA take = hit.transform.GetComponent <ZombieIA>(); if (take != null) { take.TakeDamage(num); } } }