浏览代码

refactor: Use var and fix formatting

/main
Luke Stampfli 4 年前
当前提交
92cd88a8
共有 2 个文件被更改,包括 8 次插入10 次删除
  1. 14
      Assets/BossRoom/Scripts/Server/Game/Action/ChaseAction.cs
  2. 4
      Assets/BossRoom/Scripts/Server/Navigation/DynamicNavPath.cs

14
Assets/BossRoom/Scripts/Server/Game/Action/ChaseAction.cs


{
if (!HasValidTarget())
{
Debug.Log("Failed to start ChaseAction. The target entity wasn't submitted or doesn't exist anymore" );
Debug.Log("Failed to start ChaseAction. The target entity wasn't submitted or doesn't exist anymore");
return false;
}

/// </summary>
private bool HasValidTarget()
{
return m_Data.TargetIds != null &&
m_Data.TargetIds.Length > 0 &&
return m_Data.TargetIds != null &&
m_Data.TargetIds.Length > 0 &&
MLAPI.Spawning.SpawnManager.SpawnedObjects.ContainsKey(m_Data.TargetIds[0]);
}

/// <returns>true to keep running, false to stop. The Action will stop by default when its duration expires, if it has a duration set. </returns>
public override bool Update()
{
float distToTarget2 = (m_Parent.transform.position - m_Target.transform.position).sqrMagnitude;
if( (m_Data.Amount*m_Data.Amount) > distToTarget2 )
var distToTargetSqr = (m_Parent.transform.position - m_Target.transform.position).sqrMagnitude;
if (m_Data.Amount * m_Data.Amount > distToTargetSqr)
{
//we made it! we're done.
Cancel();

{
m_Movement?.CancelMove();
}
}
}

4
Assets/BossRoom/Scripts/Server/Navigation/DynamicNavPath.cs


return Vector3.zero;
}
Vector3 currentPredictedPosition = m_Agent.transform.position;
float remainingDistance = distance;
var currentPredictedPosition = m_Agent.transform.position;
var remainingDistance = distance;
while (remainingDistance > 0)
{

正在加载...
取消
保存