private void Move() { float xDiff = _destination.x - _gameObject.transform.position.x; float zDiff = _destination.z - _gameObject.transform.position.z; float angle = Mathf.Atan2(zDiff, xDiff); float x = (float)Math.Cos(angle); float z = (float)Math.Sin(angle); _mover.Move(x, z); }
private void Move(float h, float v) { /* * if(h != 0) * h = (h < 0 ? -1 : 1); * * if(v != 0) * v = (v < 0 ? -1 : 1); */ _mover.Move(h, v); }