Exemplo n.º 1
0
 public override void Apply(MonoBehaviour sender, float amount)
 {
     amount         = (int)Math.Floor(amount);
     senderPosition = sender.gameObject.RegisterTile().WorldPositionServer;
     senderInfo     = sender.gameObject.GetComponent <MixingBowl>();
     if (senderInfo != null)
     {
         if (senderInfo.playerHolding != null)
         {
             var spawnInstance = Spawn.ServerPrefab(spawnItem).GameObject;
             var pickupable    = spawnInstance.GetComponent <Pickupable>();
             Inventory.ServerAdd(pickupable, senderInfo.currentSlot, ReplacementStrategy.DespawnOther);
         }
         else
         {
             Spawn.ServerPrefab(spawnItem, senderPosition, null, null, (int)amount);
             Despawn.ServerSingle(sender.gameObject);
         }
     }
     else
     {
         Spawn.ServerPrefab(spawnItem, senderPosition, null, null, (int)amount);
         Despawn.ServerSingle(sender.gameObject);
     }
 }
Exemplo n.º 2
0
 public override void Apply(MonoBehaviour sender, float amount)
 {
     amount         = (int)Math.Floor(amount);
     senderPosition = sender.gameObject.RegisterTile().WorldPositionServer;
     senderInfo     = sender.gameObject.GetComponent <MixingBowl>();
     if (senderInfo != null)
     {
         if (senderInfo.playerHolding != null)
         {
             Spawn.ServerPrefab(spawnItem, senderInfo.playerHolding.WorldPositionServer, null, null, (int)amount);
         }
         else
         {
             Spawn.ServerPrefab(spawnItem, senderPosition, null, null, (int)amount);
         }
     }
     else
     {
         Spawn.ServerPrefab(spawnItem, senderPosition, null, null, (int)amount);
     }
 }