예제 #1
0
 public Stackable(Vector2Int position, TilableDef def, int count)
 {
     this.position    = position;
     this.def         = def;
     this.inventory   = new Inventory(this, count);
     this.mainGraphic = GraphicInstance.GetNew(this.def.graphics);
     this.area        = null;
     this.SetNeigbours();
     Loki.stackableLabelController.AddLabel(this);
     if (count > 0)
     {
         WorldUtils.AddStackable(def, this);
     }
     this.inventory.OnClear += delegate {
         WorldUtils.ClearStackable(this.inventory.def, this);
     };
     this.inventory.OnAdd += delegate {
         WorldUtils.AddStackable(this.inventory.def, this);
     };
     this.inventory.OnChangeCount += delegate(int change) {
         WorldUtils.UpdateStackableCount(this.inventory.def, change);
     };
 }