Example #1
0
    void Start()
    {
        attackZone = GetComponentInChildren <AttackZone>();
        attackZone.SetRadius(attackRadius);

        InitializeTimer();

        EventManager.AddPauseTimeListener(Pause);
        EventManager.AddTimeChangeListener(GoToTime);
        EventManager.AddReachedFinishListener(OnTargetLeft);
        EventManager.AddUnitDeadListener(OnTargetLeft);
    }
Example #2
0
    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>();
    }
Example #3
0
    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();
    }
Example #4
0
 public float GetAttackRange()
 {
     return(AttackZone.GetRadius());
 }