public override void OnLiveUpdate()
        {
            base.OnLiveUpdate();

            // 순찰(구현은 일단 심플하게 해둠)
            if (this.target == null && this.patrolPositions.Length > 0)
            {
                if (this.patrolDeltaTime <= 0)
                {
                    // 인덱스 초과하면 0부터 시작
                    this.patrolIndex++;
                    if (this.patrolIndex >= this.patrolPositions.Length)
                    {
                        this.patrolIndex = 0;
                    }

                    // 유닛 이동
                    this.patrolDeltaTime = 5;
                }
                else
                {
                    this.patrolDeltaTime -= TimeManager.deltaTime;
                }

                MoveTargetUpdate(this.patrolPositions[this.patrolIndex], 0.1f);
            }

            // 보스 상태바 활성화 조건
            // 보스 상태바가 없고 &&  타겟이 존재하며 && 타겟이 플레이어일경우
            if (this.unit.isBoss && this.bossStatusBar == null && this.target != null && this.target.controller is PlayerController)
            {
                this.bossStatusBar = StageMaster.current.playerController.hud.LoadBossStatusBar(this.unit);
            }

            // 타겟이 죽었으면 비움
            if (this.target != null && this.target.unitState == UnitState.Death)
            {
                SetTarget(null);
            }
        }
        public override void OnDie()
        {
            base.OnDie();

            // 체력표시용 UI들 비활성화!
            if (this.unitStatusBar != null)
            {
                ObjectPoolManager.inst.Return(this.unitStatusBar.gameObject);
            }

            if (this.bossStatusBar != null)
            {
                this.bossStatusBar.gameObject.SetActive(false);
            }

            this.unitStatusBar = null;
            this.bossStatusBar = null;

            // 그룹에 등록되어 있을 경우, 그룹에서 제외한다
            if (!string.IsNullOrEmpty(this.aggroGroupKey))
            {
                _aggroGroups[this.aggroGroupKey].Remove(this);
            }
        }
Exemple #3
0
 private void Awake()
 {
     current = this;
     this.gameObject.SetActive(false);
 }