internal void TryStartFindingTarget() { if (this.UnitData.InitiatesBattle && CurrentHealth > 0) { var goal = new FindTargetToAttackHighLevelGoal(); goal.Owner = this; goal.AllUnits = AllUnits; goal.AllBuildings = AllBuildings; HighLevelGoals.Clear(); HighLevelGoals.Push(goal); } }
public void AssignAttackGoal(Unit enemy, bool replace = true) { var attackGoal = new AttackUnitHighLevelGoal(); attackGoal.TargetUnit = enemy; attackGoal.Owner = this; attackGoal.NodeNetwork = this.NodeNetwork; if (replace) { HighLevelGoals.Clear(); } HighLevelGoals.Push(attackGoal); }
/// <summary> /// Unit has a resource to return, but we don't have enough to restart a full resource collection goal (e.g., harvested item, then cancelled -> no prior resource destination available). /// </summary> public void AssignResourceReturnGoal(Vector3 clickPosition, Building targetReturnBuilding, Screens.ResourceType resourceType) { var returnResourceGoal = new ResourceReturnHighLevelGoal( owner: this, nodeNetwork: NodeNetwork, targetReturnBuilding: targetReturnBuilding ); if (ImmediateGoal?.Path != null) { ImmediateGoal.Path.Clear(); } HighLevelGoals.Clear(); HighLevelGoals.Push(returnResourceGoal); }
public AttackBuildingHighLevelGoal AssignAttackGoal(Building building, bool replace = true) { var attackGoal = new AttackBuildingHighLevelGoal(); attackGoal.TargetBuilding = building; attackGoal.Owner = this; attackGoal.AllUnits = this.AllUnits; attackGoal.NodeNetwork = this.NodeNetwork; if (replace) { HighLevelGoals.Clear(); } HighLevelGoals.Push(attackGoal); return(attackGoal); }
public void AssignResourceCollectGoal(Vector3 clickPosition, AxisAlignedRectangle resourceGroupTile, Screens.ResourceType resourceType) { var collectResourceGoal = new ResourceCollectHighLevelGoal( owner: this, nodeNetwork: NodeNetwork, clickPosition: clickPosition, targetResourceMergedTile: resourceGroupTile, targetResourceType: resourceType, allBuildings: AllBuildings ); if (ImmediateGoal?.Path != null) { ImmediateGoal.Path.Clear(); } HighLevelGoals.Clear(); HighLevelGoals.Push(collectResourceGoal); }