Ejemplo n.º 1
0
        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);
            }
        }
Ejemplo n.º 2
0
        /// <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);
            }
        }
Ejemplo n.º 3
0
 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);
     }
 }
Ejemplo n.º 4
0
 public void RemoveObject()  // 移除物体
 {
     this.cellObject = CellObjectType.Empty;
 }
Ejemplo n.º 5
0
 public void AddObject(CellObjectType type)  // 添加物体
 {
     this.cellObject = type;
 }
Ejemplo n.º 6
0
 private bool WasDroppedAtAndObjectIsNot(CellObjectType cellObjectType)
 {
     return(DropAtType == cellObjectType && DropAtType != this.cellObjectType);
 }