本文整理汇总了C#中GameObjects.GameArea类的典型用法代码示例。如果您正苦于以下问题:C# GameArea类的具体用法?C# GameArea怎么用?C# GameArea使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GameArea类属于GameObjects命名空间,在下文中一共展示了GameArea类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CheckPoint
private static void CheckPoint(GameArea Area, List<Point> BlackAngles, Point point, GameScenario Scenario, Faction faction)
{
TerrainDetail terrainDetailByPosition = Scenario.GetTerrainDetailByPosition(point);
if (terrainDetailByPosition != null)
{
if (terrainDetailByPosition.ViewThrough)
{
if (faction != null)
{
Architecture architectureByPosition = Scenario.GetArchitectureByPosition(point);
if (!(architectureByPosition == null || architectureByPosition.Endurance <= 0 || faction.IsFriendlyWithoutTruce(architectureByPosition.BelongedFaction)))
{
BlackAngles.Add(point);
return;
}
}
if (!IsInBlackAngle(Area.Centre, BlackAngles, point))
{
Area.AddPoint(point);
}
}
else
{
BlackAngles.Add(point);
}
}
}
示例2: GetCreditWithPosition
public override int GetCreditWithPosition(Troop source, out Point? position)
{
//position = 0;
position = new Point(0, 0);
TroopList hostileTroopsInView = source.GetHostileTroopsInView();
TroopList list2 = new TroopList();
foreach (Troop troop in hostileTroopsInView)
{
if ((troop.IsInArchitecture || !troop.DaysToReachPosition(source.Position, 1)) || (troop.Army.Kind.Type == MilitaryType.水军))
{
list2.Add(troop);
}
}
foreach (Troop troop in list2)
{
hostileTroopsInView.Remove(troop);
}
if (hostileTroopsInView.Count == 0)
{
return 0;
}
List<Point> orientations = new List<Point>();
int num = 0;
foreach (Troop troop in hostileTroopsInView)
{
orientations.Add(troop.Position);
num += troop.FightingForce;
}
int num2 = 0;
int fightingForce = source.FightingForce;
int num4 = source.TroopIntelligence + source.ChanceIncrementOfStratagem;
if (num4 > 100)
{
num4 = 100;
}
num2 = (((GameObject.Square(num4) / 60) * num) / fightingForce) / 100;
if (num2 > 0)
{
GameArea area = new GameArea();
foreach (Point point in source.GetStratagemArea(source.Position).Area)
{
if (!source.Scenario.PositionIsOnFire(point) && (source.Scenario.IsPositionEmpty(point) && source.Scenario.IsFireVaild(point, false, MilitaryType.步兵)))
{
area.Area.Add(point);
}
}
if (area.Count > 0)
{
position = source.Scenario.GetClosestPosition(area, orientations);
}
else
{
num2 = 0;
}
}
return num2;
}
示例3: CombineArea
public void CombineArea(GameArea AreaToCombine, Dictionary<Point, object> ClosedList)
{
foreach (Point point in AreaToCombine.Area)
{
if (!ClosedList.ContainsKey(point))
{
ClosedList.Add(point, null);
}
}
}
示例4: GetAreaFromArea
public static GameArea GetAreaFromArea(GameArea area, int Radius, bool Oblique, GameScenario Scenario, Faction faction)
{
Dictionary<Point, object> closedList = new Dictionary<Point, object>();
GameArea area2 = new GameArea();
foreach (Point point in area.Area)
{
area2.CombineArea(GetViewArea(point, Radius, Oblique, Scenario, faction), closedList);
}
foreach (Point point in closedList.Keys)
{
area2.Area.Add(point);
}
return area2;
}
示例5: GetDayArea
public GameArea GetDayArea(Troop troop, int Days)
{
GameArea area = new GameArea();
openDictionary.Clear();
openList.Clear();
closeDictionary.Clear();
closeList.Clear();
GameSquare square = new GameSquare();
square.Position = troop.Position;
this.AddToCloseList(square);
int num = troop.Movability * Days;
int movabilityLeft = troop.MovabilityLeft;
//int num3 = troop.RealMovability * Days;
troop.MovabilityLeft = num;
MilitaryKind kind = troop.Army.Kind;
do
{
CheckAdjacentSquares(square, troop.Position, false, kind);
if (this.openList.Count == 0)
{
break;
}
square = this.AddToCloseList();
if (square == null)
{
break;
}
if (num >= square.G)
{
if (!troop.Scenario.PositionIsTroop(square.Position))
{
area.AddPoint(square.Position);
}
}
else
{
break;
}
if (closeList.Count > 2500 || closeDictionary.Count > 2500) break;
} while (true);
troop.MovabilityLeft = movabilityLeft;
saveLastPath();
openDictionary.Clear();
openList.Clear();
closeDictionary.Clear();
closeList.Clear();
return area;
}
示例6: GetArea
public static GameArea GetArea(Point Centre, int Radius, bool Oblique)
{
GameArea area = new GameArea();
List<float> list = new List<float>();
area.Centre = Centre;
for (int i = -Radius; i <= Radius; i++)
{
for (int j = -Radius; j <= Radius; j++)
{
if (Oblique)
{
area.AddPoint(new Point(Centre.X + i, Centre.Y + j));
}
else if ((Math.Abs(i) + Math.Abs(j)) <= Radius)
{
area.AddPoint(new Point(Centre.X + i, Centre.Y + j));
}
}
}
return area;
}
示例7: GetArea
public static GameArea GetArea(Point Centre, int Radius, bool Oblique)
{
GameArea area = new GameArea();
List<float> list = new List<float>();
area.Centre = Centre;
if (Oblique)
{
for (int i = Centre.X - Radius; i <= Centre.X + Radius; i++)
{
for (int j = Centre.Y - Radius; j <= Centre.Y + Radius; j++)
{
area.AddPoint(new Point(i, j));
}
}
}
else
{
for (int i = -Radius; i <= Radius; i++)
{
if (i <= 0)
{
for (int j = -Radius - i; j <= i + Radius; j++)
{
area.AddPoint(new Point(Centre.X + i, Centre.Y + j));
}
}
else
{
for (int j = i - Radius; j <= Radius - i; j++)
{
area.AddPoint(new Point(Centre.X + i, Centre.Y + j));
}
}
}
}
return area;
}
示例8: IsActiveInArea
public bool IsActiveInArea(GameArea area, out float minRate)
{
minRate = 1f;
bool flag = false;
LinkedListNode<RoutePoint> activeNode = null;
foreach (Point point in area.Area)
{
activeNode = this.GetActiveNode(point);
if (activeNode != null)
{
flag = true;
if (activeNode.Value.ConsumptionRate < minRate)
{
minRate = activeNode.Value.ConsumptionRate;
}
}
}
return flag;
}
示例9: SetLongViewArea
public void SetLongViewArea(GameArea area)
{
this.longViewArea = area;
}
示例10: HasRelationUnderZeroHostileTroopsInView
public bool HasRelationUnderZeroHostileTroopsInView()
{
if (this.BelongedFaction != null)
{
GameArea viewArea = this.ViewArea;
if (this.Kind.HasLongView && (this.ArmyScale < this.NormalArmyScale))
{
viewArea = this.LongViewArea;
}
foreach (Point point in viewArea.Area)
{
Troop troopByPosition = base.Scenario.GetTroopByPosition(point);
if ((((troopByPosition != null) && (troopByPosition.BelongedFaction != null)) && (troopByPosition.Status != TroopStatus.埋伏)) && (base.Scenario.GetDiplomaticRelation(this.BelongedFaction.ID, troopByPosition.BelongedFaction.ID) < 0))
{
return true;
}
}
}
return false;
}
示例11: GetTroopEnterableArea
public GameArea GetTroopEnterableArea(Troop troop)
{
GameArea area = new GameArea();
foreach (Point point in this.ArchitectureArea.Area)
{
if (base.Scenario.GetWaterPositionMapCost(troop.Army.Kind.Type, point) < 3500)
{
area.AddPoint(point);
}
}
foreach (Point point in this.ContactArea.Area)
{
if (troop.IsMovableOnPosition(point) && (base.Scenario.GetWaterPositionMapCost(troop.Army.Kind.Type, point) < 3500))
{
area.AddPoint(point);
}
}
return area;
}
示例12: GetRoutewayStartPoints
public GameArea GetRoutewayStartPoints()
{
GameArea area = new GameArea();
foreach (Point point in this.GetRoutewayStartArea().Area)
{
if (this.IsRoutewayPossible(point))
{
area.AddPoint(point);
}
}
if (area.Count == 0)
{
foreach (Point point in this.ContactArea.Area)
{
if (this.IsRoutewayPossible(point))
{
area.AddPoint(point);
}
}
}
if (area.Count == 0)
{
foreach (Point point in this.LongViewArea.Area)
{
if (this.IsRoutewayPossible(point))
{
area.AddPoint(point);
}
}
}
return area;
}
示例13: GetAvailableContactArea
public GameArea GetAvailableContactArea(bool Square)
{
GameArea area = new GameArea();
foreach (Point point in this.ContactArea.Area)
{
if (base.Scenario.IsPositionEmpty(point))
{
area.AddPoint(point);
}
}
if (area.Count > 0)
{
return area;
}
return null;
}
示例14: GetAllContactArea
public GameArea GetAllContactArea()
{
GameArea area = new GameArea();
foreach (Point point in this.ContactArea.Area)
{
area.AddPoint(point);
}
foreach (Point point in this.ArchitectureArea.Area)
{
area.AddPoint(point);
}
return area;
}
示例15: GetPersonTransferArchitectureArea
public GameArea GetPersonTransferArchitectureArea()
{
GameArea area = new GameArea();
foreach (Architecture architecture in this.BelongedFaction.Architectures)
{
if (architecture == this)
{
continue;
}
foreach (Point point in architecture.ArchitectureArea.Area)
{
area.AddPoint(point);
}
}
return area;
}