Exemplo n.º 1
0
        public override void OnInspectorGUI()
        {
            DrawDefaultInspector();

            ItemDropController itemDropController = (ItemDropController)target;

            if (GUILayout.Button("Build Object"))
            {
                itemDropController.setItem(new Item(Item.Types.Get((short)itemDropController.testItemId.itemId), itemDropController.testQuantity));
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// Drop items onto the grid
 /// </summary>
 /// <param name="tile"></param>
 /// <param name="drops"></param>
 public void addItemDrops(Tile tile, Item[] drops)
 {
     foreach (Item drop in drops)
     {
         GameObject dropObject = Instantiate(
             ItemDrop,
             new Vector3(
                 tile.worldLocation.x + Random.Range(-0.5f, 0.5f),
                 tile.worldLocation.y * Universe.StepHeight + Random.Range(0.1f, 0.5f),
                 tile.worldLocation.z + Random.Range(-0.5f, 0.5f)
                 ),
             Quaternion.Euler(0, UnityEngine.Random.Range(1, 360), 0),
             transform
             );
         ItemDropController itemDropController = dropObject.GetComponent <ItemDropController>();
         this.drops.Add(itemDropController);
         itemDropController.setItem(drop);
     }
 }