mirror of
https://github.com/DerTyp7/defrain-shooter-unity.git
synced 2025-10-29 12:52:07 +01:00
add WeaponInventory in Player.cs
This commit is contained in:
@@ -3,6 +3,12 @@ using System.Collections.Generic;
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using Mirror;
|
using Mirror;
|
||||||
|
|
||||||
|
public struct WeaponItem
|
||||||
|
{
|
||||||
|
public string name;
|
||||||
|
public int ammo;
|
||||||
|
}
|
||||||
|
|
||||||
public class Player : NetworkBehaviour
|
public class Player : NetworkBehaviour
|
||||||
{
|
{
|
||||||
Lobby lobby;
|
Lobby lobby;
|
||||||
@@ -25,21 +31,11 @@ public class Player : NetworkBehaviour
|
|||||||
private int kills;
|
private int kills;
|
||||||
private int deaths;
|
private int deaths;
|
||||||
|
|
||||||
|
public readonly SyncList<WeaponItem> weaponInventory = new SyncList<WeaponItem>();
|
||||||
|
|
||||||
private void Start()
|
private void Start()
|
||||||
{
|
{
|
||||||
lobby = GameObject.Find("LobbyManager").GetComponent<Lobby>();
|
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()
|
private void Update()
|
||||||
@@ -51,6 +47,11 @@ public class Player : NetworkBehaviour
|
|||||||
playerUIController.showHit();
|
playerUIController.showHit();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Input.GetKeyDown(KeyCode.O))
|
||||||
|
{
|
||||||
|
CmdAddWeaponItem(new WeaponItem());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public override void OnStartLocalPlayer()
|
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)
|
public void SetName(string oldName, string newName)
|
||||||
{
|
{
|
||||||
username = newName;
|
username = newName;
|
||||||
|
|||||||
@@ -42,8 +42,8 @@ PlayerSettings:
|
|||||||
m_SplashScreenLogos: []
|
m_SplashScreenLogos: []
|
||||||
m_VirtualRealitySplashScreen: {fileID: 0}
|
m_VirtualRealitySplashScreen: {fileID: 0}
|
||||||
m_HolographicTrackingLossScreen: {fileID: 0}
|
m_HolographicTrackingLossScreen: {fileID: 0}
|
||||||
defaultScreenWidth: 1920
|
defaultScreenWidth: 1000
|
||||||
defaultScreenHeight: 1080
|
defaultScreenHeight: 563
|
||||||
defaultScreenWidthWeb: 960
|
defaultScreenWidthWeb: 960
|
||||||
defaultScreenHeightWeb: 600
|
defaultScreenHeightWeb: 600
|
||||||
m_StereoRenderingPath: 0
|
m_StereoRenderingPath: 0
|
||||||
@@ -99,7 +99,7 @@ PlayerSettings:
|
|||||||
xboxEnableFitness: 0
|
xboxEnableFitness: 0
|
||||||
visibleInBackground: 1
|
visibleInBackground: 1
|
||||||
allowFullscreenSwitch: 1
|
allowFullscreenSwitch: 1
|
||||||
fullscreenMode: 1
|
fullscreenMode: 3
|
||||||
xboxSpeechDB: 0
|
xboxSpeechDB: 0
|
||||||
xboxEnableHeadOrientation: 0
|
xboxEnableHeadOrientation: 0
|
||||||
xboxEnableGuest: 0
|
xboxEnableGuest: 0
|
||||||
|
|||||||
@@ -7,6 +7,9 @@ onBoardingDoNotAskAgain = true
|
|||||||
showPackageIndexes = false
|
showPackageIndexes = false
|
||||||
showStatusBar = false
|
showStatusBar = false
|
||||||
scopes = {
|
scopes = {
|
||||||
|
"last_search.785D90A9" = "Item"
|
||||||
|
"OpenInspectorPreview.785D90A9" = "0"
|
||||||
|
"currentGroup.785D90A9" = "all"
|
||||||
}
|
}
|
||||||
providers = {
|
providers = {
|
||||||
asset = {
|
asset = {
|
||||||
@@ -44,10 +47,26 @@ providers = {
|
|||||||
priority = 100
|
priority = 100
|
||||||
defaultAction = null
|
defaultAction = null
|
||||||
}
|
}
|
||||||
|
adb = {
|
||||||
|
active = false
|
||||||
|
priority = 2500
|
||||||
|
defaultAction = null
|
||||||
|
}
|
||||||
|
performance = {
|
||||||
|
active = false
|
||||||
|
priority = 100
|
||||||
|
defaultAction = null
|
||||||
|
}
|
||||||
}
|
}
|
||||||
recentSearches = [
|
recentSearches = [
|
||||||
]
|
]
|
||||||
searchItemFavorites = [
|
searchItemFavorites = [
|
||||||
]
|
]
|
||||||
savedSearchesSortOrder = 0
|
savedSearchesSortOrder = 0
|
||||||
showSavedSearchPanel = false
|
showSavedSearchPanel = false
|
||||||
|
expandedQueries = [
|
||||||
|
]
|
||||||
|
queryBuilder = false
|
||||||
|
ignoredProperties = "id;name;classname;imagecontentshash"
|
||||||
|
helperWidgetCurrentArea = "all"
|
||||||
|
disabledIndexers = ""
|
||||||
Reference in New Issue
Block a user