private void InitializeComponents() { mover = GetComponent <RootMover>(); hitStimulus = transform.parent.GetComponentInChildren <HitStimulus>(); _target = GameObject.FindWithTag(Tags.GameController).GetComponent <Target>(); player = GameObject.FindWithTag(Tags.Player).gameObject; }
private void InitialzeComponent() { mover = GetComponent <RootMover>(); destroyer = GetComponent <RootDestroyer>(); hitStimulus = transform.root.GetComponentInChildren <HitStimulus>(); timeSinceSpawnedInSeconds = 0; }
public virtual void Shoot(EnnemyController shooter) { if (CanShoot) { GameObject bullet = Instantiate(bulletPrefab, transform.position, transform.rotation); HitStimulus hitStimulus = bullet.GetComponentInChildren <HitStimulus>(); hitStimulus.HitPoints += damageModifier; hitStimulus.ShooterName = shooter.transform.root.name; lastTimeShotInSeconds = Time.time; } }
public override void Shoot(EnnemyController ennemyController) { if (CanShoot) { for (int i = 0; i < nbBullets; ++i) { GameObject bullet = Instantiate(bulletPrefab, transform.position, transform.rotation); HitStimulus hitStimulus = bullet.GetComponentInChildren <HitStimulus>(); hitStimulus.HitPoints += damageModifier; hitStimulus.ShooterName = ennemyController.transform.root.name; bullet.transform.Rotate(new Vector3(0, 0, angleEntreBalles * i - (angle / 2))); } lastTimeShotInSeconds = Time.time; } }