Added inventory system to player
This commit is contained in:
parent
a299230ab6
commit
ec89584e97
31 changed files with 1634 additions and 1881 deletions
File diff suppressed because it is too large
Load diff
|
|
@ -447,7 +447,7 @@
|
||||||
"id": "2cc562f6-1b6c-4033-b783-2a481ab11dec",
|
"id": "2cc562f6-1b6c-4033-b783-2a481ab11dec",
|
||||||
"actions": [
|
"actions": [
|
||||||
{
|
{
|
||||||
"name": "SpeedDown",
|
"name": "FlyFast",
|
||||||
"type": "PassThrough",
|
"type": "PassThrough",
|
||||||
"id": "1e150f46-f771-4738-92fc-2fc13b6697b7",
|
"id": "1e150f46-f771-4738-92fc-2fc13b6697b7",
|
||||||
"expectedControlType": "Button",
|
"expectedControlType": "Button",
|
||||||
|
|
@ -456,7 +456,7 @@
|
||||||
"initialStateCheck": false
|
"initialStateCheck": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "SpeedUp",
|
"name": "FlySlow",
|
||||||
"type": "PassThrough",
|
"type": "PassThrough",
|
||||||
"id": "4ec09521-b697-424d-b042-16c4c355012c",
|
"id": "4ec09521-b697-424d-b042-16c4c355012c",
|
||||||
"expectedControlType": "Button",
|
"expectedControlType": "Button",
|
||||||
|
|
@ -481,6 +481,15 @@
|
||||||
"processors": "",
|
"processors": "",
|
||||||
"interactions": "",
|
"interactions": "",
|
||||||
"initialStateCheck": false
|
"initialStateCheck": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "ScrollSpeedControlw",
|
||||||
|
"type": "PassThrough",
|
||||||
|
"id": "c6404499-255c-4521-abfa-5fb829afd1e0",
|
||||||
|
"expectedControlType": "Vector2",
|
||||||
|
"processors": "",
|
||||||
|
"interactions": "",
|
||||||
|
"initialStateCheck": false
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"bindings": [
|
"bindings": [
|
||||||
|
|
@ -491,7 +500,7 @@
|
||||||
"interactions": "",
|
"interactions": "",
|
||||||
"processors": "",
|
"processors": "",
|
||||||
"groups": "KeyboardAndMouse",
|
"groups": "KeyboardAndMouse",
|
||||||
"action": "SpeedDown",
|
"action": "FlyFast",
|
||||||
"isComposite": false,
|
"isComposite": false,
|
||||||
"isPartOfComposite": false
|
"isPartOfComposite": false
|
||||||
},
|
},
|
||||||
|
|
@ -502,7 +511,7 @@
|
||||||
"interactions": "",
|
"interactions": "",
|
||||||
"processors": "",
|
"processors": "",
|
||||||
"groups": "Gamepad",
|
"groups": "Gamepad",
|
||||||
"action": "SpeedDown",
|
"action": "FlyFast",
|
||||||
"isComposite": false,
|
"isComposite": false,
|
||||||
"isPartOfComposite": false
|
"isPartOfComposite": false
|
||||||
},
|
},
|
||||||
|
|
@ -513,7 +522,7 @@
|
||||||
"interactions": "",
|
"interactions": "",
|
||||||
"processors": "",
|
"processors": "",
|
||||||
"groups": "KeyboardAndMouse",
|
"groups": "KeyboardAndMouse",
|
||||||
"action": "SpeedUp",
|
"action": "FlySlow",
|
||||||
"isComposite": false,
|
"isComposite": false,
|
||||||
"isPartOfComposite": false
|
"isPartOfComposite": false
|
||||||
},
|
},
|
||||||
|
|
@ -524,7 +533,7 @@
|
||||||
"interactions": "",
|
"interactions": "",
|
||||||
"processors": "",
|
"processors": "",
|
||||||
"groups": "Gamepad",
|
"groups": "Gamepad",
|
||||||
"action": "SpeedUp",
|
"action": "FlySlow",
|
||||||
"isComposite": false,
|
"isComposite": false,
|
||||||
"isPartOfComposite": false
|
"isPartOfComposite": false
|
||||||
},
|
},
|
||||||
|
|
@ -549,6 +558,17 @@
|
||||||
"action": "FlyDown",
|
"action": "FlyDown",
|
||||||
"isComposite": false,
|
"isComposite": false,
|
||||||
"isPartOfComposite": false
|
"isPartOfComposite": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "",
|
||||||
|
"id": "cd457b70-a6c0-4b36-ae23-a86735c06bee",
|
||||||
|
"path": "<Mouse>/scroll",
|
||||||
|
"interactions": "",
|
||||||
|
"processors": "",
|
||||||
|
"groups": "",
|
||||||
|
"action": "ScrollSpeedControlw",
|
||||||
|
"isComposite": false,
|
||||||
|
"isPartOfComposite": false
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
8
Assets/Roles.meta
Normal file
8
Assets/Roles.meta
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 96abcc748c6e1f844bdafc9894b7fb75
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
18
Assets/Roles/Detective.asset
Normal file
18
Assets/Roles/Detective.asset
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
%YAML 1.1
|
||||||
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!114 &11400000
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 0}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: ffe32805eb7bde24bb85bb43c12614e6, type: 3}
|
||||||
|
m_Name: Detective
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
roleName: Detective
|
||||||
|
roleId: 1
|
||||||
|
roleColor: {r: 0, g: 0, b: 1, a: 0}
|
||||||
|
roleTeam: 0
|
||||||
8
Assets/Roles/Detective.asset.meta
Normal file
8
Assets/Roles/Detective.asset.meta
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 87d3bd07dfb8cad4abc8d1e45c65ad38
|
||||||
|
NativeFormatImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
mainObjectFileID: 11400000
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
18
Assets/Roles/Innocent.asset
Normal file
18
Assets/Roles/Innocent.asset
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
%YAML 1.1
|
||||||
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!114 &11400000
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 0}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: ffe32805eb7bde24bb85bb43c12614e6, type: 3}
|
||||||
|
m_Name: Innocent
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
roleName: Innocent
|
||||||
|
roleId: 0
|
||||||
|
roleColor: {r: 0, g: 1, b: 0, a: 0}
|
||||||
|
roleTeam: 0
|
||||||
8
Assets/Roles/Innocent.asset.meta
Normal file
8
Assets/Roles/Innocent.asset.meta
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 902c73643e40b48499e05ccd846b6e7c
|
||||||
|
NativeFormatImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
mainObjectFileID: 11400000
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
18
Assets/Roles/Traitor.asset
Normal file
18
Assets/Roles/Traitor.asset
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
%YAML 1.1
|
||||||
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!114 &11400000
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 0}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: ffe32805eb7bde24bb85bb43c12614e6, type: 3}
|
||||||
|
m_Name: Traitor
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
roleName: Traitor
|
||||||
|
roleId: 2
|
||||||
|
roleColor: {r: 1, g: 0, b: 0, a: 0}
|
||||||
|
roleTeam: 1
|
||||||
8
Assets/Roles/Traitor.asset.meta
Normal file
8
Assets/Roles/Traitor.asset.meta
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 65f5156730f95fa46856a6c9fca543db
|
||||||
|
NativeFormatImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
mainObjectFileID: 11400000
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -1,10 +1,6 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using MyBox;
|
using MyBox;
|
||||||
using UnityEditor;
|
|
||||||
using UnityEditorInternal;
|
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
[Serializable]
|
[Serializable]
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ namespace TTTSC.Player.Character.Controller.Alive
|
||||||
private bool _performingMoveInput;
|
private bool _performingMoveInput;
|
||||||
private Vector3 _moveDirection;
|
private Vector3 _moveDirection;
|
||||||
|
|
||||||
private void Awake()
|
private void Start()
|
||||||
{
|
{
|
||||||
_playerGhostReffrenceHub = GetComponentInParent<PlayerGhostReffrenceHub>();
|
_playerGhostReffrenceHub = GetComponentInParent<PlayerGhostReffrenceHub>();
|
||||||
_characterRigidbody = _playerGhostReffrenceHub.characterRigidbody;
|
_characterRigidbody = _playerGhostReffrenceHub.characterRigidbody;
|
||||||
|
|
@ -48,11 +48,20 @@ namespace TTTSC.Player.Character.Controller.Alive
|
||||||
|
|
||||||
_playerInputReceiver.MoveInputEvent += MoveInput;
|
_playerInputReceiver.MoveInputEvent += MoveInput;
|
||||||
_playerInputReceiver.JumpInputEvent += JumpInput;
|
_playerInputReceiver.JumpInputEvent += JumpInput;
|
||||||
|
|
||||||
|
_characterRigidbody = _playerGhostReffrenceHub.characterRigidbody;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Start()
|
private void OnDisable()
|
||||||
{
|
{
|
||||||
_characterRigidbody = _playerGhostReffrenceHub.characterRigidbody;
|
_playerInputReceiver.MoveInputEvent -= MoveInput;
|
||||||
|
_playerInputReceiver.JumpInputEvent -= JumpInput;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnDestroy()
|
||||||
|
{
|
||||||
|
_playerInputReceiver.MoveInputEvent -= MoveInput;
|
||||||
|
_playerInputReceiver.JumpInputEvent -= JumpInput;
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Input event listeners
|
#region Input event listeners
|
||||||
|
|
|
||||||
|
|
@ -13,15 +13,11 @@ namespace TTTSC.Player.Character.Controller
|
||||||
|
|
||||||
private bool _walkIsPerforming, _crouchIsHeld, _sprintIsPerforming;
|
private bool _walkIsPerforming, _crouchIsHeld, _sprintIsPerforming;
|
||||||
|
|
||||||
private void Awake()
|
private void Start()
|
||||||
{
|
{
|
||||||
_playerGhostReffrenceHub = GetComponentInParent<PlayerGhostReffrenceHub>();
|
_playerGhostReffrenceHub = GetComponentInParent<PlayerGhostReffrenceHub>();
|
||||||
_playerInputReceiver = _playerGhostReffrenceHub.playerInputReceiver;
|
_playerInputReceiver = _playerGhostReffrenceHub.playerInputReceiver;
|
||||||
_characterStateMachine = GetComponent<CharacterStateMachine>();
|
_characterStateMachine = GetComponent<CharacterStateMachine>();
|
||||||
}
|
|
||||||
|
|
||||||
private void Start()
|
|
||||||
{
|
|
||||||
_playerInputReceiver.MoveInputEvent += Walk;
|
_playerInputReceiver.MoveInputEvent += Walk;
|
||||||
_playerInputReceiver.CrouchInputEvent += Crouch;
|
_playerInputReceiver.CrouchInputEvent += Crouch;
|
||||||
_playerInputReceiver.SprintInputEvent += Sprint;
|
_playerInputReceiver.SprintInputEvent += Sprint;
|
||||||
|
|
|
||||||
|
|
@ -15,9 +15,10 @@ namespace TTTSC.Player.Character.Controller
|
||||||
|
|
||||||
|
|
||||||
#region SpectatorControls
|
#region SpectatorControls
|
||||||
|
public event Action<Vector2, bool> SpectatorScrollSpeedInputEvent;
|
||||||
public event Action<bool, float> SpectatorSpeedUpInputEvent, SpectatorSlowDownEvent, FlyUpInputEvent, FlyDownInputEvent;
|
public event Action<bool, float> SpectatorSpeedUpInputEvent, SpectatorSlowDownEvent, FlyUpInputEvent, FlyDownInputEvent;
|
||||||
bool _spectatorSpeedUpIsHeld, _spectatorSlowDownIsHeld, _flyUpIsHeld, _flyDownIsHeld;
|
bool _spectatorSpeedUpIsHeld, _spectatorSlowDownIsHeld, _flyUpIsHeld, _flyDownIsHeld;
|
||||||
float _spectatorSpeedUpStageValue, _spectatorSlowDownStageValue, _flyUpStageValue, _flyDownStageValue;
|
float _spectatorFlyFastStageValue, _spectatorFlySlowStageValue, _flyUpStageValue, _flyDownStageValue;
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
public PlayerInputSender playerInputEvents;
|
public PlayerInputSender playerInputEvents;
|
||||||
|
|
@ -52,8 +53,8 @@ namespace TTTSC.Player.Character.Controller
|
||||||
//
|
//
|
||||||
#region SpectatorControls
|
#region SpectatorControls
|
||||||
|
|
||||||
playerInputEvents.SpectatorControls.SpeedUp.performed += SpectatorSpeedUp;
|
playerInputEvents.SpectatorControls.FlyFast.performed += SpectatorFlyFast;
|
||||||
playerInputEvents.SpectatorControls.SpeedDown.performed += SpectatorSlowDown;
|
playerInputEvents.SpectatorControls.FlySlow.performed += SpectatorFlySlow;
|
||||||
playerInputEvents.SpectatorControls.FlyUp.performed += SpectatorFlyUp;
|
playerInputEvents.SpectatorControls.FlyUp.performed += SpectatorFlyUp;
|
||||||
playerInputEvents.SpectatorControls.FlyDown.performed += SpectatorFlyDown;
|
playerInputEvents.SpectatorControls.FlyDown.performed += SpectatorFlyDown;
|
||||||
|
|
||||||
|
|
@ -87,8 +88,8 @@ namespace TTTSC.Player.Character.Controller
|
||||||
//
|
//
|
||||||
#region SpectatorControls
|
#region SpectatorControls
|
||||||
|
|
||||||
playerInputEvents.SpectatorControls.SpeedUp.performed -= SpectatorSpeedUp;
|
playerInputEvents.SpectatorControls.FlyFast.performed -= SpectatorFlyFast;
|
||||||
playerInputEvents.SpectatorControls.SpeedDown.performed -= SpectatorSlowDown;
|
playerInputEvents.SpectatorControls.FlySlow.performed -= SpectatorFlySlow;
|
||||||
playerInputEvents.SpectatorControls.FlyUp.performed -= SpectatorFlyUp;
|
playerInputEvents.SpectatorControls.FlyUp.performed -= SpectatorFlyUp;
|
||||||
playerInputEvents.SpectatorControls.FlyDown.performed -= SpectatorFlyDown;
|
playerInputEvents.SpectatorControls.FlyDown.performed -= SpectatorFlyDown;
|
||||||
|
|
||||||
|
|
@ -182,6 +183,7 @@ namespace TTTSC.Player.Character.Controller
|
||||||
|
|
||||||
private void FixedUpdate()
|
private void FixedUpdate()
|
||||||
{
|
{
|
||||||
|
//
|
||||||
#region AliveControls
|
#region AliveControls
|
||||||
|
|
||||||
playerInputEvents.AliveControls.Sprint.started += ctx => _sprintStageValue = 1;
|
playerInputEvents.AliveControls.Sprint.started += ctx => _sprintStageValue = 1;
|
||||||
|
|
@ -207,17 +209,17 @@ namespace TTTSC.Player.Character.Controller
|
||||||
//
|
//
|
||||||
#region SpectatorControls
|
#region SpectatorControls
|
||||||
|
|
||||||
playerInputEvents.SpectatorControls.SpeedUp.started += ctx => _spectatorSpeedUpStageValue = 1;
|
playerInputEvents.SpectatorControls.FlyFast.started += ctx => _spectatorFlyFastStageValue = 1;
|
||||||
playerInputEvents.SpectatorControls.SpeedUp.performed += ctx => _spectatorSpeedUpStageValue = 2;
|
playerInputEvents.SpectatorControls.FlyFast.performed += ctx => _spectatorFlyFastStageValue = 2;
|
||||||
playerInputEvents.SpectatorControls.SpeedUp.canceled += ctx => _spectatorSpeedUpStageValue = 0;
|
playerInputEvents.SpectatorControls.FlyFast.canceled += ctx => _spectatorFlyFastStageValue = 0;
|
||||||
|
|
||||||
SpectatorSpeedUpInputEvent?.Invoke(_spectatorSpeedUpIsHeld, _spectatorSpeedUpStageValue);
|
SpectatorSpeedUpInputEvent?.Invoke(_spectatorSpeedUpIsHeld, _spectatorFlyFastStageValue);
|
||||||
|
|
||||||
playerInputEvents.SpectatorControls.SpeedDown.started += ctx => _spectatorSlowDownStageValue = 1;
|
playerInputEvents.SpectatorControls.FlySlow.started += ctx => _spectatorFlySlowStageValue = 1;
|
||||||
playerInputEvents.SpectatorControls.SpeedDown.performed += ctx => _spectatorSlowDownStageValue = 2;
|
playerInputEvents.SpectatorControls.FlySlow.performed += ctx => _spectatorFlySlowStageValue = 2;
|
||||||
playerInputEvents.SpectatorControls.SpeedDown.canceled += ctx => _spectatorSlowDownStageValue = 0;
|
playerInputEvents.SpectatorControls.FlySlow.canceled += ctx => _spectatorFlySlowStageValue = 0;
|
||||||
|
|
||||||
SpectatorSlowDownEvent?.Invoke(_spectatorSlowDownIsHeld, _spectatorSlowDownStageValue);
|
SpectatorSlowDownEvent?.Invoke(_spectatorSlowDownIsHeld, _spectatorFlySlowStageValue);
|
||||||
|
|
||||||
playerInputEvents.SpectatorControls.FlyUp.started += ctx => _flyUpStageValue = 1;
|
playerInputEvents.SpectatorControls.FlyUp.started += ctx => _flyUpStageValue = 1;
|
||||||
playerInputEvents.SpectatorControls.FlyUp.performed += ctx => _flyUpStageValue = 2;
|
playerInputEvents.SpectatorControls.FlyUp.performed += ctx => _flyUpStageValue = 2;
|
||||||
|
|
@ -303,14 +305,14 @@ namespace TTTSC.Player.Character.Controller
|
||||||
|
|
||||||
#region SpectatorControls
|
#region SpectatorControls
|
||||||
|
|
||||||
private void SpectatorSpeedUp(InputAction.CallbackContext ctx)
|
private void SpectatorFlyFast(InputAction.CallbackContext ctx)
|
||||||
{
|
{
|
||||||
float value = ctx.ReadValue<float>();
|
float value = ctx.ReadValue<float>();
|
||||||
|
|
||||||
_spectatorSpeedUpIsHeld = FloatBool(value, "==", 1);
|
_spectatorSpeedUpIsHeld = FloatBool(value, "==", 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SpectatorSlowDown(InputAction.CallbackContext ctx)
|
private void SpectatorFlySlow(InputAction.CallbackContext ctx)
|
||||||
{
|
{
|
||||||
float value = ctx.ReadValue<float>();
|
float value = ctx.ReadValue<float>();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -471,7 +471,7 @@ namespace TTTSC.Player.Character.Controller
|
||||||
""id"": ""2cc562f6-1b6c-4033-b783-2a481ab11dec"",
|
""id"": ""2cc562f6-1b6c-4033-b783-2a481ab11dec"",
|
||||||
""actions"": [
|
""actions"": [
|
||||||
{
|
{
|
||||||
""name"": ""SpeedDown"",
|
""name"": ""FlyFast"",
|
||||||
""type"": ""PassThrough"",
|
""type"": ""PassThrough"",
|
||||||
""id"": ""1e150f46-f771-4738-92fc-2fc13b6697b7"",
|
""id"": ""1e150f46-f771-4738-92fc-2fc13b6697b7"",
|
||||||
""expectedControlType"": ""Button"",
|
""expectedControlType"": ""Button"",
|
||||||
|
|
@ -480,7 +480,7 @@ namespace TTTSC.Player.Character.Controller
|
||||||
""initialStateCheck"": false
|
""initialStateCheck"": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
""name"": ""SpeedUp"",
|
""name"": ""FlySlow"",
|
||||||
""type"": ""PassThrough"",
|
""type"": ""PassThrough"",
|
||||||
""id"": ""4ec09521-b697-424d-b042-16c4c355012c"",
|
""id"": ""4ec09521-b697-424d-b042-16c4c355012c"",
|
||||||
""expectedControlType"": ""Button"",
|
""expectedControlType"": ""Button"",
|
||||||
|
|
@ -505,6 +505,15 @@ namespace TTTSC.Player.Character.Controller
|
||||||
""processors"": """",
|
""processors"": """",
|
||||||
""interactions"": """",
|
""interactions"": """",
|
||||||
""initialStateCheck"": false
|
""initialStateCheck"": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
""name"": ""ScrollSpeedControlw"",
|
||||||
|
""type"": ""PassThrough"",
|
||||||
|
""id"": ""c6404499-255c-4521-abfa-5fb829afd1e0"",
|
||||||
|
""expectedControlType"": ""Vector2"",
|
||||||
|
""processors"": """",
|
||||||
|
""interactions"": """",
|
||||||
|
""initialStateCheck"": false
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
""bindings"": [
|
""bindings"": [
|
||||||
|
|
@ -515,7 +524,7 @@ namespace TTTSC.Player.Character.Controller
|
||||||
""interactions"": """",
|
""interactions"": """",
|
||||||
""processors"": """",
|
""processors"": """",
|
||||||
""groups"": ""KeyboardAndMouse"",
|
""groups"": ""KeyboardAndMouse"",
|
||||||
""action"": ""SpeedDown"",
|
""action"": ""FlyFast"",
|
||||||
""isComposite"": false,
|
""isComposite"": false,
|
||||||
""isPartOfComposite"": false
|
""isPartOfComposite"": false
|
||||||
},
|
},
|
||||||
|
|
@ -526,7 +535,7 @@ namespace TTTSC.Player.Character.Controller
|
||||||
""interactions"": """",
|
""interactions"": """",
|
||||||
""processors"": """",
|
""processors"": """",
|
||||||
""groups"": ""Gamepad"",
|
""groups"": ""Gamepad"",
|
||||||
""action"": ""SpeedDown"",
|
""action"": ""FlyFast"",
|
||||||
""isComposite"": false,
|
""isComposite"": false,
|
||||||
""isPartOfComposite"": false
|
""isPartOfComposite"": false
|
||||||
},
|
},
|
||||||
|
|
@ -537,7 +546,7 @@ namespace TTTSC.Player.Character.Controller
|
||||||
""interactions"": """",
|
""interactions"": """",
|
||||||
""processors"": """",
|
""processors"": """",
|
||||||
""groups"": ""KeyboardAndMouse"",
|
""groups"": ""KeyboardAndMouse"",
|
||||||
""action"": ""SpeedUp"",
|
""action"": ""FlySlow"",
|
||||||
""isComposite"": false,
|
""isComposite"": false,
|
||||||
""isPartOfComposite"": false
|
""isPartOfComposite"": false
|
||||||
},
|
},
|
||||||
|
|
@ -548,7 +557,7 @@ namespace TTTSC.Player.Character.Controller
|
||||||
""interactions"": """",
|
""interactions"": """",
|
||||||
""processors"": """",
|
""processors"": """",
|
||||||
""groups"": ""Gamepad"",
|
""groups"": ""Gamepad"",
|
||||||
""action"": ""SpeedUp"",
|
""action"": ""FlySlow"",
|
||||||
""isComposite"": false,
|
""isComposite"": false,
|
||||||
""isPartOfComposite"": false
|
""isPartOfComposite"": false
|
||||||
},
|
},
|
||||||
|
|
@ -573,6 +582,17 @@ namespace TTTSC.Player.Character.Controller
|
||||||
""action"": ""FlyDown"",
|
""action"": ""FlyDown"",
|
||||||
""isComposite"": false,
|
""isComposite"": false,
|
||||||
""isPartOfComposite"": false
|
""isPartOfComposite"": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
""name"": """",
|
||||||
|
""id"": ""cd457b70-a6c0-4b36-ae23-a86735c06bee"",
|
||||||
|
""path"": ""<Mouse>/scroll"",
|
||||||
|
""interactions"": """",
|
||||||
|
""processors"": """",
|
||||||
|
""groups"": """",
|
||||||
|
""action"": ""ScrollSpeedControlw"",
|
||||||
|
""isComposite"": false,
|
||||||
|
""isPartOfComposite"": false
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
@ -631,10 +651,11 @@ namespace TTTSC.Player.Character.Controller
|
||||||
m_AliveControls_DropAmmo = m_AliveControls.FindAction("DropAmmo", throwIfNotFound: true);
|
m_AliveControls_DropAmmo = m_AliveControls.FindAction("DropAmmo", throwIfNotFound: true);
|
||||||
// SpectatorControls
|
// SpectatorControls
|
||||||
m_SpectatorControls = asset.FindActionMap("SpectatorControls", throwIfNotFound: true);
|
m_SpectatorControls = asset.FindActionMap("SpectatorControls", throwIfNotFound: true);
|
||||||
m_SpectatorControls_SpeedDown = m_SpectatorControls.FindAction("SpeedDown", throwIfNotFound: true);
|
m_SpectatorControls_FlyFast = m_SpectatorControls.FindAction("FlyFast", throwIfNotFound: true);
|
||||||
m_SpectatorControls_SpeedUp = m_SpectatorControls.FindAction("SpeedUp", throwIfNotFound: true);
|
m_SpectatorControls_FlySlow = m_SpectatorControls.FindAction("FlySlow", throwIfNotFound: true);
|
||||||
m_SpectatorControls_FlyUp = m_SpectatorControls.FindAction("FlyUp", throwIfNotFound: true);
|
m_SpectatorControls_FlyUp = m_SpectatorControls.FindAction("FlyUp", throwIfNotFound: true);
|
||||||
m_SpectatorControls_FlyDown = m_SpectatorControls.FindAction("FlyDown", throwIfNotFound: true);
|
m_SpectatorControls_FlyDown = m_SpectatorControls.FindAction("FlyDown", throwIfNotFound: true);
|
||||||
|
m_SpectatorControls_ScrollSpeedControlw = m_SpectatorControls.FindAction("ScrollSpeedControlw", throwIfNotFound: true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
|
|
@ -848,18 +869,20 @@ namespace TTTSC.Player.Character.Controller
|
||||||
// SpectatorControls
|
// SpectatorControls
|
||||||
private readonly InputActionMap m_SpectatorControls;
|
private readonly InputActionMap m_SpectatorControls;
|
||||||
private ISpectatorControlsActions m_SpectatorControlsActionsCallbackInterface;
|
private ISpectatorControlsActions m_SpectatorControlsActionsCallbackInterface;
|
||||||
private readonly InputAction m_SpectatorControls_SpeedDown;
|
private readonly InputAction m_SpectatorControls_FlyFast;
|
||||||
private readonly InputAction m_SpectatorControls_SpeedUp;
|
private readonly InputAction m_SpectatorControls_FlySlow;
|
||||||
private readonly InputAction m_SpectatorControls_FlyUp;
|
private readonly InputAction m_SpectatorControls_FlyUp;
|
||||||
private readonly InputAction m_SpectatorControls_FlyDown;
|
private readonly InputAction m_SpectatorControls_FlyDown;
|
||||||
|
private readonly InputAction m_SpectatorControls_ScrollSpeedControlw;
|
||||||
public struct SpectatorControlsActions
|
public struct SpectatorControlsActions
|
||||||
{
|
{
|
||||||
private @PlayerInputSender m_Wrapper;
|
private @PlayerInputSender m_Wrapper;
|
||||||
public SpectatorControlsActions(@PlayerInputSender wrapper) { m_Wrapper = wrapper; }
|
public SpectatorControlsActions(@PlayerInputSender wrapper) { m_Wrapper = wrapper; }
|
||||||
public InputAction @SpeedDown => m_Wrapper.m_SpectatorControls_SpeedDown;
|
public InputAction @FlyFast => m_Wrapper.m_SpectatorControls_FlyFast;
|
||||||
public InputAction @SpeedUp => m_Wrapper.m_SpectatorControls_SpeedUp;
|
public InputAction @FlySlow => m_Wrapper.m_SpectatorControls_FlySlow;
|
||||||
public InputAction @FlyUp => m_Wrapper.m_SpectatorControls_FlyUp;
|
public InputAction @FlyUp => m_Wrapper.m_SpectatorControls_FlyUp;
|
||||||
public InputAction @FlyDown => m_Wrapper.m_SpectatorControls_FlyDown;
|
public InputAction @FlyDown => m_Wrapper.m_SpectatorControls_FlyDown;
|
||||||
|
public InputAction @ScrollSpeedControlw => m_Wrapper.m_SpectatorControls_ScrollSpeedControlw;
|
||||||
public InputActionMap Get() { return m_Wrapper.m_SpectatorControls; }
|
public InputActionMap Get() { return m_Wrapper.m_SpectatorControls; }
|
||||||
public void Enable() { Get().Enable(); }
|
public void Enable() { Get().Enable(); }
|
||||||
public void Disable() { Get().Disable(); }
|
public void Disable() { Get().Disable(); }
|
||||||
|
|
@ -869,34 +892,40 @@ namespace TTTSC.Player.Character.Controller
|
||||||
{
|
{
|
||||||
if (m_Wrapper.m_SpectatorControlsActionsCallbackInterface != null)
|
if (m_Wrapper.m_SpectatorControlsActionsCallbackInterface != null)
|
||||||
{
|
{
|
||||||
@SpeedDown.started -= m_Wrapper.m_SpectatorControlsActionsCallbackInterface.OnSpeedDown;
|
@FlyFast.started -= m_Wrapper.m_SpectatorControlsActionsCallbackInterface.OnFlyFast;
|
||||||
@SpeedDown.performed -= m_Wrapper.m_SpectatorControlsActionsCallbackInterface.OnSpeedDown;
|
@FlyFast.performed -= m_Wrapper.m_SpectatorControlsActionsCallbackInterface.OnFlyFast;
|
||||||
@SpeedDown.canceled -= m_Wrapper.m_SpectatorControlsActionsCallbackInterface.OnSpeedDown;
|
@FlyFast.canceled -= m_Wrapper.m_SpectatorControlsActionsCallbackInterface.OnFlyFast;
|
||||||
@SpeedUp.started -= m_Wrapper.m_SpectatorControlsActionsCallbackInterface.OnSpeedUp;
|
@FlySlow.started -= m_Wrapper.m_SpectatorControlsActionsCallbackInterface.OnFlySlow;
|
||||||
@SpeedUp.performed -= m_Wrapper.m_SpectatorControlsActionsCallbackInterface.OnSpeedUp;
|
@FlySlow.performed -= m_Wrapper.m_SpectatorControlsActionsCallbackInterface.OnFlySlow;
|
||||||
@SpeedUp.canceled -= m_Wrapper.m_SpectatorControlsActionsCallbackInterface.OnSpeedUp;
|
@FlySlow.canceled -= m_Wrapper.m_SpectatorControlsActionsCallbackInterface.OnFlySlow;
|
||||||
@FlyUp.started -= m_Wrapper.m_SpectatorControlsActionsCallbackInterface.OnFlyUp;
|
@FlyUp.started -= m_Wrapper.m_SpectatorControlsActionsCallbackInterface.OnFlyUp;
|
||||||
@FlyUp.performed -= m_Wrapper.m_SpectatorControlsActionsCallbackInterface.OnFlyUp;
|
@FlyUp.performed -= m_Wrapper.m_SpectatorControlsActionsCallbackInterface.OnFlyUp;
|
||||||
@FlyUp.canceled -= m_Wrapper.m_SpectatorControlsActionsCallbackInterface.OnFlyUp;
|
@FlyUp.canceled -= m_Wrapper.m_SpectatorControlsActionsCallbackInterface.OnFlyUp;
|
||||||
@FlyDown.started -= m_Wrapper.m_SpectatorControlsActionsCallbackInterface.OnFlyDown;
|
@FlyDown.started -= m_Wrapper.m_SpectatorControlsActionsCallbackInterface.OnFlyDown;
|
||||||
@FlyDown.performed -= m_Wrapper.m_SpectatorControlsActionsCallbackInterface.OnFlyDown;
|
@FlyDown.performed -= m_Wrapper.m_SpectatorControlsActionsCallbackInterface.OnFlyDown;
|
||||||
@FlyDown.canceled -= m_Wrapper.m_SpectatorControlsActionsCallbackInterface.OnFlyDown;
|
@FlyDown.canceled -= m_Wrapper.m_SpectatorControlsActionsCallbackInterface.OnFlyDown;
|
||||||
|
@ScrollSpeedControlw.started -= m_Wrapper.m_SpectatorControlsActionsCallbackInterface.OnScrollSpeedControlw;
|
||||||
|
@ScrollSpeedControlw.performed -= m_Wrapper.m_SpectatorControlsActionsCallbackInterface.OnScrollSpeedControlw;
|
||||||
|
@ScrollSpeedControlw.canceled -= m_Wrapper.m_SpectatorControlsActionsCallbackInterface.OnScrollSpeedControlw;
|
||||||
}
|
}
|
||||||
m_Wrapper.m_SpectatorControlsActionsCallbackInterface = instance;
|
m_Wrapper.m_SpectatorControlsActionsCallbackInterface = instance;
|
||||||
if (instance != null)
|
if (instance != null)
|
||||||
{
|
{
|
||||||
@SpeedDown.started += instance.OnSpeedDown;
|
@FlyFast.started += instance.OnFlyFast;
|
||||||
@SpeedDown.performed += instance.OnSpeedDown;
|
@FlyFast.performed += instance.OnFlyFast;
|
||||||
@SpeedDown.canceled += instance.OnSpeedDown;
|
@FlyFast.canceled += instance.OnFlyFast;
|
||||||
@SpeedUp.started += instance.OnSpeedUp;
|
@FlySlow.started += instance.OnFlySlow;
|
||||||
@SpeedUp.performed += instance.OnSpeedUp;
|
@FlySlow.performed += instance.OnFlySlow;
|
||||||
@SpeedUp.canceled += instance.OnSpeedUp;
|
@FlySlow.canceled += instance.OnFlySlow;
|
||||||
@FlyUp.started += instance.OnFlyUp;
|
@FlyUp.started += instance.OnFlyUp;
|
||||||
@FlyUp.performed += instance.OnFlyUp;
|
@FlyUp.performed += instance.OnFlyUp;
|
||||||
@FlyUp.canceled += instance.OnFlyUp;
|
@FlyUp.canceled += instance.OnFlyUp;
|
||||||
@FlyDown.started += instance.OnFlyDown;
|
@FlyDown.started += instance.OnFlyDown;
|
||||||
@FlyDown.performed += instance.OnFlyDown;
|
@FlyDown.performed += instance.OnFlyDown;
|
||||||
@FlyDown.canceled += instance.OnFlyDown;
|
@FlyDown.canceled += instance.OnFlyDown;
|
||||||
|
@ScrollSpeedControlw.started += instance.OnScrollSpeedControlw;
|
||||||
|
@ScrollSpeedControlw.performed += instance.OnScrollSpeedControlw;
|
||||||
|
@ScrollSpeedControlw.canceled += instance.OnScrollSpeedControlw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -940,10 +969,11 @@ namespace TTTSC.Player.Character.Controller
|
||||||
}
|
}
|
||||||
public interface ISpectatorControlsActions
|
public interface ISpectatorControlsActions
|
||||||
{
|
{
|
||||||
void OnSpeedDown(InputAction.CallbackContext context);
|
void OnFlyFast(InputAction.CallbackContext context);
|
||||||
void OnSpeedUp(InputAction.CallbackContext context);
|
void OnFlySlow(InputAction.CallbackContext context);
|
||||||
void OnFlyUp(InputAction.CallbackContext context);
|
void OnFlyUp(InputAction.CallbackContext context);
|
||||||
void OnFlyDown(InputAction.CallbackContext context);
|
void OnFlyDown(InputAction.CallbackContext context);
|
||||||
|
void OnScrollSpeedControlw(InputAction.CallbackContext context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -22,8 +22,7 @@ namespace TTTSC.Player.Character.Controller
|
||||||
private bool _performingMoveInput;
|
private bool _performingMoveInput;
|
||||||
private Vector2 _moveDirection;
|
private Vector2 _moveDirection;
|
||||||
|
|
||||||
// Awake is called before the first frame
|
private void Start()
|
||||||
void Awake()
|
|
||||||
{
|
{
|
||||||
_playerGhostReffrenceHub = GetComponentInParent<PlayerGhostReffrenceHub>();
|
_playerGhostReffrenceHub = GetComponentInParent<PlayerGhostReffrenceHub>();
|
||||||
_cameraTransform = _playerGhostReffrenceHub.cameraTransform;
|
_cameraTransform = _playerGhostReffrenceHub.cameraTransform;
|
||||||
|
|
@ -32,7 +31,20 @@ namespace TTTSC.Player.Character.Controller
|
||||||
_playerInputReceiver.MoveInputEvent += MoveInput;
|
_playerInputReceiver.MoveInputEvent += MoveInput;
|
||||||
_playerInputReceiver.FlyUpInputEvent += FlyUpInput;
|
_playerInputReceiver.FlyUpInputEvent += FlyUpInput;
|
||||||
_playerInputReceiver.FlyDownInputEvent += FlyDownInput;
|
_playerInputReceiver.FlyDownInputEvent += FlyDownInput;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnDisable()
|
||||||
|
{
|
||||||
|
_playerInputReceiver.MoveInputEvent -= MoveInput;
|
||||||
|
_playerInputReceiver.FlyUpInputEvent -= FlyUpInput;
|
||||||
|
_playerInputReceiver.FlyDownInputEvent -= FlyDownInput;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnDestroy()
|
||||||
|
{
|
||||||
|
_playerInputReceiver.MoveInputEvent -= MoveInput;
|
||||||
|
_playerInputReceiver.FlyUpInputEvent -= FlyUpInput;
|
||||||
|
_playerInputReceiver.FlyDownInputEvent -= FlyDownInput;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update is called once per frame
|
// Update is called once per frame
|
||||||
|
|
|
||||||
|
|
@ -6,14 +6,16 @@ namespace TTTSC.Player.Character
|
||||||
{
|
{
|
||||||
public class PlayerGhost : MonoBehaviour
|
public class PlayerGhost : MonoBehaviour
|
||||||
{
|
{
|
||||||
public PlayerGhostReffrenceHub _playerGhostReffrenceHub;
|
[SerializeField]
|
||||||
public int shoopCoins;
|
private PlayerGhostReffrenceHub playerGhostReffrenceHub;
|
||||||
|
[SerializeField]
|
||||||
|
public PlayerInfo.PlayerInfoData playerInfoData;
|
||||||
|
|
||||||
|
|
||||||
// Start is called before the first frame update
|
// Start is called before the first frame update
|
||||||
void Start()
|
void Awake()
|
||||||
{
|
{
|
||||||
|
playerInfoData = ScriptableObject.CreateInstance<PlayerInfo.PlayerInfoData>();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update is called once per frame
|
// Update is called once per frame
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ namespace TTTSC.Player.Character
|
||||||
public Rigidbody characterRigidbody;
|
public Rigidbody characterRigidbody;
|
||||||
public Transform cameraTransform;
|
public Transform cameraTransform;
|
||||||
[Header("----------Scripts-----------")]
|
[Header("----------Scripts-----------")]
|
||||||
|
public PlayerGhost playerGhost;
|
||||||
public PlayerStateEnforcer playerStateEnforcrer;
|
public PlayerStateEnforcer playerStateEnforcrer;
|
||||||
public PlayerStateMachine playerStateMachine;
|
public PlayerStateMachine playerStateMachine;
|
||||||
public Controller.PlayerInputReceiver playerInputReceiver;
|
public Controller.PlayerInputReceiver playerInputReceiver;
|
||||||
|
|
|
||||||
8
Assets/Scripts/Player/Character/PlayerInfo.meta
Normal file
8
Assets/Scripts/Player/Character/PlayerInfo.meta
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 87339120655d19d42a1007274a98a866
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
17
Assets/Scripts/Player/Character/PlayerInfo/PlayerInfoData.cs
Normal file
17
Assets/Scripts/Player/Character/PlayerInfo/PlayerInfoData.cs
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace TTTSC.Player.Character.PlayerInfo
|
||||||
|
{
|
||||||
|
[CreateAssetMenu(menuName = "TTTSC/Player/Character/Player Info")]
|
||||||
|
public class PlayerInfoData : ScriptableObject
|
||||||
|
{
|
||||||
|
public int helth;
|
||||||
|
public int armor;
|
||||||
|
|
||||||
|
public PlayerStateMachine.playerPlayStates currentPlayerPlayState;
|
||||||
|
|
||||||
|
public PlayerStateMachine.playerClass currentPlayerClass;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: e5e7e3247b0f48746b86aa879cc08a47
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
19
Assets/Scripts/Player/Character/PlayerInfo/RoleData.cs
Normal file
19
Assets/Scripts/Player/Character/PlayerInfo/RoleData.cs
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
[CreateAssetMenu(menuName = "TTTSC/Player/Character/Role")]
|
||||||
|
public class RoleData : ScriptableObject
|
||||||
|
{
|
||||||
|
public string roleName;
|
||||||
|
public int roleId;
|
||||||
|
public Color roleColor;
|
||||||
|
|
||||||
|
public enum RoleTeam
|
||||||
|
{
|
||||||
|
Innocent,
|
||||||
|
Traitor
|
||||||
|
}
|
||||||
|
|
||||||
|
public RoleTeam roleTeam;
|
||||||
|
}
|
||||||
11
Assets/Scripts/Player/Character/PlayerInfo/RoleData.cs.meta
Normal file
11
Assets/Scripts/Player/Character/PlayerInfo/RoleData.cs.meta
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: ffe32805eb7bde24bb85bb43c12614e6
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -2,40 +2,53 @@ using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace TTTSC.Player
|
namespace TTTSC.Player.Character
|
||||||
{
|
{
|
||||||
public class PlayerStateEnforcer : MonoBehaviour
|
public class PlayerStateEnforcer : MonoBehaviour
|
||||||
{
|
{
|
||||||
private PlayerStateMachine _playerStateMachine;
|
[SerializeField]
|
||||||
|
private PlayerGhostReffrenceHub _playerGhostReffrenceHub;
|
||||||
|
[SerializeField]
|
||||||
|
private PlayerInfo.PlayerInfoData _playerInfoData;
|
||||||
|
private PlayerGhost _playerGhost;
|
||||||
|
private Rigidbody _characterRigidbody;
|
||||||
[SerializeField][Tooltip("assign the 'alive' prefab here")]
|
[SerializeField][Tooltip("assign the 'alive' prefab here")]
|
||||||
private GameObject alivePlayerPrefab;
|
private GameObject _aliveBodyPrefab;
|
||||||
private GameObject spectatorPlayerPrefab;
|
[SerializeField][Tooltip("assign the 'dead' prefab here")]
|
||||||
|
private GameObject _spectatorBodyPrefab;
|
||||||
|
|
||||||
|
private GameObject _aliveBody;
|
||||||
|
private GameObject _spectatorBody;
|
||||||
|
|
||||||
|
private void Start()
|
||||||
|
{
|
||||||
|
_playerGhost = _playerGhostReffrenceHub.playerGhost;
|
||||||
|
_playerInfoData = _playerGhost.playerInfoData;
|
||||||
|
_characterRigidbody = _playerGhostReffrenceHub.characterRigidbody;
|
||||||
|
CheckPlayerState();
|
||||||
|
}
|
||||||
|
|
||||||
void CheckPlayerState()
|
void CheckPlayerState()
|
||||||
{
|
{
|
||||||
switch (_playerStateMachine.currentPlayerPlayState)
|
switch (_playerInfoData.currentPlayerPlayState)
|
||||||
{
|
{
|
||||||
case PlayerStateMachine.playerPlayStates.Spectator:
|
case PlayerStateMachine.playerPlayStates.Spectator:
|
||||||
//add logic for turning player in to a spectator
|
SpawnSpectatorPlayerBody();
|
||||||
|
_characterRigidbody.useGravity = false;
|
||||||
break;
|
break;
|
||||||
case PlayerStateMachine.playerPlayStates.Alive:
|
case PlayerStateMachine.playerPlayStates.Alive:
|
||||||
//add logic for making player "alive"
|
SpawnAlivePlayerBody();
|
||||||
//basicaly just reset player's stats
|
_characterRigidbody.useGravity = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CheckPlayerClass()
|
void CheckPlayerClass()
|
||||||
{
|
{
|
||||||
switch (_playerStateMachine.currentPlayerClass)
|
switch (_playerInfoData.currentPlayerClass)
|
||||||
{
|
{
|
||||||
case PlayerStateMachine.playerClass.Spectator:
|
|
||||||
//this class is used when player excedes the max AFK time before being turned in to a spectator
|
|
||||||
//or when player just wants to spactate the game.
|
|
||||||
break;
|
|
||||||
case PlayerStateMachine.playerClass.Preparing:
|
case PlayerStateMachine.playerClass.Preparing:
|
||||||
//this is the default class for everyone right before the round starts
|
//this is the default class for everyone before the round starts
|
||||||
break;
|
break;
|
||||||
case PlayerStateMachine.playerClass.Innocent:
|
case PlayerStateMachine.playerClass.Innocent:
|
||||||
//TODO
|
//TODO
|
||||||
|
|
@ -49,14 +62,33 @@ namespace TTTSC.Player
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpawnPlayerBody()
|
void SpawnAlivePlayerBody()
|
||||||
{
|
{
|
||||||
|
_playerInfoData.helth = 100;
|
||||||
|
if (_spectatorBody != null)
|
||||||
|
{
|
||||||
|
Destroy(_spectatorBody);
|
||||||
|
}
|
||||||
|
_aliveBody = Instantiate(_aliveBodyPrefab, transform.position, transform.rotation);
|
||||||
|
|
||||||
|
_aliveBody.transform.SetParent(transform);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpawnPlayerRagdoll()
|
void SpawnSpectatorPlayerBody()
|
||||||
{
|
{
|
||||||
|
if (_aliveBody != null)
|
||||||
|
{
|
||||||
|
Destroy(_aliveBody);
|
||||||
|
SpawnDeadBody();
|
||||||
|
}
|
||||||
|
|
||||||
|
_spectatorBody = Instantiate(_spectatorBodyPrefab, transform.position, transform.rotation);
|
||||||
|
_spectatorBody.transform.SetParent(transform);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SpawnDeadBody()
|
||||||
|
{
|
||||||
|
//Add logic for spawning ragdoll and the dead body
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2,28 +2,24 @@ using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace TTTSC.Player
|
namespace TTTSC.Player.Character
|
||||||
{
|
{
|
||||||
public class PlayerStateMachine : MonoBehaviour
|
public class PlayerStateMachine : MonoBehaviour
|
||||||
{
|
{
|
||||||
public enum playerPlayStates
|
public enum playerPlayStates
|
||||||
{
|
{
|
||||||
Spectator,
|
Alive,
|
||||||
Alive
|
Spectator
|
||||||
};
|
};
|
||||||
|
|
||||||
public playerPlayStates currentPlayerPlayState;
|
|
||||||
|
|
||||||
public enum playerClass
|
public enum playerClass
|
||||||
{
|
{
|
||||||
Spectator,
|
|
||||||
Preparing,
|
Preparing,
|
||||||
Innocent,
|
Innocent,
|
||||||
Detective,
|
Detective,
|
||||||
Traitor
|
Traitor
|
||||||
};
|
};
|
||||||
|
|
||||||
public playerClass currentPlayerClass;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
8
Assets/Scripts/Player/Character/UI.meta
Normal file
8
Assets/Scripts/Player/Character/UI.meta
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 6ed8dc1605db3094b8948f3b0685e58a
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
36
Assets/Scripts/Player/Character/UI/AliveUi.cs
Normal file
36
Assets/Scripts/Player/Character/UI/AliveUi.cs
Normal file
|
|
@ -0,0 +1,36 @@
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.UI;
|
||||||
|
using TMPro;
|
||||||
|
|
||||||
|
namespace TTTSC.Player.Character
|
||||||
|
{
|
||||||
|
public class AliveUi : MonoBehaviour
|
||||||
|
{
|
||||||
|
private PlayerGhostReffrenceHub _playerGhostReffrenceHub;
|
||||||
|
private PlayerGhost _playerGhost;
|
||||||
|
private PlayerInfo.PlayerInfoData _playerInfoData;
|
||||||
|
[SerializeField]
|
||||||
|
private TMP_Text _healthDisplay;
|
||||||
|
private TMP_Text _roleDisplay;
|
||||||
|
[SerializeField]
|
||||||
|
private Slider _healthBar;
|
||||||
|
|
||||||
|
// Start is called before the first frame update
|
||||||
|
void Start()
|
||||||
|
{
|
||||||
|
_playerGhostReffrenceHub = GetComponentInParent<PlayerGhostReffrenceHub>();
|
||||||
|
_playerGhost = _playerGhostReffrenceHub.playerGhost;
|
||||||
|
_playerInfoData = _playerGhost.playerInfoData;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update is called once per frame
|
||||||
|
void Update()
|
||||||
|
{
|
||||||
|
_healthDisplay.text = _playerInfoData.helth.ToString();
|
||||||
|
_healthBar.value = _playerInfoData.helth;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
11
Assets/Scripts/Player/Character/UI/AliveUi.cs.meta
Normal file
11
Assets/Scripts/Player/Character/UI/AliveUi.cs.meta
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 081c9ad28f2a28443a0b9bb2fed1da05
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"MonoBehaviour": {
|
"MonoBehaviour": {
|
||||||
"Version": 3,
|
"Version": 4,
|
||||||
"EnableBurstCompilation": true,
|
"EnableBurstCompilation": true,
|
||||||
"EnableOptimisations": true,
|
"EnableOptimisations": true,
|
||||||
"EnableSafetyChecks": false,
|
"EnableSafetyChecks": false,
|
||||||
|
|
@ -11,6 +11,7 @@
|
||||||
"CpuMinTargetX64": 0,
|
"CpuMinTargetX64": 0,
|
||||||
"CpuMaxTargetX64": 0,
|
"CpuMaxTargetX64": 0,
|
||||||
"CpuTargetsX32": 6,
|
"CpuTargetsX32": 6,
|
||||||
"CpuTargetsX64": 72
|
"CpuTargetsX64": 72,
|
||||||
|
"OptimizeFor": 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"MonoBehaviour": {
|
"MonoBehaviour": {
|
||||||
"Version": 3,
|
"Version": 4,
|
||||||
"DisabledWarnings": ""
|
"DisabledWarnings": ""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
16
ProjectSettings/TimelineSettings.asset
Normal file
16
ProjectSettings/TimelineSettings.asset
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
%YAML 1.1
|
||||||
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!114 &1
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 61
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 0}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: a287be6c49135cd4f9b2b8666c39d999, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
assetDefaultFramerate: 60
|
||||||
|
m_DefaultFrameRate: 60
|
||||||
Loading…
Reference in a new issue