void Start() { attackZone = GetComponentInChildren <AttackZone>(); attackZone.SetRadius(attackRadius); InitializeTimer(); EventManager.AddPauseTimeListener(Pause); EventManager.AddTimeChangeListener(GoToTime); EventManager.AddReachedFinishListener(OnTargetLeft); EventManager.AddUnitDeadListener(OnTargetLeft); }
protected virtual void Awake() { // The id will identify the enemy in the scene. Id = new EnemyId(transform.position); // Awake gets called immediately when instantiating a Unity object in the scene. // We set the persistence here so that anything that instantiates this can change it in the same frame. IsPersistent = true; _animator = new EnemyAnimator(GetComponent <Animator>()); _attackZone = GetComponentInChildren <AttackZone>(); _rigidBody = GetComponent <Rigidbody2D>(); _physicalHitBox = GetComponent <Collider2D>(); }
private void Awake() { if (Instance == null) { Instance = this; DontDestroyOnLoad(gameObject); } else if (Instance != this) { Destroy(gameObject); } _rb = GetComponent <Rigidbody>(); zone = attackZone.GetComponent <AttackZone>(); Izone = InteractZone.GetComponent <InteractionZone>(); InteractSprite.SetActive(false); attackZone.SetActive(false); Hud.TransiOut(); }
public float GetAttackRange() { return(AttackZone.GetRadius()); }