public void OnGetItem(string senderId, GetItemPayload getItemPayload) { Console.WriteLine(">> GetItem"); var itemId = getItemPayload.ItemId; if (items.ContainsKey(itemId)) { items.Remove(itemId); players[getItemPayload.PlayerId].Scale += 0.3f; // スケールの変更 if (players[getItemPayload.PlayerId].Scale >= 3.0f) { players[getItemPayload.PlayerId].Scale = 3.0f; } var deleteItemRpc = new DeleteItem(new DeleteItemPayload(itemId)); var deleteItemJson = JsonConvert.SerializeObject(deleteItemRpc); broadcast(deleteItemJson); } else { Console.WriteLine("Not found ItemId: " + itemId); } }
public void OnGetItem(string senderId, GetItemPayload getItemPayload) { Console.WriteLine(">> GetItem"); var itemId = getItemPayload.ItemId; if (items.ContainsKey(itemId)) { items.Remove(itemId); players[getItemPayload.PlayerId].Score++; var deleteItemRpc = new DeleteItem(new DeleteItemPayload(itemId)); var deleteItemJson = JsonConvert.SerializeObject(deleteItemRpc); broadcast(deleteItemJson); } else { // アイテムデュプリケートしている状態 Console.WriteLine("Not found ItemId: " + itemId); } }