浏览代码

waypoint index initial value

/main
Amel Negra 3 年前
当前提交
c95b063c
共有 1 个文件被更改,包括 2 次插入2 次删除
  1. 4
      UOP1_Project/Assets/Scripts/Characters/StateMachine/Actions/MovementActions/PathwayMovementAction.cs

4
UOP1_Project/Assets/Scripts/Characters/StateMachine/Actions/MovementActions/PathwayMovementAction.cs


{
_agent = agent;
_isActiveAgent = _agent != null && _agent.isActiveAndEnabled && _agent.isOnNavMesh;
_wayPointIndex = _wayPointIndex - 1; //Initialized to this value so we keep the right order from the waypoints list using the modulo method below
_wayPointIndex = - 1; //Initialized to -1 so we don't skip the first element from the waypoint list
_roamingSpeed = config.Speed;
_wayppoints = config.Waypoints;
}

_wayPointIndex = (_wayPointIndex + 1) % _wayppoints.Count;
nextDestination = _wayppoints[_wayPointIndex].waypoint;
}
//Debug.Log("the next destination" + nextDestination);
//Debug.Log("the next destination index = " +_wayPointIndex + "value = " + nextDestination);
return nextDestination;
}
}
正在加载...
取消
保存