本文整理汇总了C#中Enemy.LookAt方法的典型用法代码示例。如果您正苦于以下问题:C# Enemy.LookAt方法的具体用法?C# Enemy.LookAt怎么用?C# Enemy.LookAt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Enemy
的用法示例。
在下文中一共展示了Enemy.LookAt方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CalculateAction
public override void CalculateAction(Enemy e)
{
if (_path == null)
{
WayPoint start = SearchNearest(e.LocationBehavior.Position);
WayPoint target = SearchNearest(_walkTo);
if (start == null || target == null)
{
e.Activity = new NoActivity();
return;
}
_path = PathFinder.FindePath(start, target);
}
WayPoint next = Main.MainObject.GameManager.GameState.Karte.WayPoints[_path.ID];
if (Vector2.Distance(next.Location.Position, e.LocationBehavior.Position) < next.Location.Size.X)
{
if (_path.NextNode != null)
_path = _path.NextNode;
}
else
{
e.LookAt(next.Location.Position);
Move(e);
}
}
示例2: DoActivity
// Tue die Action
public override void DoActivity(Enemy e)
{
// laufe zu nächstem pfad
if (_lookAtNextNode)
{
PathNode next = _currentPath;
// schaue zu nächstem wegpunkt
if (next != null)
e.LookAt(next.WayPoint.Location.Position);
}
// schaue auf player
if (_lookAtPlayer)
{
e.LookAt(_player.LocationBehavior.Position);
}
// greife an
if (_attack && Main.MainObject.GameManager.GameState.Player.IsAlive)
{
e.Attack();
}
// laufe gerade aus (richtung wp)
if (_walk)
{
Vector2 moved = Move(e);
_walkedDistance = (float)(moved.Length() / Main.GameTimeUpdate.ElapsedGameTime.TotalSeconds);
}
}