private List <Target> GetGroupTargets(Combatant actor, FactionMap combatants) { var targets = new List <Target>(); switch (validTargets) { case ETargetType.Enemies: foreach (var faction in combatants) { if (faction.Key != actor.Faction) { AddGroupTarget(faction.Value, targets); } } break; case ETargetType.Allies: AddGroupTarget(combatants[actor.Faction], targets); break; case ETargetType.Both: foreach (var faction in combatants.Values) { AddGroupTarget(faction, targets); } break; default: break; } return(targets); }
public override void Setup(FactionMap factionMap) { this.factionMap = factionMap; actionMenu.Populate( Actor, actionData => SelectTarget(actionData) ); stateMachine.SetState(actionMenuState); }
private FactionMap GenerateFactionMap(EncounterRoster roster) { var factionMap = new FactionMap { { HERO_FACTION, baseCombatant.Spawn(roster.Heroes, HERO_FACTION, transform) }, { ENEMY_FACTION, baseCombatant.Spawn(roster.Enemies, ENEMY_FACTION, transform) } }; return(factionMap); }
public void Populate(ActionData actionData, Combatant owner, FactionMap factionMap, TargetSelectDelegate selectionDelegate) { var targets = actionData.Targeter.GetTargets(owner, factionMap); var selectorPrefab = actionData.Targeter.SelectorPrefab; foreach (var target in targets) { var selector = Instantiate(selectorPrefab, transform); selector.Populate(target, selectionDelegate); selector.transform.localScale = selectorPrefab.transform.localScale; activeSelectors.AddLast(selector); } }
private void Start() { var heroes = combatantPrefab.Spawn(roster.Heroes, Encounter.HERO_FACTION, transform); var enemies = combatantPrefab.Spawn(roster.Enemies, Encounter.ENEMY_FACTION, transform); factionMap = new FactionMap { { Encounter.HERO_FACTION, heroes }, { Encounter.ENEMY_FACTION, enemies } }; arena.Populate(factionMap); InvokeRepeating("ShuffleHeroes", 1.0f, 1f); InvokeRepeating("ShuffleEnemies", 1.5f, 1f); }
public override void Populate(FactionMap combatants) { if (heroRegion != null || enemyRegion != null) { Debug.LogWarning("Should not be populating an arena more than once: Use an 'add' method"); return; } var heroes = combatants[Encounter.HERO_FACTION]; var enemies = combatants[Encounter.ENEMY_FACTION]; heroRegion = Instantiate(SelectRegion(heroRegionPrefabs, heroes.Count), transform); enemyRegion = Instantiate(SelectRegion(enemyRegionPrefabs, enemies.Count), transform); heroRegion.Populate(heroes); enemyRegion.Populate(enemies); }
// Initializer public void Populate(EncounterRoster roster, Arena arenaPrefab) // Eventually should add 'Script' { animationQueue = GetComponentInChildren <AnimationQueue>(); combatants = GenerateFactionMap(roster); turnCounter = new TurnCounter <Combatant>( (a, b) => b.Character.Speed.Current.CompareTo(a.Character.Speed.Current) ); turnCounter.Add(combatants[HERO_FACTION]); turnCounter.Add(combatants[ENEMY_FACTION]); turnCounter.Reset(); arena = Instantiate(arenaPrefab, transform); arena.Populate(combatants); stateEngine = new StateEngine <Encounter>(this, new SetupState()); }
private List <Target> GetAllTarget(FactionMap combatants) { var targetableCombatants = new List <Combatant>(); foreach (var faction in combatants.Values) { foreach (var combatant in faction) { if (CanTarget(combatant)) { targetableCombatants.Add(combatant); } } } return(new List <Target> { new Target(targetableCombatants) }); }
public List <Target> GetTargets(Combatant actor, FactionMap combatants) { switch (targetingRange) { case EGroupType.Self: return(GetSelfTarget(actor)); case EGroupType.Single: return(GetSingleTargets(actor, combatants)); case EGroupType.Group: return(GetGroupTargets(actor, combatants)); case EGroupType.All: return(GetAllTarget(combatants)); default: return(new List <Target>()); } }
public override void Cleanup() { factionMap = null; selectedAction = null; stateMachine.SetState(null); }
public override void Cleanup() { factionMap = null; }
public override void Setup(FactionMap factionMap) { this.factionMap = factionMap; }
public abstract void Populate(FactionMap combatants);
public abstract void Setup(FactionMap factionMap);