class World
{
bool _playerHasWonGame = false;
public void Update()
{
Entity player = FindEntity("Player"); //ERROR: The type or namespace name 'Entity' could not be found(are you missing a using directive for an assembly reference?)
}
private Entity FindEntity(string p) //Same ERROR
{
throw new NotImplementedException();
}
}
class Inventory
{
public bool Contains(Entity entity)
{
return false;
}
}
public class Entity
{
public Inventory Inventory { get; set; }
}
错误部分是实体。
我创建 Entity 类,并尝试在 World 类中创建 Entity 对象。
据我了解,它应该可以工作。我只是尝试像其他 C# 程序员一样制作对象。但是,看起来我的编译器找不到实体定义。