Added PlayerMovement and other
This commit is contained in:
@@ -160,143 +160,6 @@ MeshRenderer:
|
||||
m_SortingLayer: 0
|
||||
m_SortingOrder: 0
|
||||
m_AdditionalVertexStreams: {fileID: 0}
|
||||
--- !u!1 &1176123984892952064
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 7954880842502860370}
|
||||
- component: {fileID: 4383252625990137070}
|
||||
- component: {fileID: 8187299151670170284}
|
||||
m_Layer: 5
|
||||
m_Name: Text (TMP)
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &7954880842502860370
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1176123984892952064}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 6088637548295755029}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 200, y: 50}
|
||||
m_Pivot: {x: 0, y: 0}
|
||||
--- !u!222 &4383252625990137070
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1176123984892952064}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &8187299151670170284
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1176123984892952064}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_text: test
|
||||
m_isRightToLeft: 0
|
||||
m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
|
||||
m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
|
||||
m_fontSharedMaterials: []
|
||||
m_fontMaterial: {fileID: 0}
|
||||
m_fontMaterials: []
|
||||
m_fontColor32:
|
||||
serializedVersion: 2
|
||||
rgba: 4294967295
|
||||
m_fontColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_enableVertexGradient: 0
|
||||
m_colorMode: 3
|
||||
m_fontColorGradient:
|
||||
topLeft: {r: 1, g: 1, b: 1, a: 1}
|
||||
topRight: {r: 1, g: 1, b: 1, a: 1}
|
||||
bottomLeft: {r: 1, g: 1, b: 1, a: 1}
|
||||
bottomRight: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_fontColorGradientPreset: {fileID: 0}
|
||||
m_spriteAsset: {fileID: 0}
|
||||
m_tintAllSprites: 0
|
||||
m_StyleSheet: {fileID: 0}
|
||||
m_TextStyleHashCode: -1183493901
|
||||
m_overrideHtmlColors: 0
|
||||
m_faceColor:
|
||||
serializedVersion: 2
|
||||
rgba: 4294967295
|
||||
m_fontSize: 36
|
||||
m_fontSizeBase: 36
|
||||
m_fontWeight: 400
|
||||
m_enableAutoSizing: 0
|
||||
m_fontSizeMin: 18
|
||||
m_fontSizeMax: 72
|
||||
m_fontStyle: 0
|
||||
m_HorizontalAlignment: 1
|
||||
m_VerticalAlignment: 256
|
||||
m_textAlignment: 65535
|
||||
m_characterSpacing: 0
|
||||
m_characterHorizontalScale: 1
|
||||
m_wordSpacing: 0
|
||||
m_lineSpacing: 0
|
||||
m_lineSpacingMax: 0
|
||||
m_paragraphSpacing: 0
|
||||
m_charWidthMaxAdj: 0
|
||||
m_TextWrappingMode: 1
|
||||
m_wordWrappingRatios: 0.4
|
||||
m_overflowMode: 0
|
||||
m_linkedTextComponent: {fileID: 0}
|
||||
parentLinkedComponent: {fileID: 0}
|
||||
m_enableKerning: 0
|
||||
m_ActiveFontFeatures: 6e72656b
|
||||
m_enableExtraPadding: 0
|
||||
checkPaddingRequired: 0
|
||||
m_isRichText: 1
|
||||
m_EmojiFallbackSupport: 1
|
||||
m_parseCtrlCharacters: 1
|
||||
m_isOrthographic: 1
|
||||
m_isCullingEnabled: 0
|
||||
m_horizontalMapping: 0
|
||||
m_verticalMapping: 0
|
||||
m_uvLineOffset: 0
|
||||
m_geometrySortingOrder: 0
|
||||
m_IsTextObjectScaleStatic: 0
|
||||
m_VertexBufferAutoSizeReduction: 0
|
||||
m_useMaxVisibleDescender: 1
|
||||
m_pageToDisplay: 1
|
||||
m_margin: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_isUsingLegacyAnimationComponent: 0
|
||||
m_isVolumetricText: 0
|
||||
m_hasFontAssetChanged: 0
|
||||
m_baseMaterial: {fileID: 0}
|
||||
m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
|
||||
--- !u!1 &1205214087950268742
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -571,6 +434,9 @@ GameObject:
|
||||
- component: {fileID: 3924378418118045030}
|
||||
- component: {fileID: 5519469453299969230}
|
||||
- component: {fileID: 912785952882763112}
|
||||
- component: {fileID: 8786382977880960132}
|
||||
- component: {fileID: 7845123456789012345}
|
||||
- component: {fileID: 3541666218759354771}
|
||||
m_Layer: 0
|
||||
m_Name: NetworkPlayer
|
||||
m_TagString: Player
|
||||
@@ -593,7 +459,6 @@ Transform:
|
||||
m_Children:
|
||||
- {fileID: 643528348970133323}
|
||||
- {fileID: 2142486437948056408}
|
||||
- {fileID: 6088637548295755029}
|
||||
- {fileID: 5017856760505747688}
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
@@ -635,13 +500,10 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
ShowTopMostFoldoutHeaderGroup: 1
|
||||
moveSpeed: 10
|
||||
playerCamera: {fileID: 358431225805014765}
|
||||
playerHandCamera: {fileID: 5617290128103056897}
|
||||
tpvHands: {fileID: 262780200250670577}
|
||||
fpvHands: {fileID: 149248327471132257}
|
||||
mouseSensitivity: 2
|
||||
cameraRoot: {fileID: 2142486437948056408}
|
||||
--- !u!114 &6885894728237704640
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -672,14 +534,14 @@ MonoBehaviour:
|
||||
SyncPositionX: 1
|
||||
SyncPositionY: 1
|
||||
SyncPositionZ: 1
|
||||
SyncRotAngleX: 1
|
||||
SyncRotAngleX: 0
|
||||
SyncRotAngleY: 1
|
||||
SyncRotAngleZ: 1
|
||||
SyncScaleX: 1
|
||||
SyncScaleY: 1
|
||||
SyncScaleZ: 1
|
||||
PositionThreshold: 0.001
|
||||
RotAngleThreshold: 0.01
|
||||
SyncRotAngleZ: 0
|
||||
SyncScaleX: 0
|
||||
SyncScaleY: 0
|
||||
SyncScaleZ: 0
|
||||
PositionThreshold: 0
|
||||
RotAngleThreshold: 0.00001
|
||||
ScaleThreshold: 0.01
|
||||
UseQuaternionSynchronization: 0
|
||||
UseQuaternionCompression: 0
|
||||
@@ -702,7 +564,6 @@ MonoBehaviour:
|
||||
m_EditorClassIdentifier:
|
||||
ShowTopMostFoldoutHeaderGroup: 1
|
||||
maxHealth: 100
|
||||
healthText: {fileID: 8187299151670170284}
|
||||
currentHealth:
|
||||
UpdateTraits:
|
||||
MinSecondsBetweenUpdates: 0
|
||||
@@ -737,7 +598,7 @@ CapsuleCollider:
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2553183295301017937}
|
||||
m_Material: {fileID: 0}
|
||||
m_Material: {fileID: 13400000, guid: c6102b1a8a795044986ea36d0cbe55c3, type: 2}
|
||||
m_IncludeLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 0
|
||||
@@ -775,11 +636,84 @@ Rigidbody:
|
||||
m_Bits: 0
|
||||
m_ImplicitCom: 1
|
||||
m_ImplicitTensor: 1
|
||||
m_UseGravity: 1
|
||||
m_IsKinematic: 0
|
||||
m_Interpolate: 1
|
||||
m_UseGravity: 0
|
||||
m_IsKinematic: 1
|
||||
m_Interpolate: 0
|
||||
m_Constraints: 112
|
||||
m_CollisionDetection: 2
|
||||
m_CollisionDetection: 1
|
||||
--- !u!114 &8786382977880960132
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2553183295301017937}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: ad25c27019239e149bb32c828a8d9f32, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
ShowTopMostFoldoutHeaderGroup: 1
|
||||
playerMovement: {fileID: 7845123456789012345}
|
||||
playerHealth: {fileID: 1055737657517928686}
|
||||
playerShoot: {fileID: 3924378418118045030}
|
||||
playerUIController: {fileID: 0}
|
||||
--- !u!114 &7845123456789012345
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2553183295301017937}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 1e2a76beda2b2fb4aa4bab0306e24560, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
walkSpeed: 8
|
||||
sprintSpeed: 16
|
||||
groundAcceleration: 90
|
||||
airAcceleration: 35
|
||||
groundDeceleration: 70
|
||||
jumpHeight: 1.6
|
||||
coyoteTime: 0.12
|
||||
jumpBufferTime: 0.12
|
||||
gravity: -28
|
||||
fallMultiplier: 1.6
|
||||
lowJumpMultiplier: 2.5
|
||||
maxFallSpeed: -40
|
||||
stepOffset: 0.4
|
||||
slopeLimit: 50
|
||||
groundStickForce: -4
|
||||
mouseSensitivity: 2
|
||||
cameraRoot: {fileID: 2142486437948056408}
|
||||
minPitch: -89
|
||||
maxPitch: 89
|
||||
--- !u!143 &3541666218759354771
|
||||
CharacterController:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2553183295301017937}
|
||||
m_Material: {fileID: 0}
|
||||
m_IncludeLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 0
|
||||
m_ExcludeLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 0
|
||||
m_LayerOverridePriority: 0
|
||||
m_ProvidesContacts: 0
|
||||
m_Enabled: 1
|
||||
serializedVersion: 3
|
||||
m_Height: 2
|
||||
m_Radius: 0.5
|
||||
m_SlopeLimit: 50
|
||||
m_StepOffset: 0.4
|
||||
m_SkinWidth: 0.08
|
||||
m_MinMoveDistance: 0.001
|
||||
m_Center: {x: 0, y: 1, z: 0}
|
||||
--- !u!1 &3046942642847312462
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -1181,123 +1115,6 @@ MeshRenderer:
|
||||
m_SortingLayer: 0
|
||||
m_SortingOrder: 0
|
||||
m_AdditionalVertexStreams: {fileID: 0}
|
||||
--- !u!1 &4649230851043662640
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 6088637548295755029}
|
||||
- component: {fileID: 3728548608008949096}
|
||||
- component: {fileID: 7027885826609405813}
|
||||
- component: {fileID: 5316955344742389547}
|
||||
- component: {fileID: 369840709818755588}
|
||||
m_Layer: 5
|
||||
m_Name: Canvas
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &6088637548295755029
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4649230851043662640}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 0, y: 0, z: 0}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 7954880842502860370}
|
||||
m_Father: {fileID: 2264751121530880260}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_Pivot: {x: 0, y: 0}
|
||||
--- !u!223 &3728548608008949096
|
||||
Canvas:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4649230851043662640}
|
||||
m_Enabled: 1
|
||||
serializedVersion: 3
|
||||
m_RenderMode: 0
|
||||
m_Camera: {fileID: 0}
|
||||
m_PlaneDistance: 100
|
||||
m_PixelPerfect: 0
|
||||
m_ReceivesEvents: 1
|
||||
m_OverrideSorting: 0
|
||||
m_OverridePixelPerfect: 0
|
||||
m_SortingBucketNormalizedSize: 0
|
||||
m_VertexColorAlwaysGammaSpace: 1
|
||||
m_AdditionalShaderChannelsFlag: 25
|
||||
m_UpdateRectTransformForStandalone: 0
|
||||
m_SortingLayerID: 0
|
||||
m_SortingOrder: 0
|
||||
m_TargetDisplay: 0
|
||||
--- !u!114 &7027885826609405813
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4649230851043662640}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_UiScaleMode: 0
|
||||
m_ReferencePixelsPerUnit: 100
|
||||
m_ScaleFactor: 1
|
||||
m_ReferenceResolution: {x: 800, y: 600}
|
||||
m_ScreenMatchMode: 0
|
||||
m_MatchWidthOrHeight: 0
|
||||
m_PhysicalUnit: 3
|
||||
m_FallbackScreenDPI: 96
|
||||
m_DefaultSpriteDPI: 96
|
||||
m_DynamicPixelsPerUnit: 1
|
||||
m_PresetInfoIsWorld: 0
|
||||
--- !u!114 &5316955344742389547
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4649230851043662640}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: dc42784cf147c0c48a680349fa168899, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_IgnoreReversedGraphics: 1
|
||||
m_BlockingObjects: 0
|
||||
m_BlockingMask:
|
||||
serializedVersion: 2
|
||||
m_Bits: 4294967295
|
||||
--- !u!114 &369840709818755588
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4649230851043662640}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: df6776ae1b2a9ea4faec1e9006289f29, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
ShowTopMostFoldoutHeaderGroup: 1
|
||||
hudCanvas: {fileID: 3728548608008949096}
|
||||
--- !u!1 &5009018705790251557
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -1373,7 +1190,7 @@ Camera:
|
||||
m_Depth: 0
|
||||
m_CullingMask:
|
||||
serializedVersion: 2
|
||||
m_Bits: 183
|
||||
m_Bits: 439
|
||||
m_RenderingPath: -1
|
||||
m_TargetTexture: {fileID: 0}
|
||||
m_TargetDisplay: 0
|
||||
|
||||
@@ -3,19 +3,11 @@ using UnityEngine;
|
||||
|
||||
public class PlayerController : NetworkBehaviour
|
||||
{
|
||||
[SerializeField] private float moveSpeed = 5f;
|
||||
|
||||
[SerializeField] private Camera playerCamera;
|
||||
[SerializeField] private Camera playerHandCamera;
|
||||
[SerializeField] private GameObject tpvHands;
|
||||
[SerializeField] private GameObject fpvHands;
|
||||
|
||||
|
||||
[SerializeField] private float mouseSensitivity = 2f;
|
||||
[SerializeField] private Transform cameraRoot;
|
||||
|
||||
float verticalRotation = 0f;
|
||||
|
||||
public override void OnNetworkSpawn()
|
||||
{
|
||||
if (playerCamera != null)
|
||||
@@ -38,39 +30,5 @@ public class PlayerController : NetworkBehaviour
|
||||
{
|
||||
meshRenderer.material.color = playerColor;
|
||||
}
|
||||
|
||||
// if (IsOwner)
|
||||
// {
|
||||
// transform.position = new Vector3(Random.Range(-10f, 10f), 1f, Random.Range(-10f, 10f));
|
||||
// }
|
||||
}
|
||||
|
||||
public void Update()
|
||||
{
|
||||
if(!IsOwner) return;
|
||||
|
||||
HandleMovement();
|
||||
HandleRotation();
|
||||
}
|
||||
|
||||
private void HandleMovement()
|
||||
{
|
||||
float _moveX = Input.GetAxis("Horizontal");
|
||||
float _moveZ = Input.GetAxis("Vertical");
|
||||
|
||||
Vector3 move = transform.right * _moveX + transform.forward * _moveZ;
|
||||
transform.position += move * moveSpeed * Time.deltaTime;
|
||||
}
|
||||
|
||||
private void HandleRotation()
|
||||
{
|
||||
float _mouseX = Input.GetAxis("Mouse X") * mouseSensitivity;
|
||||
float _mouseY = Input.GetAxis("Mouse Y") * mouseSensitivity;
|
||||
|
||||
transform.Rotate(Vector3.up * _mouseX);
|
||||
|
||||
verticalRotation -= _mouseY;
|
||||
verticalRotation = Mathf.Clamp(verticalRotation, -90f, 90f);
|
||||
cameraRoot.localRotation = Quaternion.Euler(verticalRotation, 0f, 0f);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
using UnityEngine;
|
||||
using Unity.Netcode;
|
||||
using System.Collections;
|
||||
|
||||
public class PlayerFacade : NetworkBehaviour
|
||||
{
|
||||
// [SerializeField] private PlayerController playerController;
|
||||
[SerializeField] private PlayerMovement playerMovement;
|
||||
[SerializeField] private PlayerHealth playerHealth;
|
||||
[SerializeField] private PlayerShoot playerShoot;
|
||||
[SerializeField] private PlayerUIController playerUIController;
|
||||
|
||||
public PlayerHealth PlayerHealth => playerHealth;
|
||||
|
||||
public override void OnNetworkSpawn()
|
||||
{
|
||||
if(IsOwner)
|
||||
{
|
||||
StartCoroutine(InitPlayerUIController());
|
||||
|
||||
if(playerMovement != null)
|
||||
{
|
||||
playerMovement.Init();
|
||||
}
|
||||
|
||||
if(playerShoot != null)
|
||||
{
|
||||
playerShoot.Init();
|
||||
}
|
||||
}
|
||||
|
||||
if(playerHealth != null)
|
||||
{
|
||||
playerHealth.Init(IsServer);
|
||||
}
|
||||
}
|
||||
|
||||
private IEnumerator InitPlayerUIController()
|
||||
{
|
||||
yield return new WaitUntil(() =>
|
||||
{
|
||||
playerUIController = FindFirstObjectByType<PlayerUIController>();
|
||||
return playerUIController != null;
|
||||
});
|
||||
|
||||
if(playerUIController != null)
|
||||
{
|
||||
playerUIController.Init(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ad25c27019239e149bb32c828a8d9f32
|
||||
@@ -1,11 +1,11 @@
|
||||
using UnityEngine;
|
||||
using Unity.Netcode;
|
||||
using TMPro;
|
||||
using System;
|
||||
|
||||
public class PlayerHealth : NetworkBehaviour
|
||||
{
|
||||
[SerializeField] private int maxHealth = 100;
|
||||
[SerializeField] private TMP_Text healthText;
|
||||
|
||||
public NetworkVariable<int> currentHealth = new NetworkVariable<int>(
|
||||
100,
|
||||
@@ -15,56 +15,41 @@ public class PlayerHealth : NetworkBehaviour
|
||||
|
||||
public NetworkVariable<bool> isDead = new NetworkVariable<bool>(false);
|
||||
|
||||
public override void OnNetworkSpawn()
|
||||
public event Action<int, int> HealthChanged;
|
||||
public event Action Died;
|
||||
|
||||
private bool isServer;
|
||||
|
||||
public void Init(bool _isServer)
|
||||
{
|
||||
isServer = _isServer;
|
||||
|
||||
currentHealth.OnValueChanged += OnHealthChanged;
|
||||
|
||||
if (IsServer)
|
||||
if(isServer)
|
||||
{
|
||||
currentHealth.Value = maxHealth;
|
||||
RoundManager.Current?.RegisterPlayer(OwnerClientId);
|
||||
}
|
||||
|
||||
healthText.text = $"Health: {maxHealth}";
|
||||
|
||||
HealthChanged?.Invoke(currentHealth.Value, maxHealth);
|
||||
}
|
||||
|
||||
private void OnHealthChanged(int _previousValue, int _newValue)
|
||||
{
|
||||
Debug.Log($"Health changed from {_previousValue} to {_newValue}");
|
||||
HealthChanged?.Invoke(_newValue, maxHealth);
|
||||
|
||||
healthText.text = $"Health: {_newValue}";
|
||||
}
|
||||
|
||||
public void TakeDamage(int _damageAmount)
|
||||
{
|
||||
if (!IsServer) return;
|
||||
if(isDead.Value) return;
|
||||
|
||||
if (RoundManager.Current == null || !RoundManager.Current.IsRoundActive) return;
|
||||
|
||||
currentHealth.Value = Mathf.Max(0, currentHealth.Value - _damageAmount);
|
||||
|
||||
if (currentHealth.Value <= 0)
|
||||
if(_newValue <= 0)
|
||||
{
|
||||
Die();
|
||||
}
|
||||
}
|
||||
|
||||
private void Die()
|
||||
public void TakeDamage(int _damageAmount)
|
||||
{
|
||||
if(!IsServer) return;
|
||||
|
||||
isDead.Value = true;
|
||||
OnDiedClientRpc();
|
||||
if (!isServer) return;
|
||||
if(isDead.Value) return;
|
||||
|
||||
// RoundManager.Current?.OnPlayerDied(this);
|
||||
}
|
||||
|
||||
[ClientRpc]
|
||||
private void OnDiedClientRpc()
|
||||
{
|
||||
Debug.Log($"Player {OwnerClientId} died");
|
||||
SetPhysicsAndVisualsActive(false);
|
||||
currentHealth.Value = Mathf.Max(0, currentHealth.Value - _damageAmount);
|
||||
}
|
||||
|
||||
public override void OnNetworkDespawn()
|
||||
@@ -72,15 +57,36 @@ public class PlayerHealth : NetworkBehaviour
|
||||
currentHealth.OnValueChanged -= OnHealthChanged;
|
||||
}
|
||||
|
||||
private void Die()
|
||||
{
|
||||
if(!isServer) return;
|
||||
|
||||
isDead.Value = true;
|
||||
OnDiedClientRpc();
|
||||
}
|
||||
|
||||
public void Respawn(Vector3 _spawnPosition)
|
||||
{
|
||||
if(!IsServer) return;
|
||||
if(!isServer) return;
|
||||
|
||||
isDead.Value = false;
|
||||
currentHealth.Value = maxHealth;
|
||||
RespawnClientRpc(_spawnPosition);
|
||||
}
|
||||
|
||||
public void PushCurrentHealthValue()
|
||||
{
|
||||
HealthChanged?.Invoke(currentHealth.Value, maxHealth);
|
||||
}
|
||||
|
||||
[ClientRpc]
|
||||
private void OnDiedClientRpc()
|
||||
{
|
||||
Debug.Log($"Player {OwnerClientId} died");
|
||||
SetPhysicsAndVisualsActive(false);
|
||||
Died?.Invoke();
|
||||
}
|
||||
|
||||
[ClientRpc]
|
||||
private void RespawnClientRpc(Vector3 _spawnPosition)
|
||||
{
|
||||
@@ -96,6 +102,15 @@ public class PlayerHealth : NetworkBehaviour
|
||||
foreach (MeshRenderer meshRenderer in GetComponentsInChildren<MeshRenderer>())
|
||||
meshRenderer.enabled = _isActive;
|
||||
|
||||
GetComponent<Rigidbody>().isKinematic = !_isActive;
|
||||
Rigidbody rigidbody = GetComponent<Rigidbody>();
|
||||
if (rigidbody == null) return;
|
||||
|
||||
rigidbody.isKinematic = !_isActive;
|
||||
|
||||
if (_isActive)
|
||||
{
|
||||
rigidbody.linearVelocity = Vector3.zero;
|
||||
rigidbody.angularVelocity = Vector3.zero;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class PlayerHealthUIController : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private PlayerHealthView view;
|
||||
|
||||
public void Bind(PlayerHealth _playerHealth)
|
||||
{
|
||||
_playerHealth.HealthChanged += OnHealthChanged;
|
||||
|
||||
_playerHealth.PushCurrentHealthValue();
|
||||
}
|
||||
|
||||
public void OnHealthChanged(int _currentHealth, int _maxHealth)
|
||||
{
|
||||
view.UpdateHealth(_currentHealth, _maxHealth);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 44d1556056dfc6f4da444f682c5a8de2
|
||||
@@ -0,0 +1,15 @@
|
||||
using UnityEngine;
|
||||
using TMPro;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class PlayerHealthView : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private TMP_Text healthText;
|
||||
[SerializeField] private Image healthBar;
|
||||
|
||||
public void UpdateHealth(int _currentHealth, int _maxHealth)
|
||||
{
|
||||
healthText.text = $"{_currentHealth}/{_maxHealth}";
|
||||
healthBar.fillAmount = (float)_currentHealth / _maxHealth;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 59027e05b1e47d84d844ed542398d01a
|
||||
@@ -0,0 +1,235 @@
|
||||
using UnityEngine;
|
||||
|
||||
/// <summary>
|
||||
/// Отзывчивый аркадный FPS-контроллер на CharacterController.
|
||||
/// Move() вызывается в Update — движение плавное на частоте кадров без интерполяции.
|
||||
/// Step offset и slope limit — встроенные в CharacterController.
|
||||
/// Init() вызывается из PlayerFacade только у владельца.
|
||||
/// </summary>
|
||||
[RequireComponent(typeof(CharacterController))]
|
||||
public class PlayerMovement : MonoBehaviour
|
||||
{
|
||||
[Header("Speed")]
|
||||
[SerializeField] private float walkSpeed = 8f;
|
||||
[SerializeField] private float sprintSpeed = 12f;
|
||||
|
||||
[Header("Acceleration")]
|
||||
[SerializeField] private float groundAcceleration = 80f; // как быстро набираем скорость на земле
|
||||
[SerializeField] private float airAcceleration = 30f; // управление в воздухе
|
||||
[SerializeField] private float groundDeceleration = 60f; // трение/торможение при отпускании клавиш
|
||||
|
||||
[Header("Jump")]
|
||||
[SerializeField] private float jumpHeight = 1.6f; // желаемая высота прыжка в метрах
|
||||
[SerializeField] private float coyoteTime = 0.12f; // окно прыжка после схода с края
|
||||
[SerializeField] private float jumpBufferTime = 0.12f; // окно "запоминания" нажатия прыжка
|
||||
|
||||
[Header("Gravity")]
|
||||
[SerializeField] private float gravity = -28f; // выше реального -9.81 = более аркадно/отзывчиво
|
||||
[SerializeField] private float fallMultiplier = 1.6f; // падаем тяжелее — меньше "плавучести"
|
||||
[SerializeField] private float lowJumpMultiplier = 2.5f; // отпустил прыжок раньше = короткий прыжок
|
||||
[SerializeField] private float maxFallSpeed = -40f; // ограничение скорости падения
|
||||
|
||||
[Header("Ground / Steps / Slopes")]
|
||||
[SerializeField] private float stepOffset = 0.4f; // высота ступеньки на которую можно зайти
|
||||
[SerializeField] private float slopeLimit = 50f; // макс. угол склона
|
||||
[SerializeField] private float groundStickForce = -4f; // прижим к земле чтобы не отрывало на спусках
|
||||
|
||||
[Header("Look")]
|
||||
[SerializeField] private float mouseSensitivity = 2f;
|
||||
[SerializeField] private Transform cameraRoot;
|
||||
[SerializeField] private float minPitch = -89f;
|
||||
[SerializeField] private float maxPitch = 89f;
|
||||
|
||||
private CharacterController controller;
|
||||
private PlayerHealth playerHealth;
|
||||
|
||||
private bool isActive;
|
||||
|
||||
// Горизонтальная скорость (x, z) — храним между кадрами для инерции
|
||||
private Vector3 horizontalVelocity;
|
||||
private float verticalVelocity;
|
||||
|
||||
// Look
|
||||
private float pitch;
|
||||
|
||||
// Jump timers
|
||||
private float coyoteCounter;
|
||||
private float jumpBufferCounter;
|
||||
|
||||
public void Init()
|
||||
{
|
||||
controller = GetComponent<CharacterController>();
|
||||
playerHealth = GetComponent<PlayerHealth>();
|
||||
|
||||
// Встроенные возможности CharacterController — задаём из инспектора
|
||||
controller.stepOffset = stepOffset;
|
||||
controller.slopeLimit = slopeLimit;
|
||||
|
||||
// // Прячем курсор — только у владельца, Init для не-владельца не вызывается
|
||||
// Cursor.lockState = CursorLockMode.Locked;
|
||||
// Cursor.visible = false;
|
||||
|
||||
isActive = true;
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (!isActive) return;
|
||||
|
||||
// Esc — освободить курсор (удобно в редакторе)
|
||||
// if (Input.GetKeyDown(KeyCode.Escape))
|
||||
// {
|
||||
// Cursor.lockState = CursorLockMode.None;
|
||||
// Cursor.visible = true;
|
||||
// }
|
||||
|
||||
if (IsMovementBlocked())
|
||||
{
|
||||
// Мёртвый стоит — гасим горизонталь, но гравитацию оставляем
|
||||
horizontalVelocity = Vector3.zero;
|
||||
ApplyGravityOnly();
|
||||
return;
|
||||
}
|
||||
|
||||
HandleLookYaw(); // поворот тела по горизонтали — здесь, камера-ребёнок следует за ним
|
||||
UpdateJumpTimers();
|
||||
HandleHorizontal();
|
||||
HandleJumpAndGravity();
|
||||
|
||||
// Один общий Move за кадр — и горизонталь, и вертикаль
|
||||
Vector3 velocity = horizontalVelocity + Vector3.up * verticalVelocity;
|
||||
controller.Move(velocity * Time.deltaTime);
|
||||
}
|
||||
|
||||
private void LateUpdate()
|
||||
{
|
||||
if (!isActive) return;
|
||||
|
||||
// Наклон камеры (pitch) — после движения, чтобы не было микро-дрожи
|
||||
cameraRoot.localRotation = Quaternion.Euler(pitch, 0f, 0f);
|
||||
}
|
||||
|
||||
private bool IsMovementBlocked()
|
||||
{
|
||||
return playerHealth != null && playerHealth.isDead.Value;
|
||||
}
|
||||
|
||||
// ── LOOK ──────────────────────────────────────────────
|
||||
|
||||
private void HandleLookYaw()
|
||||
{
|
||||
float mouseX = Input.GetAxis("Mouse X") * mouseSensitivity;
|
||||
transform.Rotate(Vector3.up * mouseX);
|
||||
|
||||
float mouseY = Input.GetAxis("Mouse Y") * mouseSensitivity;
|
||||
pitch = Mathf.Clamp(pitch - mouseY, minPitch, maxPitch);
|
||||
}
|
||||
|
||||
// ── HORIZONTAL MOVEMENT ───────────────────────────────
|
||||
|
||||
private void HandleHorizontal()
|
||||
{
|
||||
Vector3 input = new Vector3(Input.GetAxisRaw("Horizontal"), 0f, Input.GetAxisRaw("Vertical"));
|
||||
input = Vector3.ClampMagnitude(input, 1f);
|
||||
|
||||
Vector3 wishDirection = transform.right * input.x + transform.forward * input.z;
|
||||
bool isSprinting = Input.GetKey(KeyCode.LeftShift);
|
||||
float targetSpeed = isSprinting ? sprintSpeed : walkSpeed;
|
||||
|
||||
bool grounded = controller.isGrounded;
|
||||
|
||||
if (wishDirection.sqrMagnitude > 0.01f)
|
||||
{
|
||||
// Есть ввод — разгоняемся к целевой скорости
|
||||
float acceleration = grounded ? groundAcceleration : airAcceleration;
|
||||
Vector3 targetVelocity = wishDirection * targetSpeed;
|
||||
horizontalVelocity = Vector3.MoveTowards(
|
||||
horizontalVelocity,
|
||||
targetVelocity,
|
||||
acceleration * Time.deltaTime
|
||||
);
|
||||
}
|
||||
else if (grounded)
|
||||
{
|
||||
// Нет ввода на земле — тормозим до нуля (трение)
|
||||
horizontalVelocity = Vector3.MoveTowards(
|
||||
horizontalVelocity,
|
||||
Vector3.zero,
|
||||
groundDeceleration * Time.deltaTime
|
||||
);
|
||||
}
|
||||
// В воздухе без ввода — сохраняем импульс (момент инерции)
|
||||
}
|
||||
|
||||
// ── JUMP & GRAVITY ────────────────────────────────────
|
||||
|
||||
private void UpdateJumpTimers()
|
||||
{
|
||||
if (controller.isGrounded)
|
||||
coyoteCounter = coyoteTime;
|
||||
else
|
||||
coyoteCounter -= Time.deltaTime;
|
||||
|
||||
if (Input.GetButtonDown("Jump"))
|
||||
jumpBufferCounter = jumpBufferTime;
|
||||
else
|
||||
jumpBufferCounter -= Time.deltaTime;
|
||||
}
|
||||
|
||||
private void HandleJumpAndGravity()
|
||||
{
|
||||
bool grounded = controller.isGrounded;
|
||||
|
||||
// Прижим к земле — иначе на спусках и ступеньках вниз отрывает в "полёт"
|
||||
if (grounded && verticalVelocity < 0f)
|
||||
verticalVelocity = groundStickForce;
|
||||
|
||||
// Прыжок: есть буфер нажатия И есть coyote-окно
|
||||
if (jumpBufferCounter > 0f && coyoteCounter > 0f)
|
||||
{
|
||||
jumpBufferCounter = 0f;
|
||||
coyoteCounter = 0f;
|
||||
|
||||
// Скорость из желаемой высоты: v = sqrt(2 * h * g)
|
||||
verticalVelocity = Mathf.Sqrt(jumpHeight * -2f * gravity);
|
||||
}
|
||||
|
||||
ApplyGravity(grounded);
|
||||
}
|
||||
|
||||
private void ApplyGravity(bool grounded)
|
||||
{
|
||||
if (grounded && verticalVelocity <= 0f)
|
||||
return; // на земле гравитацию не копим (кроме прыжка вверх)
|
||||
|
||||
float g = gravity;
|
||||
|
||||
if (verticalVelocity < 0f)
|
||||
{
|
||||
g *= fallMultiplier; // падаем — тяжелее
|
||||
}
|
||||
else if (verticalVelocity > 0f && !Input.GetButton("Jump"))
|
||||
{
|
||||
g *= lowJumpMultiplier; // отпустил прыжок — короткий хоп
|
||||
}
|
||||
|
||||
verticalVelocity += g * Time.deltaTime;
|
||||
verticalVelocity = Mathf.Max(verticalVelocity, maxFallSpeed);
|
||||
}
|
||||
|
||||
// Используется когда движение заблокировано (смерть) — только падение
|
||||
private void ApplyGravityOnly()
|
||||
{
|
||||
if (controller == null) return;
|
||||
|
||||
if (controller.isGrounded && verticalVelocity < 0f)
|
||||
verticalVelocity = groundStickForce;
|
||||
else
|
||||
{
|
||||
verticalVelocity += gravity * Time.deltaTime;
|
||||
verticalVelocity = Mathf.Max(verticalVelocity, maxFallSpeed);
|
||||
}
|
||||
|
||||
controller.Move(Vector3.up * verticalVelocity * Time.deltaTime);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1e2a76beda2b2fb4aa4bab0306e24560
|
||||
@@ -11,22 +11,32 @@ public class PlayerShoot : NetworkBehaviour
|
||||
|
||||
private PlayerHealth playerHealth;
|
||||
|
||||
public override void OnNetworkSpawn()
|
||||
private bool isActive = false;
|
||||
|
||||
public void Init()
|
||||
{
|
||||
if (IsOwner)
|
||||
{
|
||||
playerHealth = GetComponent<PlayerHealth>();
|
||||
if (playerHealth == null)
|
||||
{
|
||||
Debug.LogError("PlayerHealth component not found on player");
|
||||
}
|
||||
}
|
||||
isActive = true;
|
||||
}
|
||||
|
||||
|
||||
// public override void OnNetworkSpawn()
|
||||
// {
|
||||
// if (IsOwner)
|
||||
// {
|
||||
// playerHealth = GetComponent<PlayerHealth>();
|
||||
// if (playerHealth == null)
|
||||
// {
|
||||
// Debug.LogError("PlayerHealth component not found on player");
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
void Update()
|
||||
{
|
||||
if (!IsOwner) return;
|
||||
|
||||
if(!isActive) return;
|
||||
|
||||
playerHealth = GetComponent<PlayerHealth>();
|
||||
|
||||
if(playerHealth == null || playerHealth.isDead.Value) return;
|
||||
|
||||
if (Input.GetMouseButtonDown(0))
|
||||
@@ -59,7 +69,7 @@ public class PlayerShoot : NetworkBehaviour
|
||||
[ClientRpc]
|
||||
private void SpawnHitEffectClientRpc(Vector3 _hitPosition)
|
||||
{
|
||||
Debug.Log($"Spawning hit effect at {_hitPosition}");
|
||||
// Debug.Log($"Spawning hit effect at {_hitPosition}");
|
||||
Instantiate(hitEffectPrefab, _hitPosition, Quaternion.identity);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,17 +1,25 @@
|
||||
using UnityEngine;
|
||||
using Unity.Netcode;
|
||||
using System.Collections;
|
||||
using TMPro;
|
||||
|
||||
public class PlayerUIController : NetworkBehaviour
|
||||
public class PlayerUIController : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private Canvas hudCanvas;
|
||||
[SerializeField] private PlayerHealthUIController playerHealthUIController;
|
||||
|
||||
public IEnumerator Start()
|
||||
|
||||
private PlayerFacade playerFacade;
|
||||
|
||||
private bool isActive = false;
|
||||
|
||||
public void Init(PlayerFacade _playerFacade)
|
||||
{
|
||||
NetworkObject _netObj = GetComponentInParent<NetworkObject>();
|
||||
isActive = true;
|
||||
|
||||
yield return new WaitUntil(() => _netObj != null);
|
||||
playerFacade = _playerFacade;
|
||||
|
||||
playerHealthUIController.Bind(playerFacade.PlayerHealth);
|
||||
|
||||
hudCanvas.enabled = _netObj.IsOwner;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using TMPro;
|
||||
using Unity.Netcode;
|
||||
using UnityEngine;
|
||||
|
||||
@@ -28,6 +29,9 @@ public class RoundManager : NetworkBehaviour
|
||||
[SerializeField] private float roundStartDelay = 3f;
|
||||
[SerializeField] private Transform[] spawnPoints;
|
||||
|
||||
private NetworkVariable<float> roundDuration = new NetworkVariable<float>(180f);
|
||||
private NetworkVariable<float> roundTimeRemaining = new NetworkVariable<float>(0f);
|
||||
|
||||
private NetworkVariable<int> currentRound = new NetworkVariable<int>(0);
|
||||
private NetworkVariable<bool> isRoundActive = new NetworkVariable<bool>(false);
|
||||
|
||||
@@ -35,24 +39,51 @@ public class RoundManager : NetworkBehaviour
|
||||
|
||||
private NetworkList<PlayerScore> playerScores;
|
||||
|
||||
void Awake()
|
||||
{
|
||||
Current = this;
|
||||
|
||||
playerScores = new NetworkList<PlayerScore>();
|
||||
}
|
||||
|
||||
private bool isTimerRunning = false;
|
||||
|
||||
public override void OnNetworkSpawn()
|
||||
{
|
||||
currentRound.OnValueChanged += OnRoundChanged;
|
||||
isRoundActive.OnValueChanged += OnRoundStateChanged;
|
||||
|
||||
// roundTimeRemaining.OnValueChanged += OnTimerChanged;
|
||||
|
||||
if (IsServer)
|
||||
{
|
||||
// StartTimerServerRPC();
|
||||
StartCoroutine(StartRoundWithDelay());
|
||||
}
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (!IsServer) return;
|
||||
if(!IsRoundActive) return;
|
||||
|
||||
roundTimeRemaining.Value = Mathf.Max(0f, roundTimeRemaining.Value - Time.deltaTime);
|
||||
|
||||
if(roundTimeRemaining.Value <= 0f)
|
||||
{
|
||||
StartCoroutine(EndRound(0ul));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// public void OnTimerChanged(float _previousValue, float _newValue)
|
||||
|
||||
|
||||
void Awake()
|
||||
{
|
||||
Current = this;
|
||||
|
||||
playerScores = new NetworkList<PlayerScore>();
|
||||
roundTimeRemaining.Value = roundDuration.Value;
|
||||
}
|
||||
|
||||
|
||||
public void OnPlayerFellIntoPit(ulong _winnerClientId)
|
||||
{
|
||||
if (!IsServer) return;
|
||||
|
||||
Reference in New Issue
Block a user