本文整理汇总了C#中EnemyController.GetAggroRadius方法的典型用法代码示例。如果您正苦于以下问题:C# EnemyController.GetAggroRadius方法的具体用法?C# EnemyController.GetAggroRadius怎么用?C# EnemyController.GetAggroRadius使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EnemyController
的用法示例。
在下文中一共展示了EnemyController.GetAggroRadius方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MoveLogic
public Vector3 MoveLogic(EnemyController enemy, GameObject player)
{
float dist = LMHelper.GetDistance(enemy, player);
Vector3 mvt = new Vector3(0f, 0f, 0f);
enemy.SetStationary(true);
// Aggro if in range
if (dist <= enemy.GetAggroRadius())
{
enemy.SetAggroState(true);
}
else {
enemy.SetAggroState(false);
}
return mvt;
}
示例2: MoveLogic
public Vector3 MoveLogic(EnemyController enemy, GameObject player)
{
float dist = LMHelper.GetDistance(enemy, player);
Vector3 mvt = new Vector3(0f, 0f, 0f);
// If in aggro range, set aggro state to true
if (dist <= enemy.GetAggroRadius())
{
enemy.SetAggroState(true);
//if not already strafing or reached strafe target, setup new one
if (Strafing == false || distST < 5) {
Strafing = true;
//Raycast out in direction of player
Vector3 dir = LMHelper.BaseMoveLogic(enemy, player);
this.transform.forward = dir;
RaycastHit hit;
float tdist = 0;
if (Physics.Raycast(this.transform.position, dir, out hit))
{
tdist = hit.distance;
}
StrafeTarget = this.transform.position + dir * tdist;
mvt = dir;
}
//else, continue along strafing path towards target
else
{
mvt = (StrafeTarget - this.transform.position).normalized;
}
}
else {
enemy.SetAggroState(false);
Strafing = false;
}
//Debug.Log(Strafing + "," + StrafeTarget + "," + mvt);
return mvt;
}
示例3: MoveLogic
public Vector3 MoveLogic(EnemyController enemy, GameObject player)
{
float dist = LMHelper.GetDistance(enemy, player);
float optrng = enemy.GetOptimalRange();
float delta = dist - optrng; //difference from optimal range
Vector3 mvt = new Vector3(0f, 0f, 0f);
// If out of range, move into range
if (dist <= enemy.GetAggroRadius())
{
enemy.SetAggroState(true);
if (delta > 0) {
mvt = LMHelper.BaseMoveLogic(enemy, player);
mvt *= delta / (1.5f * optrng);
}
}
else {
enemy.SetAggroState(false);
}
return mvt;
}
示例4: IsInRange
//Checks whether target is in range
public static bool IsInRange(EnemyController enemy, GameObject player)
{
float dist = GetDistance(enemy, player);
return dist <= enemy.GetAggroRadius();
}