private void FindViableTargets(string group) { targets.Clear(); combatants.ForEach(entity => { // If the entity isn't in our group, add them to targets if (entity.tag != group) { IHealth <int> entityHealth = entity.GetComponent <IHealth <int> >(); if (!entityHealth.IsDead) { targets.Add(entity); } } }); if (targets.Count == 0) { bsm.Change(BattleState.Loot); } }
public void OnEnter() { Debug.Log("Enter combat"); // We'll take the combat groups the game controller have collected, // adding them to our own list of combatants foreach (KeyValuePair <CombatGroup, GameObject> combatant in gameController.combatGroups) { actors.Add(combatant.Value); } // Initation of combat SetCombatReadiness(true); // TODO: Sort actors by speed, so the fastest one will get the first turn // First turn bsm.Change(BattleState.Turn); }
public void Update() { // If the execution time of this action has passed, // e.g animations and everything is done, we'll execute the next turn if (Time.time >= (executionStart + action.ExecutionTime)) { bsm.Change(BattleState.Turn); return; } if (!inProgress) { inProgress = true; // TODO: Start attack animation for actor //Animator actorAnimator = action.Actor.GetComponent<Animator>(); // TODO: Fix so the target takes damage somwwhere in the animation IHealth <int> targetHealth = action.Target.GetComponent <IHealth <int> >(); targetHealth.TakeDamage(20); } }