Esempio n. 1
0
    private void MoveEntityTowards(Vector3 endPosition)
    {
        this.transform.rotation = Quaternion.LookRotation(endPosition - this.transform.position);
        this.transform.rotation = Quaternion.Euler(0, this.transform.rotation.eulerAngles.y, 0);

        if (Vector2.Distance(EndPosition.XZ(), this.transform.position.XZ()) > 0.3f && endPosition.sqrMagnitude > 1f)
        {
            this.transform.position += transform.forward * Time.deltaTime * MovementSpeed;
        }
    }