public override void End(ControlledDivision Host) { RememberedDivision CommanderSendingOrder = GetRememberedDivisionFromHost(Host, CommanderSendingOrderId); RememberedDivision commander = Host.RememberedDivisions[CommanderSendingOrder.DivisionId]; Host.ReceiveOrder(new FindDivision(Host, _visibleTarget.DivisionId, commander.DivisionId)); Host.ReceiveOrder(new MergeDivisions(Host, commander.DivisionId, commander.DivisionId)); base.End(Host); }
public void Resupply(ControlledDivision Host) { //find closest supply dump Func <TerrainMapTile, bool> findSupplyTile = tile => { return(tile.Supply > 100); }; //UnityEngine.Profiling.Profiler.BeginSample("find supply"); //find closest supply if (Host.TryFindKnownTileMatchingPred(findSupplyTile, out Vector3 foundPosition)) { //Debug.Log($"resupply position : {foundPosition}"); this.ReceiveOrder(Host, new Move(Host, Host.DivisionId, foundPosition)); var supplyOrder = new GatherSuppliesOrder(Host, Host.DivisionId); // add the supply to Host Host.ReceiveOrder(supplyOrder); this.ReceiveOrder(Host, new WaitOrder(Host, Host.DivisionId, 2, x => { x.CancelOrder(supplyOrder.orderId); })); } else { RandomMove(Host); } //UnityEngine.Profiling.Profiler.EndSample(); }
public void Recruit(ControlledDivision Host) { Func <TerrainMapTile, bool> findPopTile = tile => { return(tile.Population > 100); }; //Debug.Log($"trying to recruit"); //find closest populations if (Host.TryFindKnownTileMatchingPred(findPopTile, out Vector3 foundPosition)) { //Debug.Log($"resupply position : {foundPosition}"); this.ReceiveOrder(Host, new Move(Host, Host.DivisionId, foundPosition)); // add the recruit to Host var recruitOrder = new RecruitOrder(Host, Host.DivisionId); Host.ReceiveOrder(recruitOrder); this.ReceiveOrder(Host, new WaitOrder(Host, Host.DivisionId, 2, x => { x.CancelOrder(recruitOrder.orderId); })); } else { RandomMove(Host); } }