Esempio n. 1
0
    // Update is called once per frame
    override protected void UpdateUnit()
    {
        if (isFrozen)
        {
            currentTimeFrozen += Time.deltaTime;
            if (currentTimeFrozen > timeFrozenThreshold)
            {
                isFrozen = false;
                GetComponent <SpriteRenderer>().color = Color.white;
                currentTimeFrozen = 0;
            }
            return;
        }
        base.UpdateUnit();

        IEnemyUnitState state;

        state = unitTargetingState.CheckChangeState(this, _playManager);
        if (state != null)
        {
            unitTargetingState = state;
        }
        unitTargetingState.Update(this, _playManager);

        state = unitState.CheckChangeState(this, _playManager);
        if (state != null)
        {
            unitState = state;
        }
        unitState.Update(this, _playManager);
    }
Esempio n. 2
0
    //public float biteRadius;

    // Start is called before the first frame update
    override protected void StartUnit()
    {
        base.StartUnit();

        unitState          = new IdleEnemyUnitState();
        unitTargetingState = new ClosestTargetingEnemyUnitState();

        transform.rotation = Quaternion.Euler(0, 0, 180);
    }