// Start is called before the first frame update void Start() { _radius = _numPlayers <= 2 ? 5 : 6; Utils.setNumPlayers(_numPlayers, _radius); fieldManager = new FieldManager(); initiativeQueue = new InitiativeQueue(_numPlayers, 128); }
public void StartNewRound() { iqueue = new InitiativeQueue(this); foreach (var item in leftArmy.BattleUnitsStacks) { item.canRetaliate = true; } foreach (var item in rightArmy.BattleUnitsStacks) { item.canRetaliate = true; } }
public void Initialize(Army armyA, Army armyB) { left = armyA; right = armyB; leftArmy = new BattleArmy(armyA); rightArmy = new BattleArmy(armyB); foreach (var item in leftArmy.BattleUnitsStacks) { item.Side = leftArmy; } foreach (var item in rightArmy.BattleUnitsStacks) { item.Side = rightArmy; } iqueue = new InitiativeQueue(this); }
public void max_init_never_exceeds_threshold_by_much() { IInitiativeQueue queue = new InitiativeQueue( 100, new[] { new TestInitActor() { Init = 10 }, new TestInitActor() { Init = 10 }, new TestInitActor() { Init = 10 }, new TestInitActor() { Init = 10 }, new TestInitActor() { Init = 10 } }); float initLimit = 115; for (int i = 0; i < 1000; i++) { foreach ((uint _, float initiative) in queue.GetCurrentQueue()) { Assert.Less(initiative, initLimit); } IInitiativeActor nextActor = queue.GetNext(); queue.Update(nextActor.Id, 100); } }