mirror of
https://github.com/DerTyp7/defrain-shooter-unity.git
synced 2025-10-29 12:52:07 +01:00
Update Player.cs
This commit is contained in:
@@ -3,7 +3,7 @@ using System.Collections.Generic;
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using Mirror;
|
using Mirror;
|
||||||
|
|
||||||
public struct WeaponItem
|
public struct Item
|
||||||
{
|
{
|
||||||
public string name;
|
public string name;
|
||||||
public int ammo;
|
public int ammo;
|
||||||
@@ -31,7 +31,7 @@ public class Player : NetworkBehaviour
|
|||||||
private int kills;
|
private int kills;
|
||||||
private int deaths;
|
private int deaths;
|
||||||
|
|
||||||
public readonly SyncList<WeaponItem> weaponInventory = new SyncList<WeaponItem>();
|
public readonly SyncList<Item> inventory = new SyncList<Item>();
|
||||||
|
|
||||||
private void Start()
|
private void Start()
|
||||||
{
|
{
|
||||||
@@ -50,7 +50,7 @@ public class Player : NetworkBehaviour
|
|||||||
|
|
||||||
if (Input.GetKeyDown(KeyCode.O))
|
if (Input.GetKeyDown(KeyCode.O))
|
||||||
{
|
{
|
||||||
CmdAddWeaponItem(new WeaponItem());
|
CmdAddWeaponItem(new Item());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -60,15 +60,21 @@ public class Player : NetworkBehaviour
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#region INVENTORY
|
#region INVENTORY
|
||||||
|
|
||||||
[Command]
|
[Command]
|
||||||
public void CmdAddWeaponItem(WeaponItem weaponItem)
|
public void CmdAddWeaponItem(Item item)
|
||||||
{
|
{
|
||||||
weaponInventory.Add(weaponItem);
|
inventory.Add(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void SetName(string oldName, string newName)
|
public void SetName(string oldName, string newName)
|
||||||
{
|
{
|
||||||
username = newName;
|
username = newName;
|
||||||
|
|||||||
Reference in New Issue
Block a user