add WeaponInventory in Player.cs

This commit is contained in:
DerTyp187
2022-01-24 19:23:55 +01:00
parent 41847c9ca8
commit 4fdc6aad3a
3 changed files with 44 additions and 15 deletions

View File

@@ -3,6 +3,12 @@ using System.Collections.Generic;
using UnityEngine;
using Mirror;
public struct WeaponItem
{
public string name;
public int ammo;
}
public class Player : NetworkBehaviour
{
Lobby lobby;
@@ -25,21 +31,11 @@ public class Player : NetworkBehaviour
private int kills;
private int deaths;
public readonly SyncList<WeaponItem> weaponInventory = new SyncList<WeaponItem>();
private void Start()
{
lobby = GameObject.Find("LobbyManager").GetComponent<Lobby>();
/*GameManager = GameObject.Find("MatchController");
gameMaster = GameManager.GetComponent<GameMaster>();
if (isServer)
{
health = defaultHp;
gameMaster.RegisterPlayer(GetComponent<Player>());
//respawnPos(gameMaster.RespawnRequest(this.gameObject, team.teamID));
}*/
}
private void Update()
@@ -51,6 +47,11 @@ public class Player : NetworkBehaviour
playerUIController.showHit();
}
if (Input.GetKeyDown(KeyCode.O))
{
CmdAddWeaponItem(new WeaponItem());
}
}
}
public override void OnStartLocalPlayer()
@@ -59,6 +60,15 @@ public class Player : NetworkBehaviour
}
#region INVENTORY
[Command]
public void CmdAddWeaponItem(WeaponItem weaponItem)
{
weaponInventory.Add(weaponItem);
}
#endregion
public void SetName(string oldName, string newName)
{
username = newName;

View File

@@ -42,8 +42,8 @@ PlayerSettings:
m_SplashScreenLogos: []
m_VirtualRealitySplashScreen: {fileID: 0}
m_HolographicTrackingLossScreen: {fileID: 0}
defaultScreenWidth: 1920
defaultScreenHeight: 1080
defaultScreenWidth: 1000
defaultScreenHeight: 563
defaultScreenWidthWeb: 960
defaultScreenHeightWeb: 600
m_StereoRenderingPath: 0
@@ -99,7 +99,7 @@ PlayerSettings:
xboxEnableFitness: 0
visibleInBackground: 1
allowFullscreenSwitch: 1
fullscreenMode: 1
fullscreenMode: 3
xboxSpeechDB: 0
xboxEnableHeadOrientation: 0
xboxEnableGuest: 0

View File

@@ -7,6 +7,9 @@ onBoardingDoNotAskAgain = true
showPackageIndexes = false
showStatusBar = false
scopes = {
"last_search.785D90A9" = "Item"
"OpenInspectorPreview.785D90A9" = "0"
"currentGroup.785D90A9" = "all"
}
providers = {
asset = {
@@ -44,6 +47,16 @@ providers = {
priority = 100
defaultAction = null
}
adb = {
active = false
priority = 2500
defaultAction = null
}
performance = {
active = false
priority = 100
defaultAction = null
}
}
recentSearches = [
]
@@ -51,3 +64,9 @@ searchItemFavorites = [
]
savedSearchesSortOrder = 0
showSavedSearchPanel = false
expandedQueries = [
]
queryBuilder = false
ignoredProperties = "id;name;classname;imagecontentshash"
helperWidgetCurrentArea = "all"
disabledIndexers = ""