style: change all name variables to code style convention

This commit is contained in:
Константин Адер 2024-12-10 03:28:50 +03:00
parent b0eccf53b5
commit ebf5ef05e5
8 changed files with 146 additions and 148 deletions

View File

@ -2,15 +2,5 @@ using UnityEngine;
public class Engineer : RobotController public class Engineer : RobotController
{ {
// Start is called once before the first execution of Update after the MonoBehaviour is created // Engineer Class
void Start()
{
}
// Update is called once per frame
void Update()
{
}
} }

View File

@ -1,12 +1,13 @@
using UnityEngine; using UnityEngine;
[RequireComponent( typeof(Camera) )] [RequireComponent( typeof(Camera) )]
public class PlayerEssence : MonoBehaviour { public class PlayerEssence : MonoBehaviour
public float acceleration = 50; // how fast you accelerate {
public float accSprintMultiplier = 4; // how much faster you go when "sprinting" public float _acceleration = 50; // how fast you accelerate
public float lookSensitivity = 1; // mouse look sensitivity public float _accSprintMultiplier = 4; // how much faster you go when "sprinting"
public float dampingCoefficient = 5; // how quickly you break to a halt after you stop your input public float _lookSensitivity = 1; // mouse look sensitivity
public bool focusOnEnable = true; // whether or not to focus and lock cursor immediately on enable public float _dampingCoefficient = 5; // how quickly you break to a halt after you stop your input
public bool _focusOnEnable = true; // whether or not to focus and lock cursor immediately on enable
Vector3 velocity; // current velocity Vector3 velocity; // current velocity
@ -19,7 +20,7 @@ public class PlayerEssence : MonoBehaviour {
} }
void OnEnable() { void OnEnable() {
if( focusOnEnable ) Focused = true; if( _focusOnEnable ) Focused = true;
} }
void OnDisable() => Focused = false; void OnDisable() => Focused = false;
@ -32,7 +33,7 @@ public class PlayerEssence : MonoBehaviour {
Focused = true; Focused = true;
// Physics // Physics
velocity = Vector3.Lerp( velocity, Vector3.zero, dampingCoefficient * Time.deltaTime ); velocity = Vector3.Lerp( velocity, Vector3.zero, _dampingCoefficient * Time.deltaTime );
transform.position += velocity * Time.deltaTime; transform.position += velocity * Time.deltaTime;
} }
@ -41,7 +42,7 @@ public class PlayerEssence : MonoBehaviour {
velocity += GetAccelerationVector() * Time.deltaTime; velocity += GetAccelerationVector() * Time.deltaTime;
// Rotation // Rotation
Vector2 mouseDelta = lookSensitivity * new Vector2( Input.GetAxis( "Mouse X" ), -Input.GetAxis( "Mouse Y" ) ); Vector2 mouseDelta = _lookSensitivity * new Vector2( Input.GetAxis( "Mouse X" ), -Input.GetAxis( "Mouse Y" ) );
Quaternion rotation = transform.rotation; Quaternion rotation = transform.rotation;
Quaternion horiz = Quaternion.AngleAxis( mouseDelta.x, Vector3.up ); Quaternion horiz = Quaternion.AngleAxis( mouseDelta.x, Vector3.up );
Quaternion vert = Quaternion.AngleAxis( mouseDelta.y, Vector3.right ); Quaternion vert = Quaternion.AngleAxis( mouseDelta.y, Vector3.right );
@ -69,8 +70,8 @@ public class PlayerEssence : MonoBehaviour {
Vector3 direction = transform.TransformVector( moveInput.normalized ); Vector3 direction = transform.TransformVector( moveInput.normalized );
if( Input.GetKey( KeyCode.LeftShift ) ) if( Input.GetKey( KeyCode.LeftShift ) )
return direction * ( acceleration * accSprintMultiplier ); // "sprinting" return direction * ( _acceleration * _accSprintMultiplier ); // "sprinting"
return direction * acceleration; // "walking" return direction * _acceleration; // "walking"
} }
// Fog for Camera - Later // Fog for Camera - Later

View File

@ -4,5 +4,5 @@ using UnityEngine;
public class PlayerSettings : NetworkBehaviour public class PlayerSettings : NetworkBehaviour
{ {
public NetworkVariable<FixedString64Bytes> playerNickname; public NetworkVariable<FixedString64Bytes> PlayerNickname;
} }

View File

@ -7,35 +7,35 @@ using UnityEngine.InputSystem;
public class RobotController : NetworkBehaviour public class RobotController : NetworkBehaviour
{ {
[Header("Objects")] [Header("Objects")]
[SerializeField] protected CharacterController characterController; [SerializeField] protected CharacterController _characterController;
[SerializeField] protected Camera mainCam; [SerializeField] protected Camera _mainCam;
[SerializeField] protected AudioListener audioListener; [SerializeField] protected AudioListener _audioListener;
[SerializeField] protected Weapon weapon; [SerializeField] protected Weapon _weapon;
[SerializeField] protected float upDownRange = 90f; [SerializeField] protected float _upDownRange = 90f;
protected float verticalRotation; protected float _verticalRotation;
[Header("Movement")] [Header("Movement")]
[SerializeField] protected float walkSpeed = 5.0f; [SerializeField] protected float _walkSpeed = 5.0f;
[SerializeField] protected float sprintMultiplier = 5.0f; [SerializeField] protected float _sprintMultiplier = 5.0f;
protected float speedMultiplier = 1f; protected float _speedMultiplier = 1f;
[Header("Gravity / JumpForce")] [Header("Gravity / JumpForce")]
[SerializeField] protected float gravity = 9.81f; [SerializeField] protected float _gravity = 9.81f;
[SerializeField] protected float jumpForce = 5f; [SerializeField] protected float _jumpForce = 5f;
[Header("Look Sensitivity")] [Header("Look Sensitivity")]
[SerializeField] protected float lookSensitivity = 3.0f; [SerializeField] protected float _lookSensitivity = 3.0f;
protected bool cursorIsLocked = true; protected bool _cursorIsLocked = true;
[Header("Input Actions")] [Header("Input Actions")]
[SerializeField] protected PlayerInput playerInput; [SerializeField] protected PlayerInput _playerInput;
protected Vector2 moveInput; protected Vector2 _moveInput;
protected Vector2 lookInput; protected Vector2 _lookInput;
protected bool isMoving; protected bool _isMoving;
protected Vector3 currentMovement = Vector3.zero; protected Vector3 _currentMovement = Vector3.zero;
[Header("Developer Console")] [Header("Developer Console")]
[SerializeField] protected DeveloperConsoleUI devConsole; [SerializeField] protected DeveloperConsoleUI devConsole;
@ -43,9 +43,9 @@ public class RobotController : NetworkBehaviour
private void Awake() private void Awake()
{ {
characterController = GetComponent<CharacterController>(); _characterController = GetComponent<CharacterController>();
playerInput = GetComponent<PlayerInput>(); _playerInput = GetComponent<PlayerInput>();
audioListener = GetComponentInChildren<AudioListener>(); _audioListener = GetComponentInChildren<AudioListener>();
} }
// PlayerInput Events // PlayerInput Events
@ -65,26 +65,30 @@ public class RobotController : NetworkBehaviour
} }
} }
} }
public void OnMove(InputAction.CallbackContext context) public void OnMove(InputAction.CallbackContext context)
{ {
moveInput = context.ReadValue<Vector2>(); _moveInput = context.ReadValue<Vector2>();
} }
public void OnLook(InputAction.CallbackContext context) public void OnLook(InputAction.CallbackContext context)
{ {
lookInput = context.ReadValue<Vector2>(); _lookInput = context.ReadValue<Vector2>();
} }
public void OnSprint(InputAction.CallbackContext context) public void OnSprint(InputAction.CallbackContext context)
{ {
if (context.performed) if (context.performed)
{ {
Debug.Log("Running"); Debug.Log("Running");
speedMultiplier = sprintMultiplier; _speedMultiplier = _sprintMultiplier;
} }
else else
{ {
speedMultiplier = 1f; _speedMultiplier = 1f;
} }
} }
public void OnJump(InputAction.CallbackContext context) public void OnJump(InputAction.CallbackContext context)
{ {
if (context.performed) if (context.performed)
@ -92,6 +96,7 @@ public class RobotController : NetworkBehaviour
JumpServerRPC(); JumpServerRPC();
} }
} }
public void OnAttack(InputAction.CallbackContext context) public void OnAttack(InputAction.CallbackContext context)
{ {
if (context.performed) if (context.performed)
@ -99,6 +104,7 @@ public class RobotController : NetworkBehaviour
ShootServerRPC(); ShootServerRPC();
} }
} }
public void OnAim(InputAction.CallbackContext context) public void OnAim(InputAction.CallbackContext context)
{ {
if (context.performed) if (context.performed)
@ -106,6 +112,7 @@ public class RobotController : NetworkBehaviour
AimServerRPC(); AimServerRPC();
} }
} }
public void OnCrouch(InputAction.CallbackContext context) public void OnCrouch(InputAction.CallbackContext context)
{ {
if (context.performed) if (context.performed)
@ -113,6 +120,7 @@ public class RobotController : NetworkBehaviour
CrouchServerRPC(); CrouchServerRPC();
} }
} }
public void OnInteract(InputAction.CallbackContext context) public void OnInteract(InputAction.CallbackContext context)
{ {
if (context.performed) if (context.performed)
@ -126,10 +134,10 @@ public class RobotController : NetworkBehaviour
{ {
base.OnNetworkSpawn(); base.OnNetworkSpawn();
playerInput.enabled = IsOwner; _playerInput.enabled = IsOwner;
characterController.enabled = IsOwner; _characterController.enabled = IsOwner;
mainCam.enabled = IsOwner; _mainCam.enabled = IsOwner;
audioListener.enabled = IsOwner; _audioListener.enabled = IsOwner;
Debug.Log($"NetworkObject ID: {NetworkObjectId} spawned with OwnerClientId: {OwnerClientId}"); Debug.Log($"NetworkObject ID: {NetworkObjectId} spawned with OwnerClientId: {OwnerClientId}");
} }
@ -138,10 +146,10 @@ public class RobotController : NetworkBehaviour
{ {
base.OnNetworkDespawn(); base.OnNetworkDespawn();
playerInput.enabled = false; _playerInput.enabled = false;
characterController.enabled = false; _characterController.enabled = false;
mainCam.enabled = false; _mainCam.enabled = false;
audioListener.enabled = false; _audioListener.enabled = false;
Debug.Log($"NetworkObject ID: {NetworkObjectId} despawned"); Debug.Log($"NetworkObject ID: {NetworkObjectId} despawned");
} }
@ -160,42 +168,42 @@ public class RobotController : NetworkBehaviour
protected void HandleMovement() protected void HandleMovement()
{ {
float verticalSpeed = moveInput.y * walkSpeed * speedMultiplier; float verticalSpeed = _moveInput.y * _walkSpeed * _speedMultiplier;
float horizontalSpeed = moveInput.x * walkSpeed * speedMultiplier; float horizontalSpeed = _moveInput.x * _walkSpeed * _speedMultiplier;
Vector3 horizontalMovement = new Vector3 (horizontalSpeed, 0, verticalSpeed); Vector3 horizontalMovement = new(horizontalSpeed, 0, verticalSpeed);
horizontalMovement = transform.rotation * horizontalMovement; horizontalMovement = transform.rotation * horizontalMovement;
handleGravityAndJumping(); handleGravityAndJumping();
currentMovement.x = horizontalMovement.x; _currentMovement.x = horizontalMovement.x;
currentMovement.z = horizontalMovement.z; _currentMovement.z = horizontalMovement.z;
characterController.Move(currentMovement * Time.deltaTime); _characterController.Move(_currentMovement * Time.deltaTime);
isMoving = moveInput.y != 0 || moveInput.x != 0; _isMoving = _moveInput.y != 0 || _moveInput.x != 0;
} }
protected void handleGravityAndJumping() protected void handleGravityAndJumping()
{ {
if (characterController.isGrounded) if (_characterController.isGrounded)
{ {
currentMovement.y = -0.5f; _currentMovement.y = -0.5f;
} }
else else
{ {
currentMovement.y -= gravity * Time.deltaTime; _currentMovement.y -= _gravity * Time.deltaTime;
} }
} }
protected void HandleRotation() protected void HandleRotation()
{ {
float mouseXRotation = lookInput.x * lookSensitivity; float mouseXRotation = _lookInput.x * _lookSensitivity;
transform.Rotate(0, mouseXRotation, 0); transform.Rotate(0, mouseXRotation, 0);
verticalRotation -= lookInput.y * lookSensitivity; _verticalRotation -= _lookInput.y * _lookSensitivity;
verticalRotation = Mathf.Clamp(verticalRotation, -upDownRange, upDownRange); _verticalRotation = Mathf.Clamp(_verticalRotation, -_upDownRange, _upDownRange);
mainCam.transform.localRotation = Quaternion.Euler(verticalRotation, 0, 0); _mainCam.transform.localRotation = Quaternion.Euler(_verticalRotation, 0, 0);
} }
//controls the locking and unlocking of the mouse //controls the locking and unlocking of the mouse
@ -203,27 +211,29 @@ public class RobotController : NetworkBehaviour
{ {
if (Input.GetKeyUp(KeyCode.Escape)) if (Input.GetKeyUp(KeyCode.Escape))
{ {
cursorIsLocked = false; _cursorIsLocked = false;
} }
else if (Input.GetMouseButtonUp(0)) else if (Input.GetMouseButtonUp(0))
{ {
cursorIsLocked = true; _cursorIsLocked = true;
} }
if (cursorIsLocked) if (_cursorIsLocked)
{ {
UnlockCursor(); UnlockCursor();
} }
else if (!cursorIsLocked) else if (!_cursorIsLocked)
{ {
LockCursor(); LockCursor();
} }
} }
private void UnlockCursor() private void UnlockCursor()
{ {
Cursor.lockState = CursorLockMode.Locked; Cursor.lockState = CursorLockMode.Locked;
Cursor.visible = false; Cursor.visible = false;
} }
private void LockCursor() private void LockCursor()
{ {
Cursor.lockState = CursorLockMode.None; Cursor.lockState = CursorLockMode.None;
@ -231,11 +241,10 @@ public class RobotController : NetworkBehaviour
} }
// Networking Staff // Networking Staff
[ServerRpc] [ServerRpc]
protected void JumpServerRPC() protected void JumpServerRPC()
{ {
if (characterController.isGrounded) if (_characterController.isGrounded)
{ {
Debug.Log($"Jump triggered. Owner: {OwnerClientId}"); Debug.Log($"Jump triggered. Owner: {OwnerClientId}");
} }
@ -245,7 +254,7 @@ public class RobotController : NetworkBehaviour
protected void ShootServerRPC() protected void ShootServerRPC()
{ {
Debug.Log($"Shooting triggered. Owner: {OwnerClientId}"); Debug.Log($"Shooting triggered. Owner: {OwnerClientId}");
weapon.Shooting(); _weapon.Shooting();
} }
[ServerRpc] [ServerRpc]

View File

@ -6,29 +6,30 @@ using UnityEngine.InputSystem;
public class Trooper : RobotController public class Trooper : RobotController
{ {
// Dev Debug Staff // Dev Debug Staff
[SerializeField] Canvas screenSpaceCanvas; [SerializeField] private Canvas _screenSpaceCanvas;
[Header("Gameplay Variables")] [Header("Gameplay Variables")]
private NetworkVariable<int> healthPoints = new NetworkVariable<int>(); public NetworkVariable<int> HealthPoints { get => _healthPoints; set => _healthPoints = value; }
public int HealthPoints { get { return healthPoints.Value; } set { healthPoints.Value = value; } } private NetworkVariable<int> _healthPoints = new NetworkVariable<int>();
private NetworkVariable<int> armorPoints = new NetworkVariable<int>(); public NetworkVariable<int> ArmorPoints { get => _armorPoints; set => _armorPoints = value; }
public int ArmorPoints { get { return armorPoints.Value; } set { armorPoints.Value = value; } } private NetworkVariable<int> _armorPoints = new NetworkVariable<int>();
private NetworkVariable<int> ammoPoints = new NetworkVariable<int>(); public NetworkVariable<int> AmmoPoints { get => _ammoPoints; set => _ammoPoints = value; }
public int AmmoPoints { get { return ammoPoints.Value; } set { ammoPoints.Value = value; } } private NetworkVariable<int> _ammoPoints = new NetworkVariable<int>();
[SerializeField] private int initialHP = 100; public int InitialHP { get => _initialHP; set => _initialHP = value; }
public int InitialHP { get => initialHP; set => initialHP = value; } [SerializeField] private int _initialHP = 100;
public int InitialArmor { get => _initialArmor; set => _initialArmor = value; }
[SerializeField] private int _initialArmor = 100;
[SerializeField] private int initialArmor = 100;
public int InitialArmor { get => initialArmor; set => initialArmor = value; }
// Gameplay - Scene Awake & Start // Gameplay - Scene Awake & Start
private void Awake() private void Awake()
{ {
characterController = GetComponent<CharacterController>(); _characterController = GetComponent<CharacterController>();
playerInput = GetComponent<PlayerInput>(); _playerInput = GetComponent<PlayerInput>();
audioListener = GetComponentInChildren<AudioListener>(); _audioListener = GetComponentInChildren<AudioListener>();
} }
// PlayerInput Events // PlayerInput Events
@ -48,7 +49,7 @@ public class Trooper : RobotController
} }
// Networking Staff - Spawn & Despawn // Networking Staff - Spawn & Despawn
void OnServerSpawnPlayer() private void OnServerSpawnPlayer()
{ {
// this is done server side, so we have a single source of truth for our spawn point list // this is done server side, so we have a single source of truth for our spawn point list
var spawnPoint = ServerPlayerSpawnPoints.Instance.ConsumeNextSpawnPoint(); var spawnPoint = ServerPlayerSpawnPoints.Instance.ConsumeNextSpawnPoint();
@ -61,28 +62,28 @@ public class Trooper : RobotController
OnServerSpawnPlayer(); OnServerSpawnPlayer();
base.OnNetworkSpawn(); base.OnNetworkSpawn();
playerInput.enabled = IsOwner; _playerInput.enabled = IsOwner;
characterController.enabled = IsOwner; _characterController.enabled = IsOwner;
mainCam.enabled = IsOwner; _mainCam.enabled = IsOwner;
audioListener.enabled = IsOwner; _audioListener.enabled = IsOwner;
screenSpaceCanvas.enabled = IsOwner; _screenSpaceCanvas.enabled = IsOwner;
// Game Variables // Game Variables
healthPoints.Value = InitialHP; HealthPoints.Value = InitialHP;
Debug.Log($"NetworkObject ID: {NetworkObjectId} spawned with OwnerClientId: {OwnerClientId}"); Debug.Log($"NetworkObject ID: {NetworkObjectId} spawned with OwnerClientId: {OwnerClientId}");
Debug.Log($"HP of OwnerClientID: {OwnerClientId} is {healthPoints.Value} when spawned."); Debug.Log($"HP of OwnerClientID: {OwnerClientId} is {HealthPoints.Value} when spawned.");
} }
public override void OnNetworkDespawn() public override void OnNetworkDespawn()
{ {
base.OnNetworkDespawn(); base.OnNetworkDespawn();
playerInput.enabled = false; _playerInput.enabled = false;
characterController.enabled = false; _characterController.enabled = false;
mainCam.enabled = false; _mainCam.enabled = false;
audioListener.enabled = false; _audioListener.enabled = false;
screenSpaceCanvas.enabled = false; _screenSpaceCanvas.enabled = false;
Debug.Log($"NetworkObject ID: {NetworkObjectId} despawned"); Debug.Log($"NetworkObject ID: {NetworkObjectId} despawned");
} }
@ -93,33 +94,33 @@ public class Trooper : RobotController
[ServerRpc] [ServerRpc]
private new void JumpServerRPC() private new void JumpServerRPC()
{ {
if (characterController.isGrounded) if (_characterController.isGrounded)
{ {
Debug.Log("Jumping as Trooper triggered."); Debug.Log($"Jumping as Trooper triggered. Owner: {OwnerClientId}");
} }
} }
[ServerRpc] [ServerRpc]
private new void ShootServerRPC() private new void ShootServerRPC()
{ {
weapon.Shooting(); _weapon.Shooting();
} }
[ServerRpc] [ServerRpc]
private new void AimServerRPC() private new void AimServerRPC()
{ {
Debug.Log("Aim as Trooper triggered."); Debug.Log($"Aim as Trooper triggered. Owner: {OwnerClientId}");
} }
[ServerRpc] [ServerRpc]
private new void CrouchServerRPC() private new void CrouchServerRPC()
{ {
Debug.Log("Crouch as Trooper triggered."); Debug.Log($"Crouch as Trooper triggered. Owner: {OwnerClientId}");
} }
[ServerRpc] [ServerRpc]
private new void InteractServerRPC() private new void InteractServerRPC()
{ {
Debug.Log("Interact as Trooper triggered."); Debug.Log($"Interact as Trooper triggered. Owner: {OwnerClientId}");
} }
} }

View File

@ -3,27 +3,24 @@ using Unity.Netcode;
public class Weapon : MonoBehaviour public class Weapon : MonoBehaviour
{ {
// [SerializeField] private float damage = 10f; [SerializeField] protected Camera _mainCam;
[SerializeField] private float range = 100f; [SerializeField] protected float _debugRayDistance = 5f;
[SerializeField] protected Camera mainCam; [SerializeField] protected float _debugRayDuration = 2f;
[SerializeField] protected float debugRayDistance = 5f; [SerializeField] private float _range = 100f;
[SerializeField] protected float debugRayDuration = 2f;
[Header("Gameplay Variables")] [Header("Gameplay Variables")]
private NetworkVariable<int> m_Damage = new NetworkVariable<int>(); public NetworkVariable<float> Damage { get => _damage; set => _damage = value; }
[SerializeField] protected int damage = 10; private NetworkVariable<float> _damage = new NetworkVariable<float>();
public void Shooting() public void Shooting()
{ {
RaycastHit hit; RaycastHit hit;
if (Physics.Raycast(mainCam.transform.position, mainCam.transform.forward, out hit, range)) if (Physics.Raycast(_mainCam.transform.position, _mainCam.transform.forward, out hit, _range))
{ {
Debug.Log(hit.transform.name); Debug.Log(hit.transform.name);
Vector3 rayDir = mainCam.transform.forward * debugRayDistance; Vector3 rayDir = _mainCam.transform.forward * _debugRayDistance;
Debug.DrawRay(mainCam.transform.position, rayDir, Color.yellow, debugRayDuration, false); Debug.DrawRay(_mainCam.transform.position, rayDir, Color.yellow, _debugRayDuration, false);
} }
} }

View File

@ -3,26 +3,26 @@ using UnityEngine;
public class Armorbar : MonoBehaviour public class Armorbar : MonoBehaviour
{ {
[SerializeField] private TextMeshProUGUI staticInfo; [SerializeField] private TextMeshProUGUI _staticInfo;
[SerializeField] private TextMeshProUGUI dynamicInfo; [SerializeField] private TextMeshProUGUI _dynamicInfo;
[SerializeField] private Trooper trooper; [SerializeField] private Trooper _trooper;
private int bufferHP; private int _bufferHP;
private int initialInfo; private int _initialInfo;
public TextMeshProUGUI DynamicInfo { get => dynamicInfo; set => dynamicInfo = value; } public TextMeshProUGUI DynamicInfo { get => _dynamicInfo; set => _dynamicInfo = value; }
public TextMeshProUGUI StaticInfo { get => staticInfo; set => staticInfo = value; } public TextMeshProUGUI StaticInfo { get => _staticInfo; set => _staticInfo = value; }
public int BufferHP { get => bufferHP; set => bufferHP = value; } public int BufferHP { get => _bufferHP; set => _bufferHP = value; }
void Start() void Start()
{ {
initialInfo = trooper.InitialArmor; _initialInfo = _trooper.InitialArmor;
StaticInfo.text = initialInfo.ToString(); StaticInfo.text = _initialInfo.ToString();
DynamicInfo.text = initialInfo.ToString(); DynamicInfo.text = _initialInfo.ToString();
} }
void DynamicInfoChange(int newValue) void DynamicInfoChange(int newValue)
{ {
DynamicInfo.text = bufferHP.ToString(); DynamicInfo.text = _bufferHP.ToString();
} }
} }

View File

@ -3,26 +3,26 @@ using UnityEngine;
public class Healthbar : MonoBehaviour public class Healthbar : MonoBehaviour
{ {
[SerializeField] private TextMeshProUGUI staticInfo; [SerializeField] private TextMeshProUGUI _staticInfo;
[SerializeField] private TextMeshProUGUI dynamicInfo; [SerializeField] private TextMeshProUGUI _dynamicInfo;
[SerializeField] private Trooper trooper; [SerializeField] private Trooper _trooper;
private int bufferHP; private int _bufferHP;
private int initialInfo; private int _initialInfo;
public TextMeshProUGUI DynamicInfo { get => dynamicInfo; set => dynamicInfo = value; } public TextMeshProUGUI DynamicInfo { get => _dynamicInfo; set => _dynamicInfo = value; }
public TextMeshProUGUI StaticInfo { get => staticInfo; set => staticInfo = value; } public TextMeshProUGUI StaticInfo { get => _staticInfo; set => _staticInfo = value; }
public int BufferHP { get => bufferHP; set => bufferHP = value; } public int BufferHP { get => _bufferHP; set => _bufferHP = value; }
void Start() void Start()
{ {
initialInfo = trooper.InitialHP; _initialInfo = _trooper.InitialHP;
StaticInfo.text = initialInfo.ToString(); StaticInfo.text = _initialInfo.ToString();
DynamicInfo.text = initialInfo.ToString(); DynamicInfo.text = _initialInfo.ToString();
} }
void DynamicInfoChange(int newValue) void DynamicInfoChange(int newValue)
{ {
DynamicInfo.text = bufferHP.ToString(); DynamicInfo.text = _bufferHP.ToString();
} }
} }