Skip to content

Commit

Permalink
优化:黑龙潭移动方式改为点击无寻路和摇杆两种
Browse files Browse the repository at this point in the history
  • Loading branch information
qige2016 committed May 11, 2022
1 parent 03041dc commit 4f2a845
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
1 change: 1 addition & 0 deletions jyx2/Assets/BuildSource/RELEASE_NOTE.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
2022-05-09
优化:黑龙潭移动方式改为点击无寻路和摇杆两种
优化:移动端移动操作模式默认改为虚拟摇杆

2022-05-04
Expand Down
20 changes: 15 additions & 5 deletions jyx2/Assets/Scripts/LevelMaster.cs
Original file line number Diff line number Diff line change
Expand Up @@ -524,8 +524,6 @@ public void PlayerWarkFromTo(Vector3 fromVector, Vector3 toVector, Action callba

void OnClickControlPlayer()
{
if (_currentMap.IsNoNavAgent()) return;

SetPlayerSpeed(_playerNavAgent.velocity.magnitude);


Expand Down Expand Up @@ -564,9 +562,21 @@ void OnClickControlPlayer()
//BY CG: MASK:15:Ground层
else if (Physics.Raycast(ray, out hitInfo, 500, 1 << LayerMask.NameToLayer("Ground")))
{
_playerNavAgent.isStopped = false;
_playerNavAgent.updateRotation = true;
_playerNavAgent.SetDestination(hitInfo.point);
if (_currentMap.IsNoNavAgent())
{
var dest = hitInfo.point;
if (Vector3.Distance(_gameMapPlayer.transform.position, dest) < 0.1f) return;
var speed = GlobalAssetConfig.Instance.playerMoveSpeed;
_gameMapPlayer.transform.LookAt(new Vector3(dest.x, _gameMapPlayer.transform.position.y, dest.z));
_gameMapPlayer.transform.Translate(_gameMapPlayer.transform.forward * speed * Time.deltaTime, Space.World);
SetPlayerSpeed(speed);
}
else
{
_playerNavAgent.isStopped = false;
_playerNavAgent.updateRotation = true;
_playerNavAgent.SetDestination(hitInfo.point);
}

DisplayNavPointer(hitInfo.point);
}
Expand Down

0 comments on commit 4f2a845

Please sign in to comment.