void EvaluateSnippets() { //Stores the highest score int highestScore = 0; CombatSnippet newSnippet = _combatBehaviours[0]; //Cycles through each snippet and evaluates them foreach (CombatSnippet behavior in _combatBehaviours) { int score = behavior.Evaluate(); //Checks which snippet is optimal if (score > highestScore) { highestScore = score; newSnippet = behavior; } } //Debug.Log("Switching snippet to: " + newSnippet.ToString()); //Switches to the new snippet SwitchSnippets(newSnippet); }
private void SwitchSnippets(CombatSnippet newSnippet) { if (_currentSnippet == newSnippet) { return; } _currentSnippet = newSnippet; if (_currentSnippet != null) { _currentSnippet.EnterSnippet(); } }
private void RegisterSnippet(CombatSnippet snippet) { snippet.Initialize(_agent); _combatBehaviours.Add(snippet); }