本文整理汇总了C#中Creature.breed方法的典型用法代码示例。如果您正苦于以下问题:C# Creature.breed方法的具体用法?C# Creature.breed怎么用?C# Creature.breed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Creature
的用法示例。
在下文中一共展示了Creature.breed方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Breed
public static void Breed(Creature c1, Creature c2)
{
Movement.GetTo(c1, c2.X, c2.Y, true);
Movement.GetTo(c2, c1.X, c1.Y, true);
if (c1.CanBreed > 0 && ((Math.Abs(c1.X - c2.X) == 1 && c1.Y == c2.Y) || (c1.X == c2.X && Math.Abs(c1.Y - c2.Y) == 1)))
{
c1.breed(c2);
}
}
示例2: BreedInPassing
private static void BreedInPassing(Creature c)
{
try
{
if (c.CanBreed > 0 && c.CurrentHealth >= 105)
{
int mateid = BaseAI.getCreatureAtLocation(c.X + 1, c.Y);
if (-1 != mateid && BaseAI.creatures[mateid].Owner == BaseAI.playerID() && BaseAI.creatures[mateid].CurrentHealth >= 105)
{
c.breed(BaseAI.creatures[mateid]);
}
else
{
mateid = BaseAI.getCreatureAtLocation(c.X - 1, c.Y);
if (-1 != mateid && BaseAI.creatures[mateid].Owner == BaseAI.playerID() && BaseAI.creatures[mateid].CurrentHealth >= 105)
{
c.breed(BaseAI.creatures[mateid]);
}
else
{
mateid = BaseAI.getCreatureAtLocation(c.X, c.Y + 1);
if (-1 != mateid && BaseAI.creatures[mateid].Owner == BaseAI.playerID() && BaseAI.creatures[mateid].CurrentHealth >= 105)
{
c.breed(BaseAI.creatures[mateid]);
}
else
{
mateid = BaseAI.getCreatureAtLocation(c.X, c.Y - 1);
if (-1 != mateid && BaseAI.creatures[mateid].Owner == BaseAI.playerID() && BaseAI.creatures[mateid].CurrentHealth >= 105)
{
c.breed(BaseAI.creatures[mateid]);
}
}
}
}
}
}
catch
{
Console.WriteLine("error in breedInPassingFn");
}
}