public Team(string[] args) { foreach (var arg in args) { if (arg.ToLower().StartsWith("teamname=")) { var results = arg.Split(new string[] { "=" }, StringSplitOptions.RemoveEmptyEntries); m_teamName = results[1]; } if (arg.ToLower().StartsWith("strategy=")) { var results = arg.Split(new string[] { "=" }, StringSplitOptions.RemoveEmptyEntries); m_stratgey = (Strategies)Enum.Parse(typeof(Strategies), results[1]); } } if (m_teamName is null) { m_teamName = SoccerParams.m_teamName; } m_coach = new Coach(); m_teamFormation = new Formation_4_4_2(); m_playerList = m_teamFormation.InitTeam(m_stratgey, this, m_coach); }
public void ThrowFormationAction(IPlayer specifiedPlayer, IFormation formation) { EndCountDown(); var cardBoxes = formation.Cards.Select(p => new CardBox() { CardCode = p.Code, ImageLocation = GetImgLocation(p.Code) }).ToList(); if (specifiedPlayer == this.Player) { this.pnlCurrentDesk.CardBoxes = cardBoxes; this.pnlRightDesk.RemoveCardBoxes(c => true); this.lblCurrentState.Hide(); this.lblRightPass.Hide(); this.pnlCurrent.RemoveCardBoxes(c => formation.Cards.Any(p => p.Code == c.CardCode)); this.btnCurrentTakeOut.Enabled = false; this.btnCurrentPassby.Enabled = false; } else if (specifiedPlayer == this.PlayerLeft) { this.pnlLeftDesk.CardBoxes = cardBoxes; this.pnlCurrentDesk.RemoveCardBoxes(c => true); this.lblCurrentState.Hide(); this.lblLeftPass.Hide(); } else if (specifiedPlayer == this.PlayerRight) { this.pnlRightDesk.CardBoxes = cardBoxes; this.pnlLeftDesk.RemoveCardBoxes(c => true); this.lblRightPass.Hide(); this.lblLeftPass.Hide(); } }
private void OnUserTakeoutFormation(CircularlyLinkedNode <IPlayer> player, IFormation formation) { if (UserPrepared != null) { PlayerTakeoutFormation(this, new PlayerTakeoutFormationEventArgs(player, formation)); } }
/// <summary> /// Transfers the formation from an old group to a new one (used only in Portalling). /// </summary> /// <param name="formation">The formation to transfer.</param> /// <param name="expectedCount">The expected group member count.</param> /// <param name="oldGroup">The old group to transfer from.</param> public void TransferFormation(IFormation formation, int expectedCount, DefaultSteeringTransientUnitGroup oldGroup) { if (this.count == 0 || expectedCount == 0 || formation == null || oldGroup == null) { return; } if (_formationPositions == null) { // if the formation positions list is null, then make it now _formationPositions = new DynamicArray <Vector3>(expectedCount); } else { // if the formation positions list is not null, just clear it _formationPositions.Clear(); } // set formation reference _currentFormation = formation; // populate formation positions list with formation positions for (int i = 0; i < expectedCount; i++) { _formationPositions.Add(formation.GetFormationPosition(expectedCount, i, oldGroup[i])); } }
private void OnUserTakeoutFormation(IFormation formation) { if (PlayerPrepared != null) { var e = new GameViewTakeoutFormationEventArgs(this, formation); PlayerTakeoutFormation(this, e); } }
public ActiveFormation(IFormation formation, ICellPosition formationPosition, IToolBox toolBox) { this.Formation = formation; this.Position = formationPosition; this.ToolBox = toolBox; this.InitializeInstructions(); }
public void UpdateTarget(IFormation formation) { if (CachedAi.DurationNotFollowingTarget > standFor) { // set a new target formation.UpdateBreadcrumbs(CachedAi); } }
public void Add(IFormation formation) { foreach (var kvp in formation) { Add(kvp.Key, kvp.Value); } OnUnitUpdated(); }
/// <summary> /// Sets a formation for all groups in a grouping. /// </summary> /// <typeparam name="T"></typeparam> /// <param name="grouping">The grouping.</param> /// <param name="formation">The formation.</param> public static void SetFormation <T>(this IGrouping <T> grouping, IFormation formation) where T : IGroupable <T> { var groupCount = grouping.groupCount; for (int i = 0; i < groupCount; i++) { grouping[i].SetFormation(formation); } }
private IFormation GetRandomFormation(IFormation skip) { var form = skip; do { var idx = Random.Range(0, 6); form = GetFormation(idx); }while (form.GetType() == skip.GetType()); return(form); }
public void RemoveFromFormation_WhenDoesntHaveFormation_ReturnsFailureAndDoesNotModifyTroop( IFormation sourceFormation, SimpleStub unitsToRemove, SimpleStub troopStub) { troopStub.AddUnit(FormationType.Normal, 100, 200); unitsToRemove.AddUnit(FormationType.Attack, 100, 10); troopStub.RemoveFromFormation(FormationType.Attack, unitsToRemove).Should().BeFalse(); troopStub.TotalCount.Should().Be(200); }
public void RemoveFromFormation_WhenTroopHasUnitsButNotInSpecifiedFormation_ReturnsFalseAndDoesNotModifyTroop( IFormation sourceFormation, SimpleStub unitsToRemove, SimpleStub troopStub) { troopStub.AddUnit(FormationType.Defense, 100, 200); unitsToRemove.AddUnit(FormationType.Attack, 100, 150); troopStub.RemoveFromFormation(FormationType.Normal, unitsToRemove).Should().BeFalse(); troopStub[FormationType.Defense][100].Should().Be(200); }
private void SetFormation(IFormation formation) { var selected = GameServices.gameStateManager.unitSelection.selected; if (formation != null) { selected.SetFormation(formation); } else { selected.ClearFormation(); } }
public void RemoveFromFormation_WhenSourceHasSameUnitsInDifferentFormationsAndTroopDoesNotHaveEnough_ReturnsFalseAndDoesNotModifyTroop( IFormation sourceFormation, SimpleStub unitsToRemove, SimpleStub troopStub) { troopStub.AddUnit(FormationType.Normal, 100, 200); unitsToRemove.AddUnit(FormationType.Attack, 100, 150); unitsToRemove.AddUnit(FormationType.Defense, 100, 150); troopStub.RemoveFromFormation(FormationType.Normal, unitsToRemove).Should().BeFalse(); troopStub[FormationType.Normal][100].Should().Be(200); }
public void RemoveFromFormation_WhenSourceHasSameUnitsInDifferentFormationsAndTroopDoesHasEnough_ReturnsTrueAndRemovesUnits( IFormation sourceFormation, SimpleStub unitsToRemove, SimpleStub troopStub) { troopStub.AddUnit(FormationType.Normal, 100, 310); unitsToRemove.AddUnit(FormationType.Attack, 100, 150); unitsToRemove.AddUnit(FormationType.Defense, 100, 150); troopStub.RemoveFromFormation(FormationType.Normal, unitsToRemove).Should().BeTrue(); troopStub[FormationType.Normal][100].Should().Be(10); }
public void RemoveFromFormation_WhenHasEnoughUnits_ReturnsTrueAndRemovesUnitsFromCorrectFormation( IFormation sourceFormation, SimpleStub unitsToRemove, SimpleStub troopStub) { troopStub.AddUnit(FormationType.Normal, 100, 200); troopStub.AddUnit(FormationType.Normal, 101, 100); unitsToRemove.AddUnit(FormationType.Attack, 100, 10); unitsToRemove.AddUnit(FormationType.Defense, 101, 10); troopStub.RemoveFromFormation(FormationType.Normal, unitsToRemove).Should().BeTrue(); troopStub[FormationType.Normal][100].Should().Be(190); troopStub[FormationType.Normal][101].Should().Be(90); }
public Team(string[] args) { foreach (var arg in args) { if (arg.ToLower().StartsWith("teamname=")) { var results = arg.Split(new string[] { "=" }, StringSplitOptions.RemoveEmptyEntries); m_teamName = results[1]; } } if (m_teamName is null) { m_teamName = SoccerParams.m_teamName; } m_coach = new Coach(); m_teamFormation = new EnglandFormation(); m_playerList = m_teamFormation.InitTeam(this, m_coach); }
/// <summary> /// Sets the currently active formation. /// </summary> /// <param name="formation">The desired formation.</param> public override void SetFormation(IFormation formation) { if (this.count == 0) { // no group members, exit early return; } if (_formationPositions == null) { // if the formation positions list is null, then make it now _formationPositions = new DynamicArray <Vector3>(count); } else { // if the formation positions list is not null, just clear it _formationPositions.Clear(); } if (formation == null) { // if formation passed was null, treat it as a formation clearing _currentFormation = null; return; } // set formation reference _currentFormation = formation; // prepare the group for movement PrepareForAction(); // populate formation positions list with formation positions for (int i = 0; i < count; i++) { this[i].hasArrivedAtDestination = false; _formationPositions.Add(formation.GetFormationPosition(count, i, this[i])); } SetupFormationIndices(); }
private void SetFormation(IFormation formation) { var selected = GameServices.gameStateManager.unitSelection.selected; for (int i = 0; i < selected.groupCount; i++) { var selectedGroup = selected[i]; if (selectedGroup == null) { continue; } if (formation != null) { selectedGroup.SetFormation(formation); } else { selectedGroup.ClearFormation(); } } }
/// <summary> /// Sets the currently active formation. /// </summary> /// <param name="formation">The desired formation.</param> public virtual void SetFormation(IFormation formation) { /* NOOP by default */ }
/// <summary> /// Transfers the formation from an old group to a new one (used only in Portalling). /// </summary> /// <param name="formation">The formation to transfer.</param> /// <param name="expectedCount">The expected group member count.</param> /// <param name="oldGroup">The old group to transfer from.</param> public void TransferFormation(IFormation formation, int expectedCount, DefaultSteeringTransientUnitGroup oldGroup) { if (this.count == 0 || expectedCount == 0 || formation == null || oldGroup == null) { return; } if (_formationPositions == null) { // if the formation positions list is null, then make it now _formationPositions = new DynamicArray<Vector3>(expectedCount); } else { // if the formation positions list is not null, just clear it _formationPositions.Clear(); } // set formation reference _currentFormation = formation; // populate formation positions list with formation positions for (int i = 0; i < expectedCount; i++) { _formationPositions.Add(formation.GetFormationPosition(expectedCount, i, oldGroup[i])); } }
public void ExpelFormation(IFormation formation) { _cards.RemoveAll(p => formation.Cards.Any(f => f.Code == p.Code)); }
/// <summary> /// Sets the currently active formation. /// </summary> /// <param name="formation">The desired formation.</param> public override void SetFormation(IFormation formation) { if (this.count == 0) { // no group members, exit early return; } if (_formationPositions == null) { // if the formation positions list is null, then make it now _formationPositions = new DynamicArray<Vector3>(count); } else { // if the formation positions list is not null, just clear it _formationPositions.Clear(); } if (formation == null) { // if formation passed was null, treat it as a formation clearing _currentFormation = null; return; } // set formation reference _currentFormation = formation; // prepare the group for movement PrepareForAction(); // populate formation positions list with formation positions for (int i = 0; i < count; i++) { this[i].hasArrivedAtDestination = false; _formationPositions.Add(formation.GetFormationPosition(count, i, this[i])); } SetupFormationIndices(); }
public WedgeFormation(IFormation owner) : base(owner) { }
public void UpdateScriptReferences() { StartPointScript = GetComponent <IStartPoint>(); SpawnerScript = GetComponent <ISpawner>(); FormationScript = GetComponent <IFormation>(); }
public RoundInfo(IPlayer player, IFormation formation) { _player = player; _formation = formation; }
private void InitFormation() { switch( _data.Formation ) { case "3er": _formation = new Formation3(); break; case "10er": _formation = new Formation3(); break; default: throw new Exception("No formation named " + _data.Formation + " defined"); } }
public override IFormationArrangement Clone(IFormation formation) => (IFormationArrangement) new WedgeFormation(formation);
public TransposedLineFormation(IFormation owner) : base(owner) { this.IsStaggered = false; this.IsTransforming = true; }
private bool TryGetValue(FormationType formationType, out IFormation formation) { return(Data.TryGetValue(formationType, out formation)); }
public override IFormationArrangement Clone(IFormation formation) => (IFormationArrangement) new TransposedLineFormation(formation);
public static void Add(IPlayer player, IFormation formation) { var round = new RoundInfo(player, formation); Add(round); }
private static void Clone(ref IFormationArrangement __result, IFormation formation) { __result = new SkeinFormation(formation); }