【发布时间】:2017-10-07 00:26:05
【问题描述】:
我创建了以下类:
namespace com.censureret.motions
{
public class EnumPlayerStances {
public const int OneHandSword = 50;
/// <summary>
/// Friendly name of the type
/// </summary>
public static string[] Names = new string[] {
"One handed Sword"
};
}
}
现在我希望在我的以下课程中使用它:
namespace com.censureret.motions{
public class OneHandSword_Idle : MotionControllerMotion
{
public override bool TestActivate()
{
if (!mIsStartable) { return false; }
if (!mMotionController.IsGrounded) { return false; }
if (mActorController.State.Stance != EnumPlayerStances.OneHandSword)
return false;
}
}
}
但是 Visual Studio 说这是一个错误。
我对 C# 还很陌生。接下来我可以尝试什么?
【问题讨论】:
-
“mActorController.State.Stance”是什么类型?您将它与 EnumPlayerStances 类上的 const int 进行比较。看起来该类可以重构为更加用户友好。值 50 代表什么?您还希望在字符串数组中放入哪些其他内容?
标签: c# namespaces