Beispiel #1
0
    IEnumerator DoPlayerMove(MapRole player, Vector3 target)
    {
        var dist = (target - player.transform.position).magnitude;

        if (dist < 0.1f) //eqaul zero
        {
            yield break;
        }

        float time = (float)(dist / m_BattleMoveSpeed);

        if (!player.IsPlayingMovingAnimation)
        {
            player.Run(); //如果不是这样,则每次移动一格,移动动画会重新开始播放
            player.IsPlayingMovingAnimation = true;
        }

        player.transform.LookAt(new Vector3(target.x, player.transform.position.y, target.z)); //转身
        var tweener = player.transform.DOMove(target, time).SetEase(Ease.Linear).OnComplete(() => { });

        yield return(new WaitForSeconds(time));
    }
Beispiel #2
0
 void DoSwitchMove()
 {
     Debug.Log("do switch move");
     player.Run();
 }