本文整理汇总了C#中Monster.setAIParameter方法的典型用法代码示例。如果您正苦于以下问题:C# Monster.setAIParameter方法的具体用法?C# Monster.setAIParameter怎么用?C# Monster.setAIParameter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Monster
的用法示例。
在下文中一共展示了Monster.setAIParameter方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: followerAI
public static void followerAI(Monster monster, Quinoa quinoa)
{
int targetX = quinoa.getPlayer().x;
int targetY = quinoa.getPlayer().y;
if (monster.readyForCommand())
{
//check if the player is adjacent, if so then attack
if (quinoa.monsterIsAdjacent(monster.x, monster.y, MonsterActionManager.PLAYER_ID))
{
MonsterActionManager.setAttackCommand(monster, MonsterActionManager.PLAYER_ID);
}
else
{
if (monster.getAIParameter("altmove") != null)
{
if (monster.getAIParameter("altmove").Equals("0"))
{
monster.setAIParameter("altmove", "1");
}
else
{
monster.setAIParameter("altmove", "0");
}
}
else
{
monster.setAIParameter("altmove", "0");
}
if (monster.getAIParameter("altmove").Equals("0"))
{
if (monster.x < targetX)
{
MonsterActionManager.setMoveCommand(monster, Direction.E);
}
else if (monster.x > targetX)
{
MonsterActionManager.setMoveCommand(monster, Direction.W);
}
else if (monster.y < targetY)
{
MonsterActionManager.setMoveCommand(monster, Direction.S);
}
else if (monster.y > targetY)
{
MonsterActionManager.setMoveCommand(monster, Direction.N);
}
}
else
{
if (monster.y < targetY)
{
MonsterActionManager.setMoveCommand(monster, Direction.S);
}
else if (monster.y > targetY)
{
MonsterActionManager.setMoveCommand(monster, Direction.N);
}
else if (monster.x < targetX)
{
MonsterActionManager.setMoveCommand(monster, Direction.E);
}
else if (monster.x > targetX)
{
MonsterActionManager.setMoveCommand(monster, Direction.W);
}
}
}
}
}
示例2: pathingAI
public static void pathingAI(Monster monster, Quinoa quinoa)
{
if (monster.readyForCommand())
{
String searchIntervalStr = monster.getAIParameter("searchInterval");
if (searchIntervalStr != null)
{
int searchInterval = Int32.Parse(searchIntervalStr);
if (searchInterval > 0)
{
searchInterval = searchInterval - 1;
monster.setAIParameter("searchInterval", searchInterval + "");
//followerAI(monster, quinoa);
return;
}
else
{
monster.setAIParameter("searchInterval", "3");
}
}
else
{
monster.setAIParameter("searchInterval", "3");
}
List<Position> path = quinoa.getPathFinder().findPath(quinoa.getCurrentRegionHeader().getRegion(), 50, monster, monster.x, monster.y, quinoa.getPlayer().x, quinoa.getPlayer().y);
if (path != null && path.Count > 1)
{
Position pos = path[1];
if (pos.y > monster.y)
{
MonsterActionManager.setMoveCommand(monster, Direction.S);
}
else if (pos.y < monster.y)
{
MonsterActionManager.setMoveCommand(monster, Direction.N);
}
else if (pos.x > monster.x)
{
MonsterActionManager.setMoveCommand(monster, Direction.E);
}
else if (pos.x < monster.x)
{
MonsterActionManager.setMoveCommand(monster, Direction.W);
}
}
}
}