diff --git a/Assets/Scripts/Player/Player.cs b/Assets/Scripts/Player/Player.cs index 8abb1ff..011ad42 100644 --- a/Assets/Scripts/Player/Player.cs +++ b/Assets/Scripts/Player/Player.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; using UnityEngine; using Mirror; -public struct WeaponItem +public struct Item { public string name; public int ammo; @@ -31,7 +31,7 @@ public class Player : NetworkBehaviour private int kills; private int deaths; - public readonly SyncList weaponInventory = new SyncList(); + public readonly SyncList inventory = new SyncList(); private void Start() { @@ -50,7 +50,7 @@ public class Player : NetworkBehaviour if (Input.GetKeyDown(KeyCode.O)) { - CmdAddWeaponItem(new WeaponItem()); + CmdAddWeaponItem(new Item()); } } } @@ -60,15 +60,21 @@ public class Player : NetworkBehaviour } + #region INVENTORY [Command] - public void CmdAddWeaponItem(WeaponItem weaponItem) + public void CmdAddWeaponItem(Item item) { - weaponInventory.Add(weaponItem); + inventory.Add(item); } #endregion + + + + + public void SetName(string oldName, string newName) { username = newName;