Inheritance: MonoBehaviour
Esempio n. 1
0
 public void ResolveAdd(Block inblock, string key, string value)
 {
     placeBlockByInBlockId[inblock.BlockId] = PlaceBlock.Resolve(variant.fromFile, Api, inblock, key, value);
     if (SurfaceBlock != null)
     {
         surfaceBlockByInBlockId[inblock.BlockId] = SurfaceBlock.Resolve(variant.fromFile, Api, inblock, key, value);
     }
 }
Esempio n. 2
0
    // Use this for initialization
    void Start()
    {
        GameObject go = GameObject.FindGameObjectWithTag("gameControls") as GameObject;

        //PlaceBlockDetection spt =(PlaceBlockDetection)this.tmpBlock.GetComponent("PlaceBlockDetection");
        this.sb     = (spawnBlocks)go.GetComponent("spawnBlocks");
        this.player = (Player)go.GetComponent("Player");

        go = GameObject.FindGameObjectWithTag("Player") as GameObject;
        this.placeBlock = (PlaceBlock)go.GetComponent("PlaceBlock");
    }
Esempio n. 3
0
 private void NormalState()
 {
     Usable.Type     type = Player.UsableSelected;
     Usable.Category cat  = Usable.category[(int)type];
     if (cat == Usable.Category.Block)
     {
         World.UIBlockTilemap.Clear();
         int  amount   = Player.inventoryUsables.GetItemCount(type);
         bool canPlace = PlaceBlock.CanPlace((int)mousePos.x, (int)mousePos.y, out canPlace);
         if (amount > 0 && canPlace && MouseInRange(9, false))
         {
             World.UIBlockTilemap.SetCell((int)mousePos.x, -(int)mousePos.y + Chunk.height, 1);
         }
         else
         {
             World.UIBlockTilemap.SetCell((int)mousePos.x, -(int)mousePos.y + Chunk.height, 0);
         }
     }
 }
Esempio n. 4
0
 private void ClickNormalState()
 {
     Usable.Type     type = Player.UsableSelected;
     Usable.Category cat  = Usable.category[(int)type];
     if (MouseInRange(9, false))
     {
         if (cat == Usable.Category.Block)
         {
             int amount = Player.inventoryUsables.GetItemCount(type);
             if (amount > 0)
             {
                 bool succeed = PlaceBlock.Place((int)mousePos.x, (int)mousePos.y, Usable.blocks[type]);
                 if (succeed)
                 {
                     Player.inventoryUsables.Remove(type, 1);
                     if (ToolBar.GetInstance() != null)
                     {
                         ToolBar.SendRefresh();
                     }
                 }
             }
         }
     }
 }