private void FixedUpdate() { if (m_HealthScript.IsDead()) { return; } if (curBatAction == BatAction.FollowPoints) { if (distanceToPoint(getCurTarget()) < 0.1f) { getNextTargetIndex(); } if ((curTargetIndex == 0) && (listDir == -1)) { curBatAction = BatAction.RandomPoints; randomCount = 0; } } else if (curBatAction == BatAction.RandomPoints) { if (distanceToPoint(getCurTarget()) < 0.1f) { curTargetIndex = Random.Range(0, targets.Count); randomCount++; } if (randomCount >= 5) { curBatAction = BatAction.Sweep; curTargetIndex = 0; } } else if (curBatAction == BatAction.Sweep) { if (distanceToPoint(getCurTarget()) < 0.1f) { getNextTargetIndex(); } if (curTargetIndex >= 2) { curBatAction = BatAction.FollowPoints; curTargetIndex = 0; listDir = 1; } } MoveTowardPoint(getCurTarget()); }
protected override void Start() { base.Start(); curBatAction = BatAction.FollowPoints; m_HealthScript.onDeathDelegate += onDeath; }