-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added images of each body part, put them as one body in the UI HUD, s…
…tarted modifying BodyDamageScript, still need to link it to player character object
- Loading branch information
Showing
21 changed files
with
1,174 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 0 additions & 11 deletions
11
...w/Assets/Scripts/CharacterSystems/.ipynb_checkpoints/AdrenalineTrigger.cs-checkpoint.meta
This file was deleted.
Oops, something went wrong.
68 changes: 68 additions & 0 deletions
68
DarkFlow/Assets/Scripts/CharacterSystems/.ipynb_checkpoints/CharacterMain-checkpoint.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
using UnityEngine; | ||
using UnityEngine.InputSystem; | ||
|
||
|
||
|
||
public class CharacterMain : MonoBehaviour | ||
{ | ||
private bool isJumping; | ||
private bool isWalking; | ||
public float movementSpeed = 5f; | ||
private Vector2 moveInput; | ||
|
||
|
||
|
||
|
||
[SerializeField] private string charName; // GameObject will NOT be player's name - this will. | ||
[SerializeField] private Health health; // Useless for now. | ||
|
||
private void Start() | ||
{ | ||
|
||
} | ||
|
||
private void Update() | ||
{ | ||
//OnMove; | ||
transform.Translate(new Vector3(moveInput.x, 0, moveInput.y) * movementSpeed * Time.deltaTime); | ||
|
||
} | ||
|
||
private void OnMove(InputValue value) | ||
{ | ||
|
||
moveInput = value.Get<Vector2>(); | ||
/* | ||
private void Update() | ||
{ | ||
HandleMovement(); | ||
Move(); | ||
} | ||
private void Move(InputAction context) | ||
{ | ||
if(context != null) | ||
{ | ||
moveInput = context.ReadValue<Vector2>(); | ||
} | ||
} | ||
private void HandleMovement() | ||
{ | ||
// Calculate movement direction based on input | ||
Vector3 moveDirection = new Vector3(moveInput.x, 0f, moveInput.y).normalized; | ||
// Check if the player is walking | ||
isWalking = moveDirection.magnitude > 0; | ||
// Move the character using the CharacterController | ||
characterController.Move(moveDirection * movementSpeed * Time.deltaTime); | ||
} | ||
*/ | ||
} | ||
} |
126 changes: 126 additions & 0 deletions
126
DarkFlow/Assets/Scripts/CharacterSystems/.ipynb_checkpoints/Health-checkpoint.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,126 @@ | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using UnityEngine; | ||
using Unity.Netcode; | ||
|
||
public class Health: NetworkBehaviour | ||
{ | ||
// ***Network Checks*** All network calls and references are made in the Limb script and anything calling to this Class. This prevents unneccessary checks on our part. | ||
|
||
// ***At this spot*** I need to make a reference to any other Transforms we may need to call upon for references. Ex: Animators, Armors, Augmentations, UI, etc. | ||
|
||
private float healthMain; // Our primary Health, enough hits to everything else and we bleed out. | ||
private float healthMax; // The maximum Health allowed. This value allows it to be upgraded. | ||
private float staminaMain; // See above, but with Stamina. | ||
private float staminaMax; // Self explanatory. | ||
private float adrenaline; // Adrenaline drive, given during moments of low health for those "Oh shit" moments. | ||
private float cyberHealth; // Seperate from healthMain, this variable controls overall mental health - Get low enough, physical damage may occur! Warranty not included. | ||
private float armorHealth; // Probably just gonna Transform.GetComponent this from the actual armor item. Might make this to each limb as well. For now, mundane stuff! | ||
|
||
public enum BodyPart | ||
{ | ||
Head, | ||
Chest, | ||
LeftArm, | ||
RightArm, | ||
LeftLeg, | ||
RightLeg | ||
} | ||
|
||
public enum Toxicity // I'm running this as an enum for now, it may be split in to seperate variables - Just did this so I can possibly have other factors later. | ||
{ | ||
Bio, | ||
Psych, | ||
Radiation | ||
} | ||
|
||
|
||
private Dictionary<BodyPart, float> bodyPartHealth = new Dictionary<BodyPart, float>(); | ||
private Dictionary<Toxicity, float> toxicBar = new Dictionary<Toxicity, float>(); // This will be our dictionary for the toxicity meters. | ||
|
||
// Augmentations will be in another MonoBehavior, I don't feel like including them in this one, mainly for sake of compile and run time. - Sona | ||
|
||
private void Start() | ||
{ | ||
InitializeHealth(); | ||
Debug.Log("Health behavior on " + this.gameObject + " has been activated."); // I just like knowing the script is functioning. | ||
} | ||
|
||
public void InitializeHealth() // Bodypart floats are counted as a 1-100 float value. They can be increased, but it will need to be handled outside the script for cleanliness. | ||
{ | ||
// if (!isLocalPlayer) return; | ||
|
||
bodyPartHealth[BodyPart.Head] = 100f; | ||
bodyPartHealth[BodyPart.Chest] = 100f; | ||
bodyPartHealth[BodyPart.LeftArm] = 100f; | ||
bodyPartHealth[BodyPart.RightArm] = 100f; | ||
bodyPartHealth[BodyPart.LeftLeg] = 100f; | ||
bodyPartHealth[BodyPart.RightLeg] = 100f; | ||
} | ||
|
||
public void InitializeToxicBar() // Load the meters up and zero them out, we'll get the values later from the server. | ||
{ | ||
// if (!isLocalPlayer) return; | ||
|
||
toxicBar[Toxicity.Bio] = 0f; | ||
toxicBar[Toxicity.Psych] = 0f; | ||
toxicBar[Toxicity.Radiation] = 0f; | ||
} | ||
|
||
public void DamageArmor(float D) // Private so that this function must be special called by a referencing script. I'll network this soon to test for lag. | ||
{ | ||
if (D <= 0) return; | ||
else | ||
{ | ||
armorHealth -= D; | ||
if(armorHealth <= 0) | ||
{ | ||
armorHealth = 0; | ||
Debug.Log("Armor on " + this.gameObject + " has been destroyed beyond repair!"); | ||
} | ||
} | ||
} | ||
|
||
public void DamagePlayer(float D, BodyPart bodyPart) // D to call for the damage float, X will probably reference a body part in the future. | ||
{ | ||
if(bodyPartHealth.ContainsKey(bodyPart)) | ||
{ | ||
if(D > 0) | ||
{ | ||
bodyPartHealth[bodyPart] -= D; | ||
healthMain -= D / bodyPartHealth[bodyPart] * 2; | ||
} | ||
} | ||
PlayerStatus(); | ||
} | ||
|
||
private void PlayerStatus() // Let's check on player's status, their limbs, etc. | ||
{ | ||
// To further elaborate, healing and whatnot can be handled by an item's script - and it can reference this one. | ||
// Right now, none of these check for the armor status - Which, I'll probably give them a bonus to health from the armor anyway. Maybe. | ||
|
||
if (bodyPartHealth.ContainsKey(BodyPart.Head) && bodyPartHealth[BodyPart.Head] <= 0) // Let's be honest. Head Health being 0 means they are dead. | ||
{ | ||
Debug.Log("Should get your head looked at, it's missing!"); | ||
} | ||
if (bodyPartHealth.ContainsKey(BodyPart.LeftLeg) && bodyPartHealth[BodyPart.LeftLeg] <= 0) | ||
{ | ||
Debug.Log("My leg!"); | ||
} | ||
if (bodyPartHealth.ContainsKey(BodyPart.LeftArm) && bodyPartHealth[BodyPart.LeftArm] <= 0) | ||
{ | ||
Debug.Log("Look! No hands!"); | ||
} | ||
if (bodyPartHealth.ContainsKey(BodyPart.RightArm) && bodyPartHealth[BodyPart.RightArm] <= 0) | ||
{ | ||
Debug.Log("Look! No hands!"); | ||
} | ||
if (bodyPartHealth.ContainsKey(BodyPart.RightLeg) && bodyPartHealth[BodyPart.RightLeg] <= 0) | ||
{ | ||
Debug.Log("My leg!"); | ||
} | ||
InitializeHealth(); | ||
|
||
} | ||
} |
33 changes: 0 additions & 33 deletions
33
DarkFlow/Assets/Scripts/CharacterSystems/.ipynb_checkpoints/HealthRegeneration-checkpoint.cs
This file was deleted.
Oops, something went wrong.
72 changes: 72 additions & 0 deletions
72
DarkFlow/Assets/Scripts/CharacterSystems/.ipynb_checkpoints/Settings-checkpoint.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
using UnityEngine; | ||
using UnityEngine.UI; | ||
using UnityEngine.InputSystem; | ||
|
||
public class Settings : MonoBehaviour | ||
{ | ||
|
||
// Dirty settings. Clean up later. | ||
[Header("Menu State")] // What is going on with our menu, is it visible? Invisible? Do I need to BLOW IT UP? Shown here. | ||
[SerializeField] private bool _menuActive; | ||
|
||
[Space] | ||
[Header("Game State")] | ||
[SerializeField] private bool gamePaused; // Probably has no use. I don't know if this is an MMO or Single-Player anymore. | ||
|
||
[Space] | ||
[Space] | ||
[Header("UI Theme")] // No, I'm not making specialized themes right now - This is just to hold the settings for appearance so I don't have to do it again later. Add onto as needed. | ||
[Space] | ||
[SerializeField] private GameObject _menuBackground; | ||
[Space] | ||
[Space] | ||
[Header("Settings")] | ||
[Space] | ||
|
||
[SerializeField] private Slider _MusicVol; | ||
[SerializeField] private Slider _MasterVol; | ||
[SerializeField] private Slider _AtmosVol; | ||
[SerializeField] private Button _btnApply; | ||
[SerializeField] private Button _btnCancel; | ||
|
||
private void Start() | ||
{ | ||
if (!_menuBackground) this.enabled = false; // Prevent bugs if we don't have the UI active or set. | ||
} | ||
|
||
private void Update() | ||
{ | ||
if (Keyboard.current.escapeKey.wasPressedThisFrame) | ||
{ | ||
EscapeKeyPressed(); | ||
} | ||
} | ||
|
||
private void EscapeKeyPressed() | ||
{ | ||
_menuActive = !_menuActive; | ||
PauseMenu(); // References because script time. | ||
} | ||
|
||
private void PauseMenu() | ||
{ | ||
if(_menuActive) _menuBackground.SetActive(true); | ||
if(!_menuActive) _menuBackground.SetActive(false); | ||
} | ||
|
||
private void CancelButton() | ||
{ | ||
_menuActive = false; | ||
PauseMenu(); | ||
} | ||
|
||
private void ApplyButton() | ||
{ | ||
// I do nothing right now :D!!! | ||
} | ||
|
||
// Music/Master will come after have some atmospheric sounnds / music to work with - as it involves me working with an audio mixer. | ||
|
||
} |
38 changes: 38 additions & 0 deletions
38
DarkFlow/Assets/Scripts/CharacterSystems/.ipynb_checkpoints/ThirstMeter-checkpoint.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
using UnityEngine; | ||
using UnityEngine.UI; | ||
|
||
public class ThirstMeter : MonoBehaviour | ||
{ | ||
public float maxThirst = 100f; | ||
private float currentThirst; | ||
public Image thirstBar; | ||
|
||
void Start() | ||
{ | ||
currentThirst = maxThirst; | ||
UpdateThirstBar(); | ||
} | ||
|
||
void Update() | ||
{ | ||
// Decrease thirst over time or based on player actions | ||
currentThirst = Mathf.Clamp(currentThirst, 0, maxThirst); | ||
UpdateThirstBar(); | ||
} | ||
|
||
public void ConsumeWater(float amount) | ||
{ | ||
currentThirst += amount; | ||
currentThirst = Mathf.Clamp(currentThirst, 0, maxThirst); | ||
UpdateThirstBar(); | ||
} | ||
|
||
private void UpdateThirstBar() | ||
{ | ||
if (thirstBar != null) | ||
{ | ||
thirstBar.fillAmount = currentThirst / maxThirst; | ||
} | ||
} | ||
} | ||
|
Oops, something went wrong.