public static ICellObject Build(CellObjectType cellObjectType) { switch (cellObjectType) { case CellObjectType.Hero: return(new Hero()); case CellObjectType.Grass: return(new Grass()); case CellObjectType.Npc: return(new Npc()); case CellObjectType.Enemy: return(new Enemy()); case CellObjectType.SmallHouse: return(new SmallHouse()); case CellObjectType.MediumHouse: return(new MediumHouse()); case CellObjectType.BigHouse: return(new BigHouse()); case CellObjectType.Tree: return(new Tree()); case CellObjectType.Merchant: return(new Merchant()); case CellObjectType.Sign: return(new Sign("This is a custom view. Touch the sign again to close this message.")); case CellObjectType.Rug: return(new Rug()); case CellObjectType.Bookshelf: return(new Bookshelf()); case CellObjectType.Flower: return(new Flower()); case CellObjectType.FancyHouse: return(new FancyHouse()); case CellObjectType.LabThing: return(new LabThing()); case CellObjectType.Floor: return(new Floor()); //TODO: make default throw exception default: return(null); } }
/// <summary> /// Retrieve an instance of cell object from selected enum /// </summary> /// <param name="cellObjectType"></param> /// <returns></returns> public static ICellObject Build(CellObjectType cellObjectType) { switch (cellObjectType) { case CellObjectType.Hero: return(new Hero()); case CellObjectType.Grass: return(new Grass()); case CellObjectType.Tree: return(new Tree()); default: return(null); } }
private Transform GetTransformCorrectGrid(CellObjectType gridToFind) { if (gridToFind == CellObjectType.Ground) { return(Control.GridNerbyItem); } else if (gridToFind == CellObjectType.Inventory) { return(Control.GridInventoryPlayer); } else if (gridToFind == CellObjectType.Protection) { return(Control.GridProtectionPlayer); } else if (gridToFind == CellObjectType.Weapon) { return(Control.GridEquippedByPlayer); } else { return(null); } }
public void RemoveObject() // 移除物体 { this.cellObject = CellObjectType.Empty; }
public void AddObject(CellObjectType type) // 添加物体 { this.cellObject = type; }
private bool WasDroppedAtAndObjectIsNot(CellObjectType cellObjectType) { return(DropAtType == cellObjectType && DropAtType != this.cellObjectType); }