因此,由于我仍然想在 12 月之前创建一个简单的 Pac-Man 克隆,我目前正在自学 C# 以使用 XNA Game Studio 3.1,我通过现成的文档找到了最佳答案以供学习有点未来安全。
无论如何,问题来自我正在阅读的一本书,其中一个函数被声明为:
public void TransformVectorByReference()>
{
/* ...stuff... */
}
我假设内部并不重要,因为编译器在函数声明中抱怨 ´>` 符号。但是,多个函数是这样声明的,并且它们都抛出了以下类型的错误:
; 预期的。
谁能告诉我这个函数的作用/指向我以前的 SO 问题,因为我没有通过搜索找到任何答案,因为我不知道该怎么称呼这个有趣的东西。
我从中获得此代码片段的书是 Sam 的 Microsoft XNA Game Studio 3.0。如果有人对这本书有任何其他更好的替代品,我会很高兴看到它们。
编辑:
我从三个五个函数中添加了一个示例函数,它们几乎相同,但其中一个使用了 > 关键字。然而,有人指出,这可能不是作者的错,而是这本书的制作/纠错方式。
public void TransformVectorByReference()
{
Matrix rotationMatrix = Matrix.CreateRotationY( MathHelper.ToRadians(45.0f) );
// Create a vector pointing the direction the camera is facing.
Vector3 transformedReference;
Vector3.Transform(ref cameraReference, ref rotationMatrix, out transformedReference);
// Calculcate the position the camera is looking at.
Vector3.Add(ref cameraPosition, ref transformedReference, out cameraTarget);
}
public void TransformVectorByReferenceAndOut()>
{
Matrix rotationMatrix = Matrix.CreateRotationY( MathHelper.ToRadians(45.0f) );
// Create a vector pointing the direction the camera is facing.
Vector3 transformedReference;
Vector3.Transform( ref cameraReference, ref rotationMatrix, out transformedReference );
// Calculate the position the camera is looking at.
Vector3.Add( ref cameraPosition, ref transformedReference, out cameraTarget );
}