private void Start() { if (!staticEnemy) { ActiveState = SkeletonState.PATROL; target = patrol.GetNewWaipoint(new Vector3(Mathf.Infinity, Mathf.Infinity, Mathf.Infinity)); nav.SetDestination(target); } else { ActiveState = SkeletonState.RETURNING_TO_POSITION; target = hold.ReturnToPosition(); nav.SetDestination(target); } angularSpeedBase = nav.angularSpeed; nextAtack = attackList.GetNextAttack(); destructionTime += Random.value * destructionTime; //randomice the destrucction time; }
IEnumerator WaitEndFrameToStartIA() { yield return(new WaitForEndOfFrame()); if (GameManager.instance.GetOnCombat()) { activeState = EnemyState.COMBAT; } else if (!staticEnemy) { activeState = EnemyState.PATROL; if (target == new Vector3(float.MaxValue, float.MaxValue, float.MaxValue)) { target = patrol.GetNewWaipoint(target); } nav.SetDestination(target); } else { activeState = EnemyState.RETURNING_TO_POSITION; target = hold.ReturnToPosition(); nav.SetDestination(target); } }