From e84b2d4938dc7fd5a780f9dc837ae932d7b04888 Mon Sep 17 00:00:00 2001 From: GraphicEdit Date: Thu, 11 Jan 2024 00:55:33 +0000 Subject: [PATCH] fixes --- DarkFlow/Assets/Scenes/systemTest.unity | 27 +--- .../Scripts/AI/NPC_enemy1/EnemyHealth.cs | 7 +- .../AdrenalineTrigger-checkpoint.cs | 37 ----- .../CharacterMain-checkpoint.cs | 68 ---------- .../.ipynb_checkpoints/Health-checkpoint.cs | 126 ------------------ .../.ipynb_checkpoints/Settings-checkpoint.cs | 72 ---------- .../ThirstMeter-checkpoint.cs | 38 ------ .../Scripts/CharacterSystems/Health/Health.cs | 14 +- 8 files changed, 17 insertions(+), 372 deletions(-) delete mode 100644 DarkFlow/Assets/Scripts/CharacterSystems/.ipynb_checkpoints/AdrenalineTrigger-checkpoint.cs delete mode 100644 DarkFlow/Assets/Scripts/CharacterSystems/.ipynb_checkpoints/CharacterMain-checkpoint.cs delete mode 100644 DarkFlow/Assets/Scripts/CharacterSystems/.ipynb_checkpoints/Health-checkpoint.cs delete mode 100644 DarkFlow/Assets/Scripts/CharacterSystems/.ipynb_checkpoints/Settings-checkpoint.cs delete mode 100644 DarkFlow/Assets/Scripts/CharacterSystems/.ipynb_checkpoints/ThirstMeter-checkpoint.cs diff --git a/DarkFlow/Assets/Scenes/systemTest.unity b/DarkFlow/Assets/Scenes/systemTest.unity index 6a2fc9e..6b2e294 100644 --- a/DarkFlow/Assets/Scenes/systemTest.unity +++ b/DarkFlow/Assets/Scenes/systemTest.unity @@ -38,7 +38,7 @@ RenderSettings: m_ReflectionIntensity: 1 m_CustomReflection: {fileID: 0} m_Sun: {fileID: 0} - m_IndirectSpecularColor: {r: 0.18028378, g: 0.22571412, b: 0.30692285, a: 1} + m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1} m_UseRadianceAmbientProbe: 0 --- !u!157 &3 LightmapSettings: @@ -628,7 +628,6 @@ GameObject: - component: {fileID: 518869417} - component: {fileID: 518869416} - component: {fileID: 518869415} - - component: {fileID: 518869413} - component: {fileID: 518869414} - component: {fileID: 518869420} m_Layer: 0 @@ -638,26 +637,6 @@ GameObject: m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 ---- !u!114 &518869413 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 518869412} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: d5a57f767e5e46a458fc5d3c628d0cbb, type: 3} - m_Name: - m_EditorClassIdentifier: - GlobalObjectIdHash: 2367159778 - AlwaysReplicateAsRoot: 0 - SynchronizeTransform: 1 - ActiveSceneSynchronization: 0 - SceneMigrationSynchronization: 1 - SpawnWithObservers: 1 - DontDestroyWithOwner: 0 - AutoObjectParentSync: 1 --- !u!114 &518869414 MonoBehaviour: m_ObjectHideFlags: 0 @@ -1316,6 +1295,8 @@ MonoBehaviour: weaponAudioSource: {fileID: 1918339079} weaponSounds: [] weaponCostQuint: 0 + smg1AmmoCount: 30 + smg1RoundDamage: 10 --- !u!65 &1029546733 BoxCollider: m_ObjectHideFlags: 0 @@ -2116,6 +2097,8 @@ MonoBehaviour: weaponAudioSource: {fileID: 1490458851} weaponSounds: [] weaponCostQuint: 0 + smg1AmmoCount: 30 + smg1RoundDamage: 10 --- !u!114 &1448541920 MonoBehaviour: m_ObjectHideFlags: 0 diff --git a/DarkFlow/Assets/Scripts/AI/NPC_enemy1/EnemyHealth.cs b/DarkFlow/Assets/Scripts/AI/NPC_enemy1/EnemyHealth.cs index 5eb3ff7..be53839 100644 --- a/DarkFlow/Assets/Scripts/AI/NPC_enemy1/EnemyHealth.cs +++ b/DarkFlow/Assets/Scripts/AI/NPC_enemy1/EnemyHealth.cs @@ -1,11 +1,14 @@ using UnityEngine; // Create a ScriptableObject that represents the health of an enemy. -[CreateAssetMenu(fileName = "EnemyHealth", menuName = "ScriptableObjects/EnemyHealth", order = 1)] +[CreateAssetMenu(fileName = "EnemyHealth", menuName = "Health/EnemyHealth", order = 1)] public class EnemyHealth : ScriptableObject { public int maxHealth = 5; // Health points, as per our requirement public int currentHealth; + public GameObject Prefab; + + //public GameObject IntroPrefab => Prefab; // Call this method to initialize the health when you spawn the enemy. public void OnEnable() @@ -16,7 +19,7 @@ public void OnEnable() public void TakeDamage(int damage) { currentHealth -= damage; - + if (currentHealth <= 0) { Die(); diff --git a/DarkFlow/Assets/Scripts/CharacterSystems/.ipynb_checkpoints/AdrenalineTrigger-checkpoint.cs b/DarkFlow/Assets/Scripts/CharacterSystems/.ipynb_checkpoints/AdrenalineTrigger-checkpoint.cs deleted file mode 100644 index 79f4380..0000000 --- a/DarkFlow/Assets/Scripts/CharacterSystems/.ipynb_checkpoints/AdrenalineTrigger-checkpoint.cs +++ /dev/null @@ -1,37 +0,0 @@ -using UnityEngine; -using UnityEngine.UI; - -public class AdrenalineTrigger : MonoBehaviour -{ - private float adrenalineLevel = 0f; - public float adrenalineTriggerThreshold = 20f; // Threshold for adrenaline boost - public Image adrenalineBar; - private HealthRegeneration healthScript; - - private void Start() - { - healthScript = GetComponent(); - } - - private void Update() - { - if (healthScript.GetCurrentHealth() <= adrenalineTriggerThreshold && adrenalineLevel < 100f) - { - adrenalineLevel += Time.deltaTime * 50f; // Increase adrenaline - UpdateAdrenalineBar(); - } - else - { - adrenalineLevel = 0f; - UpdateAdrenalineBar(); - } - } - - private void UpdateAdrenalineBar() - { - if (adrenalineBar != null) - { - adrenalineBar.fillAmount = adrenalineLevel / 100f; - } - } -} diff --git a/DarkFlow/Assets/Scripts/CharacterSystems/.ipynb_checkpoints/CharacterMain-checkpoint.cs b/DarkFlow/Assets/Scripts/CharacterSystems/.ipynb_checkpoints/CharacterMain-checkpoint.cs deleted file mode 100644 index 4d9aa64..0000000 --- a/DarkFlow/Assets/Scripts/CharacterSystems/.ipynb_checkpoints/CharacterMain-checkpoint.cs +++ /dev/null @@ -1,68 +0,0 @@ -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(); - /* - - - private void Update() - { - HandleMovement(); - Move(); - } - - private void Move(InputAction context) - { - if(context != null) - { - moveInput = context.ReadValue(); - } - - } - - 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); - - } - - */ - } -} diff --git a/DarkFlow/Assets/Scripts/CharacterSystems/.ipynb_checkpoints/Health-checkpoint.cs b/DarkFlow/Assets/Scripts/CharacterSystems/.ipynb_checkpoints/Health-checkpoint.cs deleted file mode 100644 index 5219998..0000000 --- a/DarkFlow/Assets/Scripts/CharacterSystems/.ipynb_checkpoints/Health-checkpoint.cs +++ /dev/null @@ -1,126 +0,0 @@ -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 bodyPartHealth = new Dictionary(); - private Dictionary toxicBar = new Dictionary(); // 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(); - - } -} diff --git a/DarkFlow/Assets/Scripts/CharacterSystems/.ipynb_checkpoints/Settings-checkpoint.cs b/DarkFlow/Assets/Scripts/CharacterSystems/.ipynb_checkpoints/Settings-checkpoint.cs deleted file mode 100644 index 96a2212..0000000 --- a/DarkFlow/Assets/Scripts/CharacterSystems/.ipynb_checkpoints/Settings-checkpoint.cs +++ /dev/null @@ -1,72 +0,0 @@ -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. - -} diff --git a/DarkFlow/Assets/Scripts/CharacterSystems/.ipynb_checkpoints/ThirstMeter-checkpoint.cs b/DarkFlow/Assets/Scripts/CharacterSystems/.ipynb_checkpoints/ThirstMeter-checkpoint.cs deleted file mode 100644 index 898a27e..0000000 --- a/DarkFlow/Assets/Scripts/CharacterSystems/.ipynb_checkpoints/ThirstMeter-checkpoint.cs +++ /dev/null @@ -1,38 +0,0 @@ -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; - } - } -} - diff --git a/DarkFlow/Assets/Scripts/CharacterSystems/Health/Health.cs b/DarkFlow/Assets/Scripts/CharacterSystems/Health/Health.cs index 5219998..7446ddb 100644 --- a/DarkFlow/Assets/Scripts/CharacterSystems/Health/Health.cs +++ b/DarkFlow/Assets/Scripts/CharacterSystems/Health/Health.cs @@ -2,9 +2,9 @@ using System.Collections.Generic; using System.Linq; using UnityEngine; -using Unity.Netcode; -public class Health: NetworkBehaviour + +public class Health : MonoBehaviour { // ***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. @@ -49,7 +49,7 @@ private void Start() 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; + // if (!isLocalPlayer) return; bodyPartHealth[BodyPart.Head] = 100f; bodyPartHealth[BodyPart.Chest] = 100f; @@ -61,7 +61,7 @@ private void Start() public void InitializeToxicBar() // Load the meters up and zero them out, we'll get the values later from the server. { - // if (!isLocalPlayer) return; + // if (!isLocalPlayer) return; toxicBar[Toxicity.Bio] = 0f; toxicBar[Toxicity.Psych] = 0f; @@ -74,7 +74,7 @@ public void InitializeToxicBar() // Load the meters up and zero them out, we'll else { armorHealth -= D; - if(armorHealth <= 0) + if (armorHealth <= 0) { armorHealth = 0; Debug.Log("Armor on " + this.gameObject + " has been destroyed beyond repair!"); @@ -84,9 +84,9 @@ public void InitializeToxicBar() // Load the meters up and zero them out, we'll 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 (bodyPartHealth.ContainsKey(bodyPart)) { - if(D > 0) + if (D > 0) { bodyPartHealth[bodyPart] -= D; healthMain -= D / bodyPartHealth[bodyPart] * 2;