コード例 #1
0
ファイル: UCharacterView.cs プロジェクト: useada/ARPG-Game
    void IBattleCharacter.MoveTo(UVector3 position)
    {
        if (!Agent || !Agent.enabled)
        {
            return;
        }
        IsStop = false;
        this.Agent.Resume();
        var pos = position.ToUVer3();

        UnityEngine.AI.NavMeshHit hit;
        if (UnityEngine.AI.NavMesh.SamplePosition(pos, out hit, 10000, this.Agent.areaMask))
        {
            targetPos = hit.position;
        }
        else
        {
            return;
        }

        if (Vector3.Distance(targetPos.Value, this.transform.position) < 0.2f)
        {
            stopMove();
            return;
        }
        this.Agent.SetDestination(targetPos.Value);
    }
コード例 #2
0
ファイル: UCharacterView.cs プロジェクト: useada/ARPG-Game
 void IBattleCharacter.SetPosition(UVector3 pos)
 {
     this.transform.localPosition = pos.ToUVer3();
 }
コード例 #3
0
ファイル: UCharacterView.cs プロジェクト: useada/ARPG-Game
 void IBattleCharacter.SetForward(UVector3 forward)
 {
     this.transform.forward = forward.ToUVer3();
 }