/// <summary> /// Responsible for sending the item used and updating the particle effects on the effected players /// </summary> /// <param name="itemID"> ID of the item used </param> /// <param name="floatInfo"> Floats needed for the item </param> /// <param name="intInfo"> Ints needed for the item </param> /// <param name="sendToAll"> Should send to all players (false = just host)</param> public void SendItemUseRequest(ItemBoxController.Items itemID, List <float> floatInfo, List <int> intInfo, bool sendToAll = true) { string s = SerializationScript.SerializeItemGameMessage(_myID, itemID, floatInfo, intInfo); SendData(s, 1, sendToAll); if (network.IsHost()) { ProcessItem(s.Split(':')); } else { EventItemFeedEvent(new ItemFeedMessage(_myID, itemID)); switch (itemID) { case ItemBoxController.Items.SwingFuel: EventClientParticleEffect(new ParticleEffectMessage(ParticleEffectMessage.Effect.Inked, _myID)); break; case ItemBoxController.Items.ConfusedControls: EventClientParticleEffect(new ParticleEffectMessage(ParticleEffectMessage.Effect.Confused, _myID)); break; default: break; } } }
public static string SerializeItemGameMessage(int id, ItemBoxController.Items itemID, List <float> floatInfo, List <int> intInfo) { string s = GameEvent.ITEM + ":" + id + ":" + itemID + ":"; if (floatInfo != null) { for (int i = 0; i < floatInfo.Count; i++) { s += floatInfo[i] + ":"; } } if (intInfo != null) { for (int i = 0; i < intInfo.Count; i++) { s += intInfo[i] + ":"; } } return(s); }
public ItemFeedMessage(int id, ItemBoxController.Items new_Item) { userID = id; this.item = new_Item; }
public void SendItemUseRequest(ItemBoxController.Items itemID, List <float> floatInfo, List <int> intInfo, bool sendToAll = true) { _processor.itemManager.SendItemUseRequest(itemID, floatInfo, intInfo, sendToAll); }