我想知道是否可以将对象与其实例名称相匹配。匹配2具有相同实例名称的不同对象
我:
class AnimatedEntity : DrawableEntity
{
Animation BL { get; set; }
Animation BR { get; set; }
Animation TL { get; set; }
Animation TR { get; set; }
Animation T { get; set; }
Animation R { get; set; }
Animation L { get; set; }
Animation B { get; set; }
Orientation orientation ;
public virtual int Draw(SpriteBatch spriteBatch, GameTime gameTime)
{
//draw depends on orientation
}
}
和
enum Orientation {
SE, SO, NE, NO,
N , E, O, S,
BL, BR, TL, TR,
T, R, L, B
}
方向在哪里是一个ENUM和动画类。
我可以从同一个名字的方向调用正确的动画吗?
是否有可能注入'Animation'到'Orientation'对象:
会像使用吗? – IAbstract 2013-03-01 00:21:38
没有动画取决于一个实体实例,取向取决于现场 – 2013-03-01 00:22:51
我觉得这可能是:typeof(MyClass).AssemblyQualifiedName,但它只是一半的方式 – 2013-03-01 00:23:02