本文整理汇总了C#中GameObjects.TroopDetail.MilitaryKind类的典型用法代码示例。如果您正苦于以下问题:C# MilitaryKind类的具体用法?C# MilitaryKind怎么用?C# MilitaryKind使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MilitaryKind类属于GameObjects.TroopDetail命名空间,在下文中一共展示了MilitaryKind类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Create
public static Military Create(GameScenario scenario, Architecture architecture, MilitaryKind kind)
{
Military military = new Military();
military.Scenario = scenario;
military.KindID = kind.ID;
military.ID = scenario.Militaries.GetFreeGameObjectID();
if (kind.RecruitLimit == 1)
{
military.Name = kind.Name;
}
else
{
military.Name = kind.Name + "队";
}
architecture.AddMilitary(military);
architecture.BelongedFaction.AddMilitary(military);
scenario.Militaries.AddMilitary(military);
architecture.DecreaseFund((int) (kind.CreateCost * kind.GetRateOfNewMilitary(architecture)));
if (kind.IsTransport)
{
military.Quantity = kind.MaxScale;
military.Morale = military.MoraleCeiling;
military.Combativity = military.CombativityCeiling;
}
return military;
}
示例2: GetCostByPosition
private int GetCostByPosition(Point position, bool oblique, int DirectionCost, MilitaryKind kind)
{
if (this.OnGetCost != null)
{
return this.OnGetCost(position, oblique, DirectionCost, kind);
}
return 0xdac;
}
示例3: AddMilitaryKind
public bool AddMilitaryKind(MilitaryKind militaryKind)
{
if (this.MilitaryKinds.ContainsKey(militaryKind.ID))
{
return false;
}
this.MilitaryKinds.Add(militaryKind.ID, militaryKind);
return true;
}
示例4: BuildFirstTierSimulatePath
private List<Point> BuildFirstTierSimulatePath(Point start, Point end, MilitaryKind kind)
{
if (this.firstTierPathFinder.GetPath(start, end, kind))
{
List<Point> path = new List<Point>();
this.firstTierPathFinder.SetPath(path);
return path;
}
return null;
}
示例5: BuildModifyFirstTierPath
private bool BuildModifyFirstTierPath(Point start, Point end, List<Point> middlePath, MilitaryKind kind)
{
if (this.firstTierPathFinder.GetPath(start, end, kind))
{
this.firstTierPathFinder.SetPath(middlePath);
return true;
}
middlePath = null;
return false;
}
示例6: CheckAdjacentSquares
private void CheckAdjacentSquares(GameSquare currentSquare, Point end, bool useAStar, MilitaryKind kind)
{
int leftSquareCost = this.MakeSquare(currentSquare, false, new Point(currentSquare.Position.X - 1, currentSquare.Position.Y), end, -1, useAStar, kind);
int topSquareCost = this.MakeSquare(currentSquare, false, new Point(currentSquare.Position.X, currentSquare.Position.Y - 1), end, -1, useAStar, kind);
int rightSquareCost = this.MakeSquare(currentSquare, false, new Point(currentSquare.Position.X + 1, currentSquare.Position.Y), end, -1, useAStar, kind);
int bottomSquareCost = this.MakeSquare(currentSquare, false, new Point(currentSquare.Position.X, currentSquare.Position.Y + 1), end, -1, useAStar, kind);
this.MakeSquare(currentSquare, true, new Point(currentSquare.Position.X - 1, currentSquare.Position.Y - 1), end, (topSquareCost > leftSquareCost) ? topSquareCost : leftSquareCost, useAStar, kind);
this.MakeSquare(currentSquare, true, new Point(currentSquare.Position.X - 1, currentSquare.Position.Y + 1), end, (bottomSquareCost > leftSquareCost) ? bottomSquareCost : leftSquareCost, useAStar, kind);
this.MakeSquare(currentSquare, true, new Point(currentSquare.Position.X + 1, currentSquare.Position.Y - 1), end, (topSquareCost > rightSquareCost) ? topSquareCost : rightSquareCost, useAStar, kind);
this.MakeSquare(currentSquare, true, new Point(currentSquare.Position.X + 1, currentSquare.Position.Y + 1), end, (bottomSquareCost > rightSquareCost) ? bottomSquareCost : rightSquareCost, useAStar, kind);
}
示例7: BuildFirstTierPath
private bool BuildFirstTierPath(Point start, Point end, MilitaryKind kind)
{
this.troop.ClearFirstTierPath();
if (end == this.troop.Destination)
{
this.troop.ClearSecondTierPath();
}
if (this.firstTierPathFinder.GetPath(start, end, kind))
{
this.troop.FirstTierPath = new List<Point>();
this.firstTierPathFinder.SetPath(this.troop.FirstTierPath);
}
else
{
this.troop.Destination = this.troop.Position;
}
return true;
}
示例8: findSuccessorRecruitable_r
private MilitaryKind findSuccessorRecruitable_r(MilitaryKindList allMilitaryKinds, Architecture recruiter, MilitaryKind prev)
{
if (prev.successor.GetMilitaryKindList().Count == 0)
{
return prev;
}
prev.findSuccessor_visited = true;
MilitaryKindList toVisit = new MilitaryKindList();
foreach (MilitaryKind i in prev.successor.GetMilitaryKindList())
{
if (!i.findSuccessor_visited && recruiter.GetNewMilitaryKindList().GameObjects.Contains(i) && allMilitaryKinds.GetList().GameObjects.Contains(i))
{
toVisit.Add(i);
}
}
if (toVisit.Count == 0)
{
return prev;
}
return findSuccessorRecruitable_r(allMilitaryKinds, recruiter, toVisit[GameObject.Random(toVisit.Count)] as MilitaryKind);
}
示例9: CanRecruitMilitary
public bool CanRecruitMilitary(MilitaryKind mk)
{
crlm_recurse_level = 0;
return CanRecruitLowerMilitary_r(mk);
}
示例10: SimCreate
public static Military SimCreate(GameScenario scenario, Architecture architecture, MilitaryKind kind)
{
Military military = new Military();
military.Scenario = scenario;
military.KindID = kind.ID;
military.ID = scenario.Militaries.GetFreeGameObjectID();
if (kind.RecruitLimit == 1)
{
military.Name = kind.Name;
return military;
}
military.Name = kind.Name + "队";
return military;
}
示例11: MakeSquare
private int MakeSquare(GameSquare currentSquare, bool oblique, Point position, Point end, int DirectionCost, bool useAStar, MilitaryKind kind)
{
int num = this.GetCostByPosition(position, oblique, DirectionCost, kind);
if (!this.IsInCloseList(position) && (num < 0xdac))
{
GameSquare square = new GameSquare();
int num2;
if (oblique)
{
num2 = currentSquare.RealG + (7 * num);
}
else
{
num2 = currentSquare.RealG + (5 * num);
}
GameSquare squareFromOpenList = this.GetSquareFromOpenList(position);
if (squareFromOpenList == null)
{
square.Parent = currentSquare;
square.Position = position;
square.PenalizedCost = this.GetPenalizedCostByPosition(position, kind);
if (useAStar)
square.H = distance(position, end);
square.RealG = num2;
this.AddToOpenList(square, useAStar);
}
else if (num2 < squareFromOpenList.RealG)
{
openDictionary.Remove(position);
if (useAStar)
openList.Remove(squareFromOpenList.F * 160000 + (squareFromOpenList.Position.X * 400 + squareFromOpenList.Position.Y));
else
openList.Remove(squareFromOpenList.G * 160000 + (squareFromOpenList.Position.X * 400 + squareFromOpenList.Position.Y));
square.Parent = currentSquare;
square.Position = position;
square.PenalizedCost = this.GetPenalizedCostByPosition(position, kind);
if (useAStar)
square.H = distance(position, end);
square.RealG = num2;
this.AddToOpenList(square, useAStar);
}
}
return num;
}
示例12: LoadFromDatabase
//.........这里部分代码省略.........
catch
{
TitleKind tk = new TitleKind();
tk.ID = 1;
tk.Name = "个人称号";
tk.Combat = false;
tk.StudyDay = 90;
this.AllTitleKinds.AddTitleKind(tk);
tk = new TitleKind();
tk.ID = 2;
tk.Name = "战斗称号";
tk.Combat = true;
tk.StudyDay = 90;
this.AllTitleKinds.AddTitleKind(tk);
titleKindShift = 1;
}
connection.Close();
connection.Open();
reader = new OleDbCommand("Select * From Title", connection).ExecuteReader();
while (reader.Read())
{
Title title = new Title();
title.ID = (short)reader["ID"];
title.Kind = this.AllTitleKinds.GetTitleKind((short)reader["Kind"] + titleKindShift);
title.Level = (short)reader["Level"];
title.Combat = (bool)reader["Combat"];
title.Name = reader["Name"].ToString();
title.Influences.LoadFromString(this.AllInfluences, reader["Influences"].ToString());
title.Conditions.LoadFromString(this.AllConditions, reader["Conditions"].ToString());
this.AllTitles.AddTitle(title);
}
connection.Close();
connection.Open();
reader = new OleDbCommand("Select * From MilitaryKind", connection).ExecuteReader();
while (reader.Read())
{
MilitaryKind militaryKind = new MilitaryKind();
militaryKind.ID = (short)reader["ID"];
militaryKind.Type = (MilitaryType)((short)reader["Type"]);
militaryKind.Name = reader["Name"].ToString();
militaryKind.Description = reader["Description"].ToString();
militaryKind.Merit = (short)reader["Merit"];
militaryKind.Speed = (short)reader["Speed"];
militaryKind.TitleInfluence = (short)reader["TitleInfluence"];
militaryKind.CreateCost = (int)reader["CreateCost"];
militaryKind.CreateTechnology = (int)reader["CreateTechnology"];
militaryKind.IsShell = (bool)reader["IsShell"];
militaryKind.CreateBesideWater = (bool)reader["CreateBesideWater"];
militaryKind.Offence = (short)reader["Offence"];
militaryKind.Defence = (short)reader["Defence"];
militaryKind.OffenceRadius = (short)reader["OffenceRadius"];
militaryKind.CounterOffence = (bool)reader["CounterOffence"];
militaryKind.BeCountered = (bool)reader["BeCountered"];
militaryKind.ObliqueOffence = (bool)reader["ObliqueOffence"];
militaryKind.ArrowOffence = (bool)reader["ArrowOffence"];
militaryKind.AirOffence = (bool)reader["AirOffence"];
militaryKind.ContactOffence = (bool)reader["ContactOffence"];
militaryKind.OffenceOnlyBeforeMove = (bool)reader["OffenceOnlyBeforeMove"];
militaryKind.ArchitectureDamageRate = (float)reader["ArchitectureDamageRate"];
militaryKind.ArchitectureCounterDamageRate = (float)reader["ArchitectureCounterDamageRate"];
militaryKind.StratagemRadius = (short)reader["StratagemRadius"];
militaryKind.ObliqueStratagem = (bool)reader["ObliqueStratagem"];
militaryKind.ViewRadius = (short)reader["ViewRadius"];
militaryKind.ObliqueView = (bool)reader["ObliqueView"];
militaryKind.Movability = (short)reader["Movability"];
militaryKind.OneAdaptabilityKind = (short)reader["OneAdaptabilityKind"];
示例13: NextPositionCost
private int NextPositionCost(Point currentPosition, Point nextPosition, MilitaryKind kind)
{
int num = 0;
int num2 = 0;
int num3 = 0;
switch ((nextPosition.X - currentPosition.X))
{
case -1:
switch ((nextPosition.Y - currentPosition.Y))
{
case -1:
num = this.GetCostByPosition(new Point(currentPosition.X - 1, currentPosition.Y), false, -1, kind);
num2 = this.GetCostByPosition(new Point(currentPosition.X, currentPosition.Y - 1), false, -1, kind);
return (this.GetCostByPosition(nextPosition, true, (num > num2) ? num : num2, kind) * 7);
case 0:
return (this.GetCostByPosition(nextPosition, false, -1, kind) * 5);
case 1:
num = this.GetCostByPosition(new Point(currentPosition.X - 1, currentPosition.Y), false, -1, kind);
num2 = this.GetCostByPosition(new Point(currentPosition.X, currentPosition.Y + 1), false, -1, kind);
return (this.GetCostByPosition(nextPosition, true, (num > num2) ? num : num2, kind) * 7);
}
return num3;
case 0:
switch ((nextPosition.Y - currentPosition.Y))
{
case -1:
return (this.GetCostByPosition(nextPosition, false, -1, kind) * 5);
case 0:
return 0xdac;
case 1:
return (this.GetCostByPosition(nextPosition, false, -1, kind) * 5);
}
return num3;
case 1:
switch ((nextPosition.Y - currentPosition.Y))
{
case -1:
num = this.GetCostByPosition(new Point(currentPosition.X + 1, currentPosition.Y), false, -1, kind);
num2 = this.GetCostByPosition(new Point(currentPosition.X, currentPosition.Y - 1), false, -1, kind);
return (this.GetCostByPosition(nextPosition, true, (num > num2) ? num : num2, kind) * 7);
case 0:
return (this.GetCostByPosition(nextPosition, false, -1, kind) * 5);
case 1:
num = this.GetCostByPosition(new Point(currentPosition.X + 1, currentPosition.Y), false, -1, kind);
num2 = this.GetCostByPosition(new Point(currentPosition.X, currentPosition.Y + 1), false, -1, kind);
return (this.GetCostByPosition(nextPosition, true, (num > num2) ? num : num2, kind) * 7);
}
return num3;
}
return num3;
}
示例14: LoadMilitaryKind
public List<string> LoadMilitaryKind(OleDbConnection connection, GameScenario scen)
{
List<string> errorMsg = new List<string>();
connection.Open();
OleDbDataReader reader = new OleDbCommand("Select * From MilitaryKind", connection).ExecuteReader();
while (reader.Read())
{
List<string> e = new List<string>();
MilitaryKind militaryKind = new MilitaryKind();
militaryKind.Scenario = scen;
militaryKind.ID = (short)reader["ID"];
militaryKind.Type = (MilitaryType)((short)reader["Type"]);
militaryKind.Name = reader["Name"].ToString();
militaryKind.Description = reader["Description"].ToString();
militaryKind.Merit = (short)reader["Merit"];
try
{
militaryKind.ObtainProb = (int)reader["ObtainProb"];
}
catch
{
militaryKind.ObtainProb = 0;
}
militaryKind.Speed = (short)reader["Speed"];
militaryKind.TitleInfluence = (short)reader["TitleInfluence"];
militaryKind.CreateCost = (int)reader["CreateCost"];
militaryKind.CreateTechnology = (int)reader["CreateTechnology"];
militaryKind.IsShell = (bool)reader["IsShell"];
militaryKind.CreateBesideWater = (bool)reader["CreateBesideWater"];
militaryKind.Offence = (short)reader["Offence"];
militaryKind.Defence = (short)reader["Defence"];
militaryKind.OffenceRadius = (short)reader["OffenceRadius"];
militaryKind.CounterOffence = (bool)reader["CounterOffence"];
militaryKind.BeCountered = (bool)reader["BeCountered"];
militaryKind.ObliqueOffence = (bool)reader["ObliqueOffence"];
militaryKind.ArrowOffence = (bool)reader["ArrowOffence"];
militaryKind.AirOffence = (bool)reader["AirOffence"];
militaryKind.ContactOffence = (bool)reader["ContactOffence"];
militaryKind.OffenceOnlyBeforeMove = (bool)reader["OffenceOnlyBeforeMove"];
militaryKind.ArchitectureDamageRate = (float)reader["ArchitectureDamageRate"];
militaryKind.ArchitectureCounterDamageRate = (float)reader["ArchitectureCounterDamageRate"];
militaryKind.StratagemRadius = (short)reader["StratagemRadius"];
militaryKind.ObliqueStratagem = (bool)reader["ObliqueStratagem"];
militaryKind.ViewRadius = (short)reader["ViewRadius"];
militaryKind.ObliqueView = (bool)reader["ObliqueView"];
militaryKind.Movability = (short)reader["Movability"];
militaryKind.OneAdaptabilityKind = (short)reader["OneAdaptabilityKind"];
militaryKind.PlainAdaptability = (short)reader["PlainAdaptability"];
militaryKind.GrasslandAdaptability = (short)reader["GrasslandAdaptability"];
militaryKind.ForrestAdaptability = (short)reader["ForrestAdaptability"];
militaryKind.MarshAdaptability = (short)reader["MarshAdaptability"];
militaryKind.MountainAdaptability = (short)reader["MountainAdaptability"];
militaryKind.WaterAdaptability = (short)reader["WaterAdaptability"];
militaryKind.RidgeAdaptability = (short)reader["RidgeAdaptability"];
militaryKind.WastelandAdaptability = (short)reader["WastelandAdaptability"];
militaryKind.DesertAdaptability = (short)reader["DesertAdaptability"];
militaryKind.CliffAdaptability = (short)reader["CliffAdaptability"];
militaryKind.PlainRate = (float)reader["PlainRate"];
militaryKind.GrasslandRate = (float)reader["GrasslandRate"];
militaryKind.ForrestRate = (float)reader["ForrestRate"];
militaryKind.MarshRate = (float)reader["MarshRate"];
militaryKind.MountainRate = (float)reader["MountainRate"];
militaryKind.WaterRate = (float)reader["WaterRate"];
militaryKind.RidgeRate = (float)reader["RidgeRate"];
militaryKind.WastelandRate = (float)reader["WastelandRate"];
militaryKind.DesertRate = (float)reader["DesertRate"];
militaryKind.CliffRate = (float)reader["CliffRate"];
militaryKind.InjuryChance = (short)reader["InjuryRate"];
try
{
militaryKind.FireDamageRate = (float)reader["FireDamageRate"];
militaryKind.RecruitLimit = (int)reader["RecruitLimit"];
}
catch
{
try
{
militaryKind.FireDamageRate = (bool)reader["AfraidOfFire"] ? 3.0f : 1.0f;
militaryKind.RecruitLimit = (bool)reader["Unique"] ? 1 : 1000;
}
catch
{
militaryKind.FireDamageRate = 1.0f;
militaryKind.RecruitLimit = 10000;
}
}
militaryKind.FoodPerSoldier = (short)reader["FoodPerSoldier"];
militaryKind.RationDays = (int)reader["RationDays"];
militaryKind.PointsPerSoldier = (int)reader["PointsPerSoldier"];
militaryKind.MinScale = (int)reader["MinScale"];
militaryKind.MaxScale = (int)reader["MaxScale"];
militaryKind.OffencePerScale = (short)reader["OffencePerScale"];
militaryKind.DefencePerScale = (short)reader["DefencePerScale"];
militaryKind.CanLevelUp = (bool)reader["CanLevelUp"];
StaticMethods.LoadFromString(militaryKind.LevelUpKindID, reader["LevelUpKindID"].ToString());
militaryKind.LevelUpKindID.RemoveAll(i => i == -1);
militaryKind.LevelUpExperience = (int)reader["LevelUpExperience"];
militaryKind.OffencePer100Experience = (short)reader["OffencePer100Experience"];
//.........这里部分代码省略.........
示例15: GetMapCost
public int GetMapCost(Troop troop, Point position, MilitaryKind kind)
{
if (base.Scenario.PositionOutOfRange(position))
{
return 0xdac;
}
if (base.Scenario.GetTerrainDetailByPositionNoCheck(position).RoutewayConsumptionRate >= 1)
{
return 0xdac;
}
int terrainAdaptability = 0;
if (base.Scenario.GetArchitectureByPositionNoCheck(position) == null)
{
terrainAdaptability = troop.GetTerrainAdaptability((TerrainKind) this.mapData[position.X, position.Y]);
}
int waterPunishment = 0;
if (this.mapData[position.X, position.Y] == 6 && kind.Type != MilitaryType.水军 && base.Scenario.GetArchitectureByPositionNoCheck(position) == null)
{
waterPunishment = 3;
}
return ((terrainAdaptability + base.Scenario.GetWaterPositionMapCost(kind.Type, position)) + base.Scenario.GetPositionMapCost(this, position) + waterPunishment);
}