本文整理汇总了C#中EnemyController.SetAggroState方法的典型用法代码示例。如果您正苦于以下问题:C# EnemyController.SetAggroState方法的具体用法?C# EnemyController.SetAggroState怎么用?C# EnemyController.SetAggroState使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EnemyController
的用法示例。
在下文中一共展示了EnemyController.SetAggroState方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MoveLogic
public Vector3 MoveLogic(EnemyController enemy, GameObject player)
{
if (LMHelper.IsInRange(enemy, player))
{
enemy.SetAggroState(true); //aggroed if within aggro range
float pm = enemy.GetPrevMvt().magnitude;
Vector3 mvt;
// If hitting a wall and moving slowly, take a detour sideways
// (prevents behavior if out in the open or if it happens to graze a wall while moving rapidly)
if (enemy.GetWallHit() && pm <= .05)
{
Vector3 direct = LMHelper.BaseMoveLogic(enemy, player); //first get direct approach
mvt = Vector3.Cross(direct, new Vector3(0f, 1f, 0f)); //cross with vertical to get left perpendicular
if (Time.time % 4 <= 0.02)
{
mvt *= -1; //flip direction every 5 seconds
}
mvt -= direct * (Random.value - 0.5f); //take random angle from straight perpendicular
mvt.Normalize(); //re-normalize
}
else // otherwise chase as normal
{
mvt = LMHelper.BaseMoveLogic(enemy, player);
}
return mvt;
}
enemy.SetAggroState(false);
return new Vector3(0f, 0f, 0f);
}
示例2: MoveLogic
public Vector3 MoveLogic(EnemyController enemy, GameObject player)
{
if (LMHelper.IsInRange(enemy, player))
{
enemy.SetAggroState(true); //aggroed if within aggro range
return LMHelper.BaseMoveLogic(enemy, player);
}
enemy.SetAggroState(false);
return new Vector3 (0f, 0f, 0f);
}
示例3: 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;
}
示例4: 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;
}
示例5: 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;
}