public void DecideAction() { //todo -- if time elapsed || activeAction.IsComplete; AIAction[] actions = activeBehavior.actions; activeAction = null; float maxScore = float.MinValue; int length = actions.Length; for (int i = 0; i < length; i++) { AIAction action = actions[i]; float score = action.Score(activeContext, maxScore); if (score > maxScore) { maxScore = score; activeAction = action; } } Debug.Assert(activeAction != null, nameof(activeAction) + " != null"); activeAction.SetContext(activeContext); activeAction.OnSetup(); }
public AIInfo(int entityId) { this.entityId = entityId; this.lastDecisionTime = 0; this.decisionDuration = 0; this.action = null; this.decisions = null; }