From 332a3b73f14bb9bd3b8503f4e9c43a846d74e7f6 Mon Sep 17 00:00:00 2001 From: michaelday008 Date: Wed, 9 Oct 2019 00:48:51 -0700 Subject: [PATCH] 0.3a RC6 bugfixes and comment cleanup --- Abilities/Ability/BaseAbility.cs | 6 +- Abilities/Effect/AOEEffect.cs | 16 ++- Abilities/Effect/AbilityEffect.cs | 16 ++- Abilities/Effect/LengthEffect.cs | 1 - Abilities/Effect/MaterialChangeController.cs | 18 ++-- Abilities/Effect/ProjectileEffect.cs | 3 +- .../AnyRPGCharacterPreviewCameraController.cs | 5 +- Characters/AI/AICombat.cs | 5 +- Characters/AI/AIController.cs | 10 +- Characters/AI/UnitSpawnNode.cs | 2 +- Characters/Animators/CharacterAnimator.cs | 42 ++++---- Characters/BaseClasses/BaseController.cs | 18 +++- .../BaseClasses/CharacterAbilityManager.cs | 14 ++- Characters/BaseClasses/CharacterCombat.cs | 9 +- Characters/BaseClasses/CharacterMotor.cs | 100 ++++++++---------- Characters/BaseClasses/CharacterStats.cs | 3 +- Characters/BaseClasses/CharacterUnit.cs | 3 +- Characters/BaseClasses/ICharacterCombat.cs | 2 +- .../BaseClasses/ICharacterController.cs | 3 +- Characters/BaseClasses/LootableCharacter.cs | 3 +- .../PlayerUnitMovementController.cs | 3 +- Characters/Player/PlayerAbilityManager.cs | 4 +- Characters/Player/PlayerCombat.cs | 10 +- Characters/Player/PlayerController.cs | 6 +- Characters/Player/PlayerStats.cs | 2 +- GameManager/EquipmentManager.cs | 12 +-- GameManager/InputManager.cs | 2 +- GameManager/InventoryManager.cs | 43 +++++--- GameManager/PlayerManager.cs | 5 +- GameManager/SaveManager.cs | 3 +- GameManager/SystemEventManager.cs | 2 +- Interactables/CutSceneInteractable.cs | 2 +- Interactables/GatheringNode.cs | 2 +- Interactables/Interactable.cs | 12 +-- Interactables/InteractableOption.cs | 2 - Inventory/SlotScript.cs | 8 +- Items/Equipment.cs | 4 + Items/Item.cs | 2 +- Items/Weapon.cs | 9 +- Quest/Quest.cs | 1 - Quest/QuestNode.cs | 5 - UI/Buttons/ActionButton.cs | 18 +--- UI/Buttons/CharacterButton.cs | 5 +- UI/Buttons/VendorButton.cs | 12 ++- UI/Buttons/VendorButton.prefab | 45 ++++++-- UI/CloseableWindows/CharacterCreatorPanel.cs | 2 +- UI/CloseableWindows/CharacterPanel.cs | 8 +- UI/CloseableWindows/CloseableWindow.cs | 2 +- UI/CloseableWindows/CraftingUI.cs | 23 ++-- UI/CloseableWindows/DialogPanelController.cs | 12 +-- UI/CloseableWindows/InteractionPanelUI.cs | 2 +- UI/CloseableWindows/LoadGamePanel.cs | 2 +- UI/CloseableWindows/LootUI.cs | 10 +- UI/CloseableWindows/MainMapController.cs | 2 +- UI/CloseableWindows/QuestGiverUI.cs | 46 ++------ UI/CloseableWindows/QuestLog.cs | 15 +-- UI/CloseableWindows/VendorUI.cs | 5 +- UI/HandScript.cs | 3 +- UI/PanelControllers/BagBarController.cs | 2 +- .../MiniMapIndicatorController.cs | 2 +- 60 files changed, 308 insertions(+), 326 deletions(-) diff --git a/Abilities/Ability/BaseAbility.cs b/Abilities/Ability/BaseAbility.cs index 0dd271cf0..8b3e81c8d 100644 --- a/Abilities/Ability/BaseAbility.cs +++ b/Abilities/Ability/BaseAbility.cs @@ -169,7 +169,7 @@ public bool CanCast() { public void Use() { //Debug.Log("BaseAbility.Use()"); - // testing - warp in canCast to prevent casting any ability without the proper weapon affinity + // prevent casting any ability without the proper weapon affinity if (CanCast()) { PlayerManager.MyInstance.MyCharacter.MyCharacterAbilityManager.BeginAbility(this); } @@ -322,8 +322,9 @@ public virtual void StartCasting(BaseCharacter source) { if (castingAnimationClip != null) { source.MyCharacterUnit.MyCharacterAnimator.HandleCastingAbility(castingAnimationClip, this); } - // TESTING GRAVITY FREEZE FOR CASTING + // GRAVITY FREEZE FOR CASTING // DISABLING SINCE IT IS CAUSING INSTANT CASTS TO STOP CHARACTER WHILE MOVING. MAYBE CHECK IF CAST TIMER AND THEN DO IT? + // NEXT LINE NO LONGER NEEDED SINCE WE NOW ACTUALLY CHECK THE REAL DISTANCE MOVED BY THE CHARACTER AND DON'T CANCEL CAST UNTIL DISTANCE IS > 0.1F //source.MyRigidBody.constraints = RigidbodyConstraints.FreezeAll; if (abilityCastingPrefab != null) { @@ -331,7 +332,6 @@ public virtual void StartCasting(BaseCharacter source) { Vector3 spawnLocation = new Vector3(source.MyCharacterUnit.transform.position.x + prefabOffset.x, source.MyCharacterUnit.transform.position.y + prefabOffset.y, source.MyCharacterUnit.transform.position.z + prefabOffset.z); //Debug.Log("BaseAbility.OnCastStart(): Instantiating spell casting prefab at " + source.transform.position + "; spawnLocation is : " + spawnLocation); //abilityCastingPrefabRef = Instantiate(abilityCastingPrefab, spawnLocation, source.MyCharacterUnit.transform.rotation * Quaternion.Euler(source.MyCharacterUnit.transform.TransformDirection(prefabRotation)), source.transform); - //TESTING GET PROPER ROTATION ON CASTING PREFABS abilityCastingPrefabRef = Instantiate(abilityCastingPrefab, spawnLocation, Quaternion.LookRotation(source.MyCharacterUnit.transform.forward) * Quaternion.Euler(prefabRotation), source.MyCharacterUnit.transform); } } diff --git a/Abilities/Effect/AOEEffect.cs b/Abilities/Effect/AOEEffect.cs index 14b7d81dc..88c31694b 100644 --- a/Abilities/Effect/AOEEffect.cs +++ b/Abilities/Effect/AOEEffect.cs @@ -49,26 +49,29 @@ public override void CastComplete(BaseCharacter source, GameObject target, Abili TargetAOEComplete(source, target, abilityAffectInput); } - private void TargetAOEHit(BaseCharacter source, GameObject target, AbilityEffectOutput abilityEffectInput) { + private float TargetAOEHit(BaseCharacter source, GameObject target, AbilityEffectOutput abilityEffectInput) { //Debug.Log(MyName + "AOEEffect.TargetAOEHit(" + (source == null ? "null" : source.name) + ", " + (target == null ? "null" : target.name) + ")"); List validTargets = GetValidTargets(source, target, abilityEffectInput, hitAbilityEffectList); foreach (GameObject validTarget in validTargets) { PerformAOEHit(source, validTarget, 1f / validTargets.Count, abilityEffectInput); } + return validTargets.Count; } - private void TargetAOETick(BaseCharacter source, GameObject target, AbilityEffectOutput abilityEffectInput) { + private float TargetAOETick(BaseCharacter source, GameObject target, AbilityEffectOutput abilityEffectInput) { List validTargets = GetValidTargets(source, target, abilityEffectInput, tickAbilityEffectList); foreach (GameObject validTarget in validTargets) { PerformAOETick(source, validTarget, 1f / validTargets.Count, abilityEffectInput); } + return validTargets.Count; } - private void TargetAOEComplete(BaseCharacter source, GameObject target, AbilityEffectOutput abilityEffectInput) { + private float TargetAOEComplete(BaseCharacter source, GameObject target, AbilityEffectOutput abilityEffectInput) { List validTargets = GetValidTargets(source, target, abilityEffectInput, completeAbilityEffectList); foreach (GameObject validTarget in validTargets) { PerformAOEComplete(source, validTarget, 1f / validTargets.Count, abilityEffectInput); } + return validTargets.Count; } private List GetValidTargets(BaseCharacter source, GameObject target, AbilityEffectOutput abilityEffectInput, List abilityEffectList) { @@ -89,11 +92,14 @@ private List GetValidTargets(BaseCharacter source, GameObject target } aoeSpawnCenter += source.MyCharacterUnit.transform.TransformDirection(aoeCenter); Collider[] colliders = new Collider[0]; + int playerMask = 1 << LayerMask.NameToLayer("Player"); + int characterMask = 1 << LayerMask.NameToLayer("CharacterUnit"); + int validMask = (playerMask | characterMask); if (useRadius) { - colliders = Physics.OverlapSphere(aoeSpawnCenter, aoeRadius); + colliders = Physics.OverlapSphere(aoeSpawnCenter, aoeRadius, validMask); } if (useExtents) { - colliders = Physics.OverlapBox(aoeSpawnCenter, aoeExtents / 2f, source.MyCharacterUnit.transform.rotation); + colliders = Physics.OverlapBox(aoeSpawnCenter, aoeExtents / 2f, source.MyCharacterUnit.transform.rotation, validMask); } //Debug.Log("AOEEffect.Cast(): Casting OverlapSphere with radius: " + aoeRadius); List validTargets = new List(); diff --git a/Abilities/Effect/AbilityEffect.cs b/Abilities/Effect/AbilityEffect.cs index b81a2d0f3..afd21c252 100644 --- a/Abilities/Effect/AbilityEffect.cs +++ b/Abilities/Effect/AbilityEffect.cs @@ -256,23 +256,23 @@ void PerformMaterialChange(BaseCharacter source, GameObject target) { return; } if (target == null) { - Debug.Log("target is null. returning"); + //Debug.Log("target is null. returning"); return; } Renderer[] meshRenderer = target.GetComponentsInChildren(); if (meshRenderer == null || meshRenderer.Length == 0) { - Debug.Log(resourceName + ".AbilityEffect.PerformmaterialChange(): Unable to find mesh renderer in target."); + //Debug.Log(resourceName + ".AbilityEffect.PerformmaterialChange(): Unable to find mesh renderer in target."); meshRenderer = target.GetComponentsInChildren(); if (meshRenderer == null || meshRenderer.Length == 0) { - Debug.Log(resourceName + ".AbilityEffect.PerformmaterialChange(): Unable to find skinned mesh renderer in target."); + //Debug.Log(resourceName + ".AbilityEffect.PerformmaterialChange(): Unable to find skinned mesh renderer in target."); return; } else { - Debug.Log(resourceName + ".AbilityEffect.PerformmaterialChange(): Found " + meshRenderer.Length + " Skinned Mesh Renderers"); + //Debug.Log(resourceName + ".AbilityEffect.PerformmaterialChange(): Found " + meshRenderer.Length + " Skinned Mesh Renderers"); } } else { - Debug.Log(resourceName + ".AbilityEffect.PerformmaterialChange(): Found " + meshRenderer.Length + " Mesh Renderers"); + //Debug.Log(resourceName + ".AbilityEffect.PerformmaterialChange(): Found " + meshRenderer.Length + " Mesh Renderers"); } @@ -282,4 +282,10 @@ void PerformMaterialChange(BaseCharacter source, GameObject target) { } } + public AbilityEffectOutput ApplyInputMultiplier(AbilityEffectOutput abilityEffectInput) { + abilityEffectInput.healthAmount = (int)(abilityEffectInput.healthAmount * inputMultiplier); + abilityEffectInput.manaAmount = (int)(abilityEffectInput.manaAmount * inputMultiplier); + return abilityEffectInput; + } + } \ No newline at end of file diff --git a/Abilities/Effect/LengthEffect.cs b/Abilities/Effect/LengthEffect.cs index 1220af129..0f4059d7f 100644 --- a/Abilities/Effect/LengthEffect.cs +++ b/Abilities/Effect/LengthEffect.cs @@ -79,7 +79,6 @@ public override void Cast(BaseCharacter source, GameObject target, GameObject or } base.Cast(source, target, originalTarget, abilityEffectInput); if (abilityEffectPrefab != null && prefabSpawnLocation != PrefabSpawnLocation.None && (target != null || prefabSpawnLocation == PrefabSpawnLocation.Point || requiresTarget == false)) { - // FIX THIS. ITS ADDING TOO MUCH TOGETHER - FIXED :) - BUT NOW GROUND TARGET IS BROKEN :( //float finalX = (prefabParent == null ? prefabOffset.x : prefabParent.TransformPoint(prefabOffset).x); //float finalY = (prefabParent == null ? prefabOffset.y : prefabParent.TransformPoint(prefabOffset).x); //float finalZ = (prefabParent == null ? prefabOffset.z : prefabParent.TransformPoint(prefabOffset).z); diff --git a/Abilities/Effect/MaterialChangeController.cs b/Abilities/Effect/MaterialChangeController.cs index 3034eafe7..ff51e4a8d 100644 --- a/Abilities/Effect/MaterialChangeController.cs +++ b/Abilities/Effect/MaterialChangeController.cs @@ -21,33 +21,33 @@ public void Initialize(float changeDuration, Material temporaryMaterial) { meshRenderers = GetComponentsInChildren(); if (meshRenderers == null || meshRenderers.Length == 0) { - Debug.Log("MaterialChangeController.Initialize(): Unable to find mesh renderer in target."); + //Debug.Log("MaterialChangeController.Initialize(): Unable to find mesh renderer in target."); meshRenderers = GetComponentsInChildren(); if (meshRenderers == null || meshRenderers.Length == 0) { - Debug.Log("MaterialChangeController.Initialize(): Unable to find skinned mesh renderer in target."); + //Debug.Log("MaterialChangeController.Initialize(): Unable to find skinned mesh renderer in target."); return; } else { - Debug.Log("MaterialChangeController.Initialize(): Found " + meshRenderers.Length + " Skinned Mesh Renderers"); + //Debug.Log("MaterialChangeController.Initialize(): Found " + meshRenderers.Length + " Skinned Mesh Renderers"); } } else { - Debug.Log("MaterialChangeController.Initialize(): Found " + meshRenderers.Length + " Mesh Renderers"); + //Debug.Log("MaterialChangeController.Initialize(): Found " + meshRenderers.Length + " Mesh Renderers"); } PerformMaterialChange(); } public void PerformMaterialChange() { - Debug.Log("MaterialChangeController.PerformMaterialChange()"); + //Debug.Log("MaterialChangeController.PerformMaterialChange()"); if (meshRenderers == null) { - Debug.Log("MaterialChangeController.PerformMaterialChange(): meshRender is null. This shouldn't happen because we checked before instantiating this!"); + //Debug.Log("MaterialChangeController.PerformMaterialChange(): meshRender is null. This shouldn't happen because we checked before instantiating this!"); return; } foreach (Renderer renderer in meshRenderers) { originalMaterials.Add(renderer, renderer.materials); - Debug.Log("MaterialChangeController.PerformMaterialChange(): material length: " + originalMaterials[renderer].Length); + //Debug.Log("MaterialChangeController.PerformMaterialChange(): material length: " + originalMaterials[renderer].Length); temporaryMaterials = new Material[originalMaterials[renderer].Length]; - Debug.Log("MaterialChangeController.PerformMaterialChange(): temporary materials length: " + temporaryMaterials.Length); + //Debug.Log("MaterialChangeController.PerformMaterialChange(): temporary materials length: " + temporaryMaterials.Length); for (int i = 0; i < originalMaterials[renderer].Length; i++) { //temporaryMaterials[i] = originalMaterials[renderer][i]; temporaryMaterials[i] = temporaryMaterial; @@ -61,7 +61,7 @@ public void PerformMaterialChange() { public void RevertMaterialChange () { if (meshRenderers == null) { - Debug.Log("meshRender is null. This shouldn't happen because we checked before instantiating this!"); + //Debug.Log("meshRender is null. This shouldn't happen because we checked before instantiating this!"); return; } diff --git a/Abilities/Effect/ProjectileEffect.cs b/Abilities/Effect/ProjectileEffect.cs index b8ad88e3c..d65f1d11b 100644 --- a/Abilities/Effect/ProjectileEffect.cs +++ b/Abilities/Effect/ProjectileEffect.cs @@ -9,10 +9,11 @@ public class ProjectileEffect : DirectEffect { public float projectileSpeed = 0; public override void Cast(BaseCharacter source, GameObject target, GameObject originalTarget, AbilityEffectOutput abilityEffectInput) { - //Debug.Log(abilityEffectName + ".ProjectileAttackEffect.Cast(" + source.name + ", " + target.name + ")"); + //Debug.Log(MyName + ".ProjectileAttackEffect.Cast(" + source.name + ", " + target.name + ")"); base.Cast(source, target, originalTarget, abilityEffectInput); ProjectileScript projectileScript = abilityEffectObject.GetComponent(); if (projectileScript != null) { + abilityEffectInput = ApplyInputMultiplier(abilityEffectInput); projectileScript.Initialize(projectileSpeed, source, target, new Vector3(0, 1, 0), abilityEffectInput); projectileScript.OnCollission += HandleCollission; } diff --git a/Camera/AnyRPGCharacterPreviewCameraController.cs b/Camera/AnyRPGCharacterPreviewCameraController.cs index ce89243d7..224de3a3f 100644 --- a/Camera/AnyRPGCharacterPreviewCameraController.cs +++ b/Camera/AnyRPGCharacterPreviewCameraController.cs @@ -163,9 +163,6 @@ private void LateUpdate() { cameraPan = false; cameraZoom = false; - // TESTING MOVE TO BELOW SO ITS UPDATED BASED ON MIDDLE MOUSE PAN - //SetTargetPosition(); - // handleZoom if (!mouseOutsideWindow && InputManager.MyInstance.mouseScrolled) { //Debug.Log("Mouse Scrollwheel: " + Input.GetAxis("Mouse ScrollWheel")); @@ -203,7 +200,7 @@ private void LateUpdate() { cameraPan = true; } - // TESTING MOVE TO BELOW SO ITS UPDATED BASED ON MIDDLE MOUSE PAN + // THIS MUST BE DOWN HERE SO ITS UPDATED BASED ON MIDDLE MOUSE PAN SetTargetPosition(); // follow the player diff --git a/Characters/AI/AICombat.cs b/Characters/AI/AICombat.cs index 0e2c9019d..5ef30a8d8 100644 --- a/Characters/AI/AICombat.cs +++ b/Characters/AI/AICombat.cs @@ -23,15 +23,16 @@ public override void ClearAggro(GameObject target) { } */ - public override void TakeDamage(int damage, Vector3 sourcePosition, BaseCharacter source, CombatType combatType, CombatMagnitude combatMagnitude, string abilityName) { + public override bool TakeDamage(int damage, Vector3 sourcePosition, BaseCharacter source, CombatType combatType, CombatMagnitude combatMagnitude, string abilityName) { //Debug.Log("AICombat.TakeDamage(" + damage + ", " + sourcePosition + ", " + source + ")"); if (!((baseCharacter.MyCharacterController as AIController).MyCurrentState is EvadeState) && !((baseCharacter.MyCharacterController as AIController).MyCurrentState is DeathState)) { // order is important here. we want to set target before taking damage because taking damage could kill us, and we don't want to re-trigger and agro on someone after we are dead // this should happen automatically inside the update loop of idle state //baseCharacter.MyCharacterController.SetTarget(source); - base.TakeDamage(damage, sourcePosition, source, combatType, combatMagnitude, abilityName); + return base.TakeDamage(damage, sourcePosition, source, combatType, combatMagnitude, abilityName); } + return false; } /* public override void TakeAbilityDamage(int damage, GameObject source) { diff --git a/Characters/AI/AIController.cs b/Characters/AI/AIController.cs index 90edb395a..a32b4b1da 100644 --- a/Characters/AI/AIController.cs +++ b/Characters/AI/AIController.cs @@ -51,10 +51,6 @@ protected override void Awake() { baseCharacter = GetComponent() as ICharacter; aiPatrol = GetComponent(); - // just in case this character is spawning not directly on a navmesh (inaccurate editor placement etc) get the closest valid navmesh position - // if one cannot be found, just use the current position anyway - // this will hopefully prevent a character from trying to return to a spawn point that is out of reach, and never exiting return state because the spawn point is never near enough to get inside the hitbox - //Debug.Log(gameObject.name + ".AIController.Awake(): MyStartPosition: " + MyStartPosition); MyAggroRange = initialAggroRange; } @@ -70,7 +66,7 @@ protected override void Start() { } MyStartPosition = (correctedPosition != Vector3.zero ? correctedPosition : transform.position); - // testing this was after the idlestate but that doesn't make sense. hopefully this doesn't break anything + // ensure base.Start is run before change to IdleState base.Start(); ChangeState(new IdleState()); @@ -94,7 +90,7 @@ public void ApplyControlEffects(BaseCharacter source) { masterUnit.MyCharacterCombat.OnDropCombat += OnMasterDropCombat; (masterUnit.MyCharacterController as PlayerController).OnManualMovement += OnMasterMovement; - // TESTING, DIDN'T CLEAR AGRO TABLE OR NOTIFY REPUTATION CHANGE + // CLEAR AGRO TABLE OR NOTIFY REPUTATION CHANGE - THIS SHOULD PREVENT ATTACKING SOMETHING THAT SUDDENLY IS UNDER CONTROL AND NOW YOUR FACTION WHILE YOU ARE INCOMBAT WITH IT MyBaseCharacter.MyCharacterCombat.MyAggroTable.ClearTable(); SystemEventManager.MyInstance.NotifyOnReputationChange(); SetMasterRelativeDestination(); @@ -176,8 +172,6 @@ public void UpdateTarget() { } AggroNode topNode; if (underControl) { - // TESTING FOR MASTER CONTROL - //return; topNode = masterUnit.MyCharacterCombat.MyAggroTable.MyTopAgroNode; } else { topNode = baseCharacter.MyCharacterCombat.MyAggroTable.MyTopAgroNode; diff --git a/Characters/AI/UnitSpawnNode.cs b/Characters/AI/UnitSpawnNode.cs index 3dac7ab7a..f1566ca3b 100644 --- a/Characters/AI/UnitSpawnNode.cs +++ b/Characters/AI/UnitSpawnNode.cs @@ -235,7 +235,7 @@ private void SpawnWithDelay() { if ((spawnReferences.Count < GetMaxUnits() || GetMaxUnits() == -1) && MyPrerequisitesMet) { if (countDownRoutine == null) { countDownRoutine = StartCoroutine(StartSpawnCountdown(spawnTimer)); - // TESTING TO AVOID MULTIPLE SPAWNS DUE TO TRIGGER BY PREREQUISITES ON A NODE WITH A ZERO DELAY TIME -- MOVED INSIDE OUTER ROUTINE CHECK + // AVOID MULTIPLE SPAWNS DUE TO TRIGGER BY PREREQUISITES ON A NODE WITH A ZERO DELAY TIME -- MOVED INSIDE OUTER ROUTINE CHECK if (delayRoutine == null) { delayRoutine = StartCoroutine(StartSpawnDelayCountDown()); } diff --git a/Characters/Animators/CharacterAnimator.cs b/Characters/Animators/CharacterAnimator.cs index a4309771e..3b0c3cacd 100644 --- a/Characters/Animators/CharacterAnimator.cs +++ b/Characters/Animators/CharacterAnimator.cs @@ -147,7 +147,7 @@ public void SetAnimationProfileOverride(AnimationProfile animationProfile) { public void ResetAnimationProfile() { //Debug.Log("CharacterAnimator.ResetAnimationProfile()"); currentAttackAnimationProfile = defaultAttackAnimationProfile; - // testing reset should now actually change back to the original animations + // change back to the original animations SetAnimationClipOverrides(); } @@ -547,25 +547,30 @@ public void SetVelocity(Vector3 varValue) { float usedBaseAnimationSpeed = 1; float multiplier = 1; - if (varValue.x < 0 && varValue.z > 0) { - // strafe forward left - usedBaseAnimationSpeed = (absValue > baseJogStrafeForwardLeftAnimationSpeed ? baseJogStrafeForwardLeftAnimationSpeed : baseWalkStrafeForwardLeftAnimationSpeed); - multiplier = (absValue / usedBaseAnimationSpeed); - } else if (varValue.x > 0 && varValue.z > 0) { - // strafe forward right - usedBaseAnimationSpeed = (absValue > baseJogStrafeForwardRightAnimationSpeed ? baseJogStrafeForwardRightAnimationSpeed : baseWalkStrafeForwardRightAnimationSpeed); - multiplier = (absValue / usedBaseAnimationSpeed); - } else if (varValue.x == 0 && varValue.z > 0) { + if (absXValue < (absZValue / 2) && varValue.z > 0) { + // the new condition above should account for any animations with extra sideways movement because you have to pass 22.5 degrees in either direction to be considered to be going sideways + //} else if (varValue.x == 0 && varValue.z > 0) { // run forward //usedBaseAnimationSpeed = (absZValue <= 1 ? baseWalkAnimationSpeed : baseRunAnimationSpeed); - usedBaseAnimationSpeed = (absValue > baseRunAnimationSpeed ? baseRunAnimationSpeed : baseWalkAnimationSpeed); + //usedBaseAnimationSpeed = (absZValue > baseWalkAnimationSpeed ? baseRunAnimationSpeed : baseWalkAnimationSpeed); + // since jog forward animation is hardcoded to 2 or more in animator, switched condition below to match + usedBaseAnimationSpeed = (absZValue >= 2 ? baseRunAnimationSpeed : baseWalkAnimationSpeed); //Debug.Log(gameObject.name + ".CharacterAnimator.SetVelocity(" + varValue + "): run: " + baseRunAnimationSpeed + "; walk: " + baseWalkAnimationSpeed + "; used: " + usedBaseAnimationSpeed); //multiplier = varValue.z; multiplier = (absValue / usedBaseAnimationSpeed); - } else if (varValue.x == 0 && varValue.z < 0) { + } else if (absXValue < (absZValue / 2) && varValue.z < 0) { + //} else if (varValue.x == 0 && varValue.z < 0) { // run back usedBaseAnimationSpeed = baseWalkBackAnimationSpeed; multiplier = (absValue / usedBaseAnimationSpeed); + } else if (varValue.x > 0 && absZValue < (absXValue / 2)) { + // strafe right + usedBaseAnimationSpeed = (absValue > baseJogStrafeLeftAnimationSpeed ? baseJogStrafeLeftAnimationSpeed : baseWalkStrafeLeftAnimationSpeed); + multiplier = (absValue / usedBaseAnimationSpeed); + } else if (varValue.x < 0 && absZValue < (absXValue / 2)) { + // strafe left + usedBaseAnimationSpeed = (absValue > baseJogStrafeRightAnimationSpeed ? baseJogStrafeRightAnimationSpeed : baseWalkStrafeRightAnimationSpeed); + multiplier = (absValue / usedBaseAnimationSpeed); } else if (varValue.x > 0 && varValue.z < 0) { // strafe back right usedBaseAnimationSpeed = baseWalkStrafeBackRightAnimationSpeed; @@ -574,16 +579,15 @@ public void SetVelocity(Vector3 varValue) { // strafe back left usedBaseAnimationSpeed = baseWalkStrafeBackLeftAnimationSpeed; multiplier = (absValue / usedBaseAnimationSpeed); - } else if (varValue.x > 0 && varValue.z == 0) { - // strafe right - usedBaseAnimationSpeed = (absValue > baseJogStrafeLeftAnimationSpeed ? baseJogStrafeLeftAnimationSpeed : baseWalkStrafeLeftAnimationSpeed); + } else if (varValue.x < 0 && varValue.z > 0) { + // strafe forward left + usedBaseAnimationSpeed = (absValue > baseJogStrafeForwardLeftAnimationSpeed ? baseJogStrafeForwardLeftAnimationSpeed : baseWalkStrafeForwardLeftAnimationSpeed); multiplier = (absValue / usedBaseAnimationSpeed); - } else if (varValue.x < 0 && varValue.z == 0) { - // strafe left - usedBaseAnimationSpeed = (absValue > baseJogStrafeRightAnimationSpeed ? baseJogStrafeRightAnimationSpeed : baseWalkStrafeRightAnimationSpeed); + } else if (varValue.x > 0 && varValue.z > 0) { + // strafe forward right + usedBaseAnimationSpeed = (absValue > baseJogStrafeForwardRightAnimationSpeed ? baseJogStrafeForwardRightAnimationSpeed : baseWalkStrafeForwardRightAnimationSpeed); multiplier = (absValue / usedBaseAnimationSpeed); } - //Debug.Log(gameObject.name + ".CharacterAnimator.SetVelocityZ(" + varValue + "): used: " + usedBaseAnimationSpeed + "; walk: " + baseWalkAnimationSpeed + "; run: " + baseRunAnimationSpeed); if (varValue.magnitude != 0) { diff --git a/Characters/BaseClasses/BaseController.cs b/Characters/BaseClasses/BaseController.cs index f91527240..66278b4c4 100644 --- a/Characters/BaseClasses/BaseController.cs +++ b/Characters/BaseClasses/BaseController.cs @@ -28,6 +28,9 @@ public abstract class BaseController : MonoBehaviour, ICharacterController { protected bool eventReferencesInitialized = false; protected bool startHasRun = false; + protected Vector3 lastPosition = Vector3.zero; + protected float apparentVelocity; + public GameObject MyTarget { get => target; } public ICharacter MyBaseCharacter { get => baseCharacter; } public float MyMovementSpeed { @@ -50,6 +53,9 @@ public bool MyControlLocked { } } + public Vector3 MyLastPosition { get => lastPosition; set => lastPosition = value; } + public float MyApparentVelocity { get => apparentVelocity; set => apparentVelocity = value; } + protected virtual void Awake() { // overwrite me } @@ -87,7 +93,17 @@ public virtual void OnEnable() { } protected virtual void Update() { - // overwrite me + UpdateApparentVelocity(); + + } + + public virtual void UpdateApparentVelocity() { + // yes this is being called in update, not fixedupdate, but it's only checked when we are standing still trying to cast, so framerates shouldn't be an issue + if (MyBaseCharacter != null && MyBaseCharacter.MyCharacterUnit != null) { + apparentVelocity = Vector3.Distance(MyBaseCharacter.MyCharacterUnit.transform.position, lastPosition) * (1 / Time.deltaTime); + lastPosition = MyBaseCharacter.MyCharacterUnit.transform.position; + } + } protected virtual void FixedUpdate() { diff --git a/Characters/BaseClasses/CharacterAbilityManager.cs b/Characters/BaseClasses/CharacterAbilityManager.cs index 1d82f0c42..bd2c3a3a2 100644 --- a/Characters/BaseClasses/CharacterAbilityManager.cs +++ b/Characters/BaseClasses/CharacterAbilityManager.cs @@ -272,12 +272,8 @@ public IEnumerator PerformAbilityCast(IAbility ability, GameObject target) { } if (canCast == true) { //Debug.Log("Ground Targetting: cancast is true"); - // TESTING ORDERING if (!ability.MyCanSimultaneousCast) { //Debug.Log("CharacterAbilitymanager.PerformAbilityCast() ability: " + ability.MyName + " can simultaneous cast is false, setting casting to true"); - // i think this should work - //isCasting = true; - //isCasting = true; ability.StartCasting(baseCharacter as BaseCharacter); } float currentCastTime = 0f; @@ -297,10 +293,9 @@ public IEnumerator PerformAbilityCast(IAbility ability, GameObject target) { } //Debug.Log(gameObject + ".CharacterAbilityManager.PerformAbilityCast(). nulling tag: " + startTime); + // set currentCast to null because it isn't automatically null until the next frame and we are about to do stuff which requires it to be null immediately currentCast = null; - // I REALLY HOPE THIS DOESN'T BREAK SHIT. BECAUSE UNITY IS RETARDED AND DOESN'T ACTUALLY STOP A COROUTINE WHEN YOU CALL STOP FUCKING COROUTINE, WE HAVE TO SET THAT SHIT TO NULL AND THEN COMPLETE THE ROUTINE - // OTHERWISE WE WILL ATTEMPT TO PERFORM A CAST AND IT WILL NOT BE STOPPED EVEN THOUGH WE TOLD IT TO STOP AND EVERYTHING ELSE AFTER THAT DEPENDS ON IT ACTUALLY BEING FUCKING STOPPED WILL FAIL. if (canCast) { //Debug.Log(gameObject.name + ".CharacterAbilitymanager.PerformAbilityCast(): Cast Complete currentCastTime: " + currentCastTime + "; abilitycastintime: " + ability.MyAbilityCastingTime); if (!ability.MyCanSimultaneousCast) { @@ -428,12 +423,15 @@ public virtual void PerformAbility(IAbility ability, GameObject target, Vector3 /// public void OnManualMovement() { //Debug.Log("CharacterAbilityManager.OnmanualMovement(): Received On Manual Movement Handler"); - StopCasting(); + // adding new code to require some movement distance to prevent gravity while standing still from triggering this + if (MyBaseCharacter.MyCharacterController.MyApparentVelocity > 0.1f) { + StopCasting(); + } } public virtual void StopCasting() { //Debug.Log(gameObject.name + ".CharacterAbilityManager.StopCasting()"); - // TESTING - REMOVED ISCASTING == TRUE BECAUSE IT WAS PREVENTING THE CRAFTING QUEUE FROM WORKING. TECHNICALLY THIS GOT CALLED RIGHT AFTER ISCASTING WAS SET TO FALSE, BUT BEFORE CURRENTCAST WAS NULLED + // REMOVED ISCASTING == TRUE BECAUSE IT WAS PREVENTING THE CRAFTING QUEUE FROM WORKING. TECHNICALLY THIS GOT CALLED RIGHT AFTER ISCASTING WAS SET TO FALSE, BUT BEFORE CURRENTCAST WAS NULLED if (currentCast != null) { //if (currentCast != null && isCasting == true) { //Debug.Log(gameObject.name + ".CharacterAbilityManager.StopCasting(): currentCast is not null, stopping coroutine"); diff --git a/Characters/BaseClasses/CharacterCombat.cs b/Characters/BaseClasses/CharacterCombat.cs index 930312978..45117bca9 100644 --- a/Characters/BaseClasses/CharacterCombat.cs +++ b/Characters/BaseClasses/CharacterCombat.cs @@ -323,7 +323,8 @@ protected virtual bool CanPerformAutoAttack(BaseCharacter characterTarget) { } protected virtual bool AutoAttackTargetIsValid(BaseCharacter characterTarget) { - // testing - ensure the current target is the target we swung at in case we switched target mid swing via tab/agro etc + // ensure the current target is the target we swung at in case we switched target mid swing via tab/agro etc + // this helps prevent spell hit effects from triggering on the wrong unit if (characterTarget != swingTarget) { return false; } @@ -347,7 +348,7 @@ public virtual void Attack (BaseCharacter characterTarget) { //Debug.Log("You must have a target to attack"); //CombatLogUI.MyInstance.WriteCombatMessage("You must have a target to attack"); } else { - // testing - add this here to prevent characters from not being able to attack + // add this here to prevent characters from not being able to attack swingTarget = characterTarget; // perform a faction/liveness check and disable auto-attack if it is not valid @@ -446,7 +447,7 @@ private void TakeDamageCommon(int damage, BaseCharacter source, CombatType comba baseCharacter.MyCharacterStats.ReduceHealth(damage); } - public virtual void TakeDamage(int damage, Vector3 sourcePosition, BaseCharacter source, CombatType combatType, CombatMagnitude combatMagnitude, string abilityName) { + public virtual bool TakeDamage(int damage, Vector3 sourcePosition, BaseCharacter source, CombatType combatType, CombatMagnitude combatMagnitude, string abilityName) { //Debug.Log(gameObject.name + ".TakeDamage(" + damage + ", " + sourcePosition + ", " + source.name + ")"); if (baseCharacter.MyCharacterStats.IsAlive) { //Debug.Log(gameObject.name + " about to take " + damage.ToString() + " damage. Character is alive"); @@ -463,10 +464,12 @@ public virtual void TakeDamage(int damage, Vector3 sourcePosition, BaseCharacter } if (canPerformAbility) { TakeDamageCommon(damage, source, combatType, combatMagnitude, abilityName); + return true; } } else { //Debug.Log("Something is trying to damage our dead character!!!"); } + return false; } public virtual void OnKillConfirmed(BaseCharacter sourceCharacter, float creditPercent) { diff --git a/Characters/BaseClasses/CharacterMotor.cs b/Characters/BaseClasses/CharacterMotor.cs index a39d7d986..4bd07e492 100644 --- a/Characters/BaseClasses/CharacterMotor.cs +++ b/Characters/BaseClasses/CharacterMotor.cs @@ -28,6 +28,11 @@ public class CharacterMotor : MonoBehaviour { private bool setMoveDestination = false; + // last frame number that a navmeshagent destination reset was performed + private int lastResetFrame = -1; + // last frame number that a navmeshagent setdestination command was performed + private int lastCommandFrame = -1; + // properties public float MyMovementSpeed { get => movementSpeed; set => movementSpeed = value; } public GameObject MyTarget { get => target; } @@ -65,27 +70,20 @@ protected virtual void Update() { */ return; } + CheckSetMoveDestination(); + } - // TESTING PUTTING THIS HERE TO AVOID LONGER PAUSE BETWEEN SET MOVE LOCATIONS IN FIXEDUPDATE - // THIS WAY THE TARGETTING AND FOLLOWING SHOULD BE QUICKER, BUT RECALCULATIONS STAY FIXED - if (setMoveDestination) { + protected virtual void CheckSetMoveDestination() { + if (setMoveDestination && characterUnit.MyAgent.pathPending == false && characterUnit.MyAgent.hasPath == false) { //Debug.Log(gameObject.name + ": CharacterMotor.FixedUpdate(): setMoveDestination: true. Set move destination: " + destinationPosition + "; current location: " + transform.position); moveToDestination = true; - // check if position is valid - // should no longer be necessary since the call that set destinationPosition used the navmesh sample - /* - NavMeshHit hit; - if (NavMesh.SamplePosition(destinationPosition, out hit, 10.0f, NavMesh.AllAreas)) { - //Debug.Log(gameObject.name + ": CharacterMotor.FixedUpdate(): destinationPosition " + destinationPosition + " on NavMesh found closest point: " + hit.position + ")"); - destinationPosition = hit.position; - } else { - //Debug.Log(gameObject.name + ": CharacterMotor.FixedUpdate(): destinationPosition " + destinationPosition + " was not on NavMesh!"); - } - */ - //Debug.Log(gameObject.name + ": CharacterMotor.FixedUpdate(): calling: characterUnit.MyAgent.SetDestination(" + destinationPosition + ")"); + //Debug.Log(gameObject.name + ": CharacterMotor.Update(): ISSUING SETDESTINATION: current location: " + transform.position + "; MyAgent.SetDestination(" + destinationPosition + ") on frame: " + Time.frameCount + " with last reset: " + lastResetFrame + "; pathpending: " + characterUnit.MyAgent.pathPending + "; pathstatus: " + characterUnit.MyAgent.pathStatus + "; hasPath: " + characterUnit.MyAgent.hasPath); characterUnit.MyAgent.SetDestination(destinationPosition); + //Debug.Log(gameObject.name + ": CharacterMotor.Update(): AFTER SETDESTINATION: current location: " + transform.position + "; NavMeshAgentDestination: " + characterUnit.MyAgent.destination + "; destinationPosition: " + destinationPosition + "; frame: " + Time.frameCount + "; last reset: " + lastResetFrame + "; pathpending: " + characterUnit.MyAgent.pathPending + "; pathstatus: " + characterUnit.MyAgent.pathStatus + "; hasPath: " + characterUnit.MyAgent.hasPath); + lastCommandFrame = Time.frameCount; setMoveDestination = false; } + } protected virtual void FixedUpdate() { @@ -108,26 +106,7 @@ protected virtual void FixedUpdate() { return; } - // TESTING MOVE THIS ABOVE THE TARGET NULL CHECK BECAUSE ALL MOVETOPOINT COMMANDS BELOW WOULD NOT ALLOW A FRAME TO RESET THE NAVMESHAGENT AND THIS BLOCK WOULD BE CALLED IN THE SAME FRAME - // set this here and let it actually take effect on the next fixedupdate. This should have resulted in at least 1 fixedupdate for agent to let its path reset - if (setMoveDestination) { - //Debug.Log(gameObject.name + ": CharacterMotor.FixedUpdate(): setMoveDestination: true. Set move destination: " + destinationPosition + "; current location: " + transform.position); - moveToDestination = true; - // check if position is valid - // should no longer be necessary since the call that set destinationPosition used the navmesh sample - /* - NavMeshHit hit; - if (NavMesh.SamplePosition(destinationPosition, out hit, 10.0f, NavMesh.AllAreas)) { - //Debug.Log(gameObject.name + ": CharacterMotor.FixedUpdate(): destinationPosition " + destinationPosition + " on NavMesh found closest point: " + hit.position + ")"); - destinationPosition = hit.position; - } else { - //Debug.Log(gameObject.name + ": CharacterMotor.FixedUpdate(): destinationPosition " + destinationPosition + " was not on NavMesh!"); - } - */ - //Debug.Log(gameObject.name + ": CharacterMotor.FixedUpdate(): calling: characterUnit.MyAgent.SetDestination(" + destinationPosition + ")"); - characterUnit.MyAgent.SetDestination(destinationPosition); - setMoveDestination = false; - } + CheckSetMoveDestination(); if (target != null) { @@ -157,15 +136,19 @@ protected virtual void FixedUpdate() { //Debug.Log(gameObject.name + ".CharacterMotor.FixedUpdate(): More than twice the hitbox distance from the target: " + Vector3.Distance(target.transform.position, transform.position)); // this next line is meant to at long distances, move toward the character even if he is off the navmesh and prevent enemy movement stutter chasing a moving target - //if (Vector3.Distance(destinationPosition, characterUnit.MyAgent.destination) > (characterUnit.MyCharacter.MyCharacterStats.MyHitBox * 1.5)) { - if (Vector3.Distance(CorrectedNavmeshPosition(target.transform.position), characterUnit.MyAgent.destination) > (characterUnit.MyCharacter.MyCharacterStats.MyHitBox * 1.5)) { - //if (Vector3.Distance(target.transform.position, destinationPosition) > characterUnit.MyCharacter.MyCharacterStats.MyHitBox || Vector3.Distance(target.transform.position, characterUnit.MyAgent.destination) > characterUnit.MyCharacter.MyCharacterStats.MyHitBox) { + if (Vector3.Distance(CorrectedNavmeshPosition(target.transform.position), characterUnit.MyAgent.destination) > (characterUnit.MyCharacter.MyCharacterStats.MyHitBox * 1.5) && characterUnit.MyAgent.pathPending == false) { // the target has moved more than 1 hitbox from our destination position, re-adjust heading //Debug.Log(gameObject.name + ": FixedUpdate() destinationPosition: " + destinationPosition + " distance: " + Vector3.Distance(target.transform.position, destinationPosition) + ". Issuing MoveToPoint()"); - // updated this to use the corrected position. Hopefully this prevents a mob from stopping chasing you when you are on a non navigable area less than 1 hitbox distance from a navigable area - MoveToPoint(target.transform.position); + if (Time.frameCount != lastResetFrame && Time.frameCount != lastCommandFrame) { + // prevent anything from resetting movement twice in the same frame + //Debug.Log(gameObject.name + ".CharacterMotor.FixedUpdate(): ABOUT TO ISSUE MOVETOPOINT: current location: " + transform.position + "; NavMeshAgentDestination: " + characterUnit.MyAgent.destination + "; destinationPosition: " + destinationPosition + "; frame: " + Time.frameCount + "; last reset: " + lastResetFrame + "; pathpending: " + characterUnit.MyAgent.pathPending + "; pathstatus: " + characterUnit.MyAgent.pathStatus + "; hasPath: " + characterUnit.MyAgent.hasPath); + + MoveToPoint(target.transform.position); + } else { + Debug.Log(gameObject.name + ".CharacterMotor.FixedUpdate(): LONGDISTANCE: WE WERE ABOUT TO ISSUE A MOVETOPOINT ON THE SAME FRAME AS A RESET OR COMMAND: frame: " + Time.frameCount + "; last reset: " + lastResetFrame + "; last command: " + lastCommandFrame); + } } else { - //Debug.Log(gameObject.name + ": FixedUpdate() NOT RECALCULATING! destinationPosition: " + destinationPosition + "; navmeshdestination: " + characterUnit.MyAgent.destination + "; distance: " + Vector3.Distance(CorrectedNavmeshPosition(target.transform.position), characterUnit.MyAgent.destination)); + //Debug.Log(gameObject.name + ": FixedUpdate() NOT RECALCULATING! targetPosition: " + target.transform.position + "; destinationPosition: " + destinationPosition + "; navMeshAgentDestination: " + characterUnit.MyAgent.destination + "; NavMesAgentDestinationToTargetDrift: " + Vector3.Distance(CorrectedNavmeshPosition(target.transform.position), characterUnit.MyAgent.destination) + "; destinationPositionToTargetDifference: " + Vector3.Distance(CorrectedNavmeshPosition(target.transform.position), destinationPosition) + "; frame: " + Time.frameCount); // we are more than 2 meters from the target, and they are less than 2 meters from their last position, destinations may not match but are close enough that there is no point in re-calculating } } else { @@ -173,19 +156,15 @@ protected virtual void FixedUpdate() { //Debug.Log(gameObject.name + ".CharacterMotor.FixedUpdate(): Less than twice the hitbox distance from the target: " + Vector3.Distance(target.transform.position, transform.position) + ". Issuing MoveToPoint (maybe)"); //Debug.Log(gameObject.name + ".CharacterMotor.FixedUpdate(): Less than twice the hitbox distance from the target: " + target.transform.position + "; destination: " + destinationPosition); - // TESTING NEW CONDITIONS TO HOPEFULLY AVOID DEADZONE - since this code is only deadzone code, we don't care that any movement will result in recalculation, because this won't be run - // once we pass the deadzone into the hitbox - // testing some more, since we are going to automatically stop when inside the hitbox anyway, this next check needs to be zero to prevent deadzone because navmeshcorrected position may still be more than 1 hitbox distance away from target - // IF ENEMY MOVEMENT STUTTER IS OBSERVED IN THE DEADZONE, TRY INCREASING THIS VALUE FROM 0F TO 0.5 X THE HITBOX... - // FOR NOW IT SEEMS TO BE OK - if (Vector3.Distance(CorrectedNavmeshPosition(target.transform.position), destinationPosition) > (characterUnit.MyCharacter.MyCharacterStats.MyHitBox / 2)) { - //if (Vector3.Distance(CorrectedNavmeshPosition(target.transform.position), destinationPosition) > characterUnit.MyCharacter.MyCharacterStats.MyHitBox) { - //if (Vector3.Distance(CorrectedNavmeshPosition(target.transform.position), destinationPosition) > characterUnit.MyCharacter.MyCharacterStats.MyHitBox || Vector3.Distance(target.transform.position, characterUnit.MyAgent.destination) > characterUnit.MyCharacter.MyCharacterStats.MyHitBox) { - //if (target.transform.position != destinationPosition || destinationPosition != characterUnit.MyAgent.destination) { - // testing, prevent resetting move position every frame if target is standing still + if (Vector3.Distance(CorrectedNavmeshPosition(target.transform.position), characterUnit.MyAgent.destination) > (characterUnit.MyCharacter.MyCharacterStats.MyHitBox / 2) && characterUnit.MyAgent.pathPending == false) { //Debug.Log(gameObject.name + ": CharacterMotor.FixedUpdate(): current location: " + transform.position + "; destinationPosition: " + destinationPosition + "; characterUnit.MyAgent.destination: " + characterUnit.MyAgent.destination + "; pathpending: " + characterUnit.MyAgent.pathPending + " ISSUING MOVETOPOINT!"); - // updated this to use the corrected position. Hopefully this prevents a mob from stopping chasing you when you are on a non navigable area less than 1 hitbox distance from a navigable area - MoveToPoint(target.transform.position); + if (Time.frameCount != lastResetFrame && Time.frameCount != lastCommandFrame) { + // prevent anything from resetting movement twice in the same frame + //Debug.Log(gameObject.name + ": CharacterMotor.FixedUpdate(): ABOUT TO ISSUE MOVETOPOINT: current location: " + transform.position + "; MyAgent.SetDestination(" + destinationPosition + ") on frame: " + Time.frameCount + " with last reset: " + lastResetFrame + "; pathpending: " + characterUnit.MyAgent.pathPending + "; pathstatus: " + characterUnit.MyAgent.pathStatus + "; hasPath: " + characterUnit.MyAgent.hasPath); + MoveToPoint(target.transform.position); + } else { + Debug.Log(gameObject.name + ".CharacterMotor.FixedUpdate(): SHORTDISTANCE: WE WERE ABOUT TO ISSUE A MOVETOPOINT ON THE SAME FRAME AS A RESET OR COMMAND: frame: " + Time.frameCount + "; last reset: " + lastResetFrame + "; last command: " + lastCommandFrame); + } } else { //Debug.Log(gameObject.name + ": CharacterMotor.FixedUpdate(): DOING NOTHING location: " + transform.position + "; targetLocation: " + target.transform.position + "; destinationPosition: " + destinationPosition + "; characterUnit.MyAgent.destination: " + characterUnit.MyAgent.destination + "; pathpending: " + characterUnit.MyAgent.pathPending + "; destination distance vector: " + Vector3.Distance(CorrectedNavmeshPosition(target.transform.position), destinationPosition) + "; actualdistancevector: " + Vector3.Distance(transform.position, target.transform.position)); } @@ -262,7 +241,7 @@ public void UnFreezeCharacter() { // move toward the position at a normal speed public Vector3 MoveToPoint(Vector3 point) { - //Debug.Log(gameObject.name + "CharacterMotor.MoveToPoint(" + point + "). current location: " + transform.position); + //Debug.Log(gameObject.name + "CharacterMotor.MoveToPoint(" + point + "). current location: " + transform.position + "; frame: " + Time.frameCount); if (frozen) { return Vector3.zero; } @@ -275,7 +254,7 @@ public Vector3 MoveToPoint(Vector3 point) { // moving to a point only happens when we click on the ground. Since we are not tracking a moving target, we can let the agent update the rotation characterUnit.MyAgent.updateRotation = true; //Debug.Log(gameObject.name + ".CharacterMotor.MoveToPoint(" + point + "): calling characterUnit.MyAgent.ResetPath()"); - characterUnit.MyAgent.ResetPath(); + ResetPath(); destinationPosition = CorrectedNavmeshPosition(point); // set to false for test moveToDestination = false; @@ -304,9 +283,10 @@ public void Move(Vector3 moveDirection) { return; } if (characterUnit.MyAgent.enabled) { + Debug.Log(gameObject.name + ".CharacterMotor.Move(" + moveDirection + "). current position: " + transform.position); //agent.Move(moveDirection); - characterUnit.MyAgent.ResetPath(); + ResetPath(); characterUnit.MyAgent.updateRotation = false; characterUnit.MyAgent.velocity = moveDirection; } else { @@ -347,7 +327,8 @@ public void RotateToward(Vector3 rotateDirection) { } if (characterUnit.MyAgent.enabled) { //Debug.Log("nav mesh agent is enabled"); - characterUnit.MyAgent.ResetPath(); + Debug.Log(gameObject.name + ".CharacterMotor.RotateToward(): " + rotateDirection); + ResetPath(); characterUnit.MyAgent.updateRotation = true; characterUnit.MyAgent.velocity = rotateDirection; } else { @@ -397,6 +378,7 @@ public void StopFollowingTarget() { return; } if (characterUnit.MyAgent.isActiveAndEnabled) { + //Debug.Log(gameObject.name + ".CharacterMotor.StopFollowingTarget()"); characterUnit.MyAgent.stoppingDistance = 0.2f; characterUnit.MyAgent.updateRotation = true; target = null; @@ -432,10 +414,12 @@ public void StopNavAgent() { } public void ResetPath() { - //Debug.Log(gameObject.name + ".CharacterMotor.ResetPath()"); + //Debug.Log(gameObject.name + ".CharacterMotor.ResetPath() in frame: " + Time.frameCount); if (characterUnit.MyAgent.enabled == true) { //Debug.Log(gameObject.name + ".CharacterMotor.FixedUpdate(): navhaspath: " + characterUnit.MyAgent.hasPath + "; isOnNavMesh: " + characterUnit.MyAgent.isOnNavMesh + "; pathpending: " + characterUnit.MyAgent.pathPending); characterUnit.MyAgent.ResetPath(); + lastResetFrame = Time.frameCount; + //Debug.Log(gameObject.name + ": CharacterMotor.FixedUpdate(): AFTER RESETPATH: current location: " + transform.position + "; NavMeshAgentDestination: " + characterUnit.MyAgent.destination + "; destinationPosition: " + destinationPosition + "; frame: " + Time.frameCount + "; last reset: " + lastResetFrame + "; pathpending: " + characterUnit.MyAgent.pathPending + "; pathstatus: " + characterUnit.MyAgent.pathStatus + "; hasPath: " + characterUnit.MyAgent.hasPath); //Debug.Log(gameObject.name + ".CharacterMotor.FixedUpdate(): after reset: navhaspath: " + characterUnit.MyAgent.hasPath + "; isOnNavMesh: " + characterUnit.MyAgent.isOnNavMesh + "; pathpending: " + characterUnit.MyAgent.pathPending); } } diff --git a/Characters/BaseClasses/CharacterStats.cs b/Characters/BaseClasses/CharacterStats.cs index a7c1d1e7c..c1da1e53b 100644 --- a/Characters/BaseClasses/CharacterStats.cs +++ b/Characters/BaseClasses/CharacterStats.cs @@ -54,7 +54,8 @@ public class CharacterStats : MonoBehaviour, ICharacterStats { protected bool startHasRun = false; protected bool eventReferencesInitialized = false; - public int MyMeleeDamage { get => MyStrength / 2; } + public int MyBaseMeleeDamage { get => (MyStrength / 2); } + public int MyMeleeDamage { get => MyBaseMeleeDamage + meleeDamageModifiers.GetValue(); } public int MySpellPower { get => MyIntellect / 2; } public int MyArmor { get => armorModifiers.GetValue(); } public int MyBaseStamina { get => stamina; } diff --git a/Characters/BaseClasses/CharacterUnit.cs b/Characters/BaseClasses/CharacterUnit.cs index 2ef892c01..1fc4a1449 100644 --- a/Characters/BaseClasses/CharacterUnit.cs +++ b/Characters/BaseClasses/CharacterUnit.cs @@ -295,8 +295,7 @@ public override string GetDescription() { } } - // TESTING, USE CANINTERACT TO ALLOW ATTACK, BUT GETVALIDOPTIONCOUNT TO SUPPRESS WINDOW - // MORE TESTING, CHARACTER UNIT ALIVE IS ALWAYS VALID AND CURRENT TO ALLOW ATTACKS + // CHARACTER UNIT ALIVE IS ALWAYS VALID AND CURRENT TO ALLOW ATTACKS public override int GetValidOptionCount() { //Debug.Log(gameObject.name + ".CharacterUnit.GetValidOptionCount()"); return (MyCharacter.MyCharacterStats.IsAlive == true ? 1 : 0); diff --git a/Characters/BaseClasses/ICharacterCombat.cs b/Characters/BaseClasses/ICharacterCombat.cs index 7d3f271f8..53d3da49e 100644 --- a/Characters/BaseClasses/ICharacterCombat.cs +++ b/Characters/BaseClasses/ICharacterCombat.cs @@ -29,7 +29,7 @@ public interface ICharacterCombat { void OnKillConfirmed(BaseCharacter sourceCharacter, float creditPercent); void ProcessTakeDamage(int damage, BaseCharacter target, CombatType combatType, CombatMagnitude combatMagnitude, string abilityName); void Start(); - void TakeDamage(int damage, Vector3 sourcePosition, BaseCharacter source, CombatType combatType, CombatMagnitude combatMagnitude, string abilityName); + bool TakeDamage(int damage, Vector3 sourcePosition, BaseCharacter source, CombatType combatType, CombatMagnitude combatMagnitude, string abilityName); void TryToDropCombat(); void ResetAttackCoolDown(); void SetWaitingForAutoAttack(bool newValue); diff --git a/Characters/BaseClasses/ICharacterController.cs b/Characters/BaseClasses/ICharacterController.cs index 2b1590dc9..da6de00d5 100644 --- a/Characters/BaseClasses/ICharacterController.cs +++ b/Characters/BaseClasses/ICharacterController.cs @@ -10,7 +10,8 @@ public interface ICharacterController { float MyMovementSpeed { get; } bool MyUnderControl { get; set; } BaseCharacter MyMasterUnit { get; set; } - + Vector3 MyLastPosition { get; set; } + float MyApparentVelocity { get; set; } void ClearTarget(); bool IsTargetInHitBox(GameObject newTarget); diff --git a/Characters/BaseClasses/LootableCharacter.cs b/Characters/BaseClasses/LootableCharacter.cs index 4c2270c97..6969f3253 100644 --- a/Characters/BaseClasses/LootableCharacter.cs +++ b/Characters/BaseClasses/LootableCharacter.cs @@ -141,7 +141,8 @@ public override bool CanInteract(CharacterUnit source) { public List GetLootableTargets() { Vector3 aoeSpawnCenter = MyCharacterUnit.transform.position; Collider[] colliders = new Collider[0]; - colliders = Physics.OverlapSphere(aoeSpawnCenter, 15f); + int validMask = 1 << LayerMask.NameToLayer("CharacterUnit"); + colliders = Physics.OverlapSphere(aoeSpawnCenter, 15f, validMask); //Debug.Log("AOEEffect.Cast(): Casting OverlapSphere with radius: " + aoeRadius); List validTargets = new List(); foreach (Collider collider in colliders) { diff --git a/Characters/BaseClasses/PlayerUnitMovementController.cs b/Characters/BaseClasses/PlayerUnitMovementController.cs index 0699f6573..e14092c53 100644 --- a/Characters/BaseClasses/PlayerUnitMovementController.cs +++ b/Characters/BaseClasses/PlayerUnitMovementController.cs @@ -229,7 +229,7 @@ void Idle_SuperUpdate() { //Apply friction to slow to a halt. //currentMoveVelocity = Vector3.MoveTowards(currentMoveVelocity, Vector3.zero, groundFriction * superCharacterController.deltaTime); // factor in slightly uneven ground which gravity will cause the unit to slide on even when standing still with position and rotation locked - // TESTING NEW CODE TO DETECT SUPER LOW RIGIDBODY VELOCITY AND FREEZE CHARACTER + // DETECT SUPER LOW RIGIDBODY VELOCITY AND FREEZE CHARACTER if (Mathf.Abs(characterUnit.MyRigidBody.velocity.y) < 0.01 && MaintainingGround() == true) { //if (transform.InverseTransformPoint(downHitInfo.point).magnitude < 0.01) { //Debug.Log("Idle_SuperUpdate(). feet are planted on the ground, not applying downforce"); @@ -486,7 +486,6 @@ private Vector3 LocalMovement() { float usedAngle = 0f; if (normalizedInput.z > 0) { usedAngle = groundAngle; - // TESTING forwardcontactpoints if (!nearFrontObstacle && forwardContactPoints.Count == 0) { // moving forward, use forward angle calculated to get over objects // hopefully this still allows us the correct ground angle when going downhill with no obstacles in front diff --git a/Characters/Player/PlayerAbilityManager.cs b/Characters/Player/PlayerAbilityManager.cs index 9b359af7f..9e63d7313 100644 --- a/Characters/Player/PlayerAbilityManager.cs +++ b/Characters/Player/PlayerAbilityManager.cs @@ -118,7 +118,7 @@ public override void UpdateAbilityList(int newLevel) { public override void PerformAbility(IAbility ability, GameObject target, Vector3 groundTarget) { //Debug.Log(gameObject.name + ".CharacterAbilityManager.PerformAbility(" + ability.MyName + ")"); base.PerformAbility(ability, target, groundTarget); - // TESTING, DON'T DO GCD ON CASTS THAT HAVE TIME BECAUSE THEIR CAST TIME WAS ALREADY A TYPE OF GLOBAL COOLDOWN + // DON'T DO GCD ON CASTS THAT HAVE TIME BECAUSE THEIR CAST TIME WAS ALREADY A TYPE OF GLOBAL COOLDOWN if (ability.MyCanSimultaneousCast == false && ability.MyIgnoreGlobalCoolDown != true && ability.MyAbilityCastingTime == 0f) { InitiateGlobalCooldown(ability); } else { @@ -131,7 +131,7 @@ public override void PerformAbility(IAbility ability, GameObject target, Vector3 public void InitiateGlobalCooldown(IAbility ability) { //Debug.Log(gameObject.name + ".PlayerAbilitymanager.InitiateGlobalCooldown(" + ability.MyName + ")"); if (globalCoolDownCoroutine == null) { - // testing, set global cooldown length to animation length so we don't end up in situation where cast bars look fine, but we can't actually cast + // set global cooldown length to animation length so we don't end up in situation where cast bars look fine, but we can't actually cast float animationTime = 0f; if (ability.MyAnimationClip != null) { animationTime = ability.MyAnimationClip.length; diff --git a/Characters/Player/PlayerCombat.cs b/Characters/Player/PlayerCombat.cs index 4bc704476..2fdbe468a 100644 --- a/Characters/Player/PlayerCombat.cs +++ b/Characters/Player/PlayerCombat.cs @@ -122,15 +122,16 @@ public override bool EnterCombat(BaseCharacter target) { return false; } - public override void TakeDamage(int damage, Vector3 sourcePosition, BaseCharacter source, CombatType combatType, CombatMagnitude combatMagnitude, string abilityName) { + public override bool TakeDamage(int damage, Vector3 sourcePosition, BaseCharacter source, CombatType combatType, CombatMagnitude combatMagnitude, string abilityName) { //Debug.Log("PlayerCombat.TakeDamage(" + damage + ", " + source.name + ")"); // enter combat first because if we die from this hit, we don't want to enter combat when dead EnterCombat(source); - base.TakeDamage(damage, sourcePosition, source, combatType, combatMagnitude, abilityName); - if (onHitAbility == null && SystemConfigurationManager.MyInstance.MyTakeDamageAbility != null) { + // added damageTaken bool to prevent blood effects from showing if you ran out of range of the attack while it was in progress + bool damageTaken = base.TakeDamage(damage, sourcePosition, source, combatType, combatMagnitude, abilityName); + if (onHitAbility == null && SystemConfigurationManager.MyInstance.MyTakeDamageAbility != null && damageTaken) { MyBaseCharacter.MyCharacterAbilityManager.BeginAbility(SystemConfigurationManager.MyInstance.MyTakeDamageAbility, MyBaseCharacter.MyCharacterUnit.gameObject); } - + return damageTaken; } /// @@ -203,7 +204,6 @@ public override bool AttackHit_AnimationEvent() { //Debug.Log(gameObject.name + ".PlayerCombat.AttackHit_AnimationEvent()"); if (onHitAbility == null && SystemConfigurationManager.MyInstance.MyDoWhiteDamageAbility != null && MyBaseCharacter.MyCharacterController.MyTarget != null) { // TESTING, THIS WAS MESSING WITH ABILITIES THAT DONT' NEED A TARGET LIKE GROUND SLAM - OR NOT, ITS JUST FOR THE WHITE HIT...!! - //if (onHitAbility == null && SystemConfigurationManager.MyInstance.MyDoWhiteDamageAbility != null && MyBaseCharacter.MyCharacterController.MyTarget) { //Debug.Log(gameObject.name + ".PlayerCombat.AttackHit_AnimationEvent(): onHitAbility is not null"); MyBaseCharacter.MyCharacterAbilityManager.BeginAbility(SystemConfigurationManager.MyInstance.MyDoWhiteDamageAbility, MyBaseCharacter.MyCharacterController.MyTarget); } diff --git a/Characters/Player/PlayerController.cs b/Characters/Player/PlayerController.cs index 0fdad989f..ac95bd78a 100644 --- a/Characters/Player/PlayerController.cs +++ b/Characters/Player/PlayerController.cs @@ -247,10 +247,8 @@ private void HandleMouseOver() { if (!EventSystem.current.IsPointerOverGameObject() && !mouseOverNamePlate) { if (Physics.Raycast(ray, out mouseOverhit, 100, layerMask)) { - // should we getcomponents in parents instead? that would mean if the mouse went outside the collider, it would still glow Interactable newInteractable = mouseOverhit.collider.GetComponent(); if (newInteractable == null) { - // TESTING, THIS SHOULD HELP WITH MOUSEOVER BODIES LAYING ON THEIR SIDE THAT ARE LOOTABLE newInteractable = mouseOverhit.collider.GetComponentInParent(); } //Debug.Log("We hit " + mouseOverhit.collider.name + " " + mouseOverhit.point + "; old: " + (mouseOverInteractable != null ? mouseOverInteractable.MyName : "null") + "; new: " + (newInteractable != null ? newInteractable.MyName : "null")); @@ -383,7 +381,6 @@ private void GetNextTabTarget(GameObject oldTarget) { TimeSpan timeSinceLastTab = currentTime - lastTabTargetTime; lastTabTargetTime = DateTime.Now; int validMask = 1 << LayerMask.NameToLayer("CharacterUnit"); - //int validMask = LayerMask.NameToLayer("CharacterUnit"); Collider[] hitColliders = Physics.OverlapSphere(baseCharacter.MyCharacterUnit.transform.position, tabTargetMaxDistance, validMask); int i = 0; //Debug.Log("GetNextTabTarget(): collider length: " + hitColliders.Length + "; index: " + tabTargetIndex); @@ -596,7 +593,6 @@ public override void SetTarget(GameObject newTarget) { return; } base.SetTarget(newTarget); - //Debug.Log("TESTING ICHARACTERUNIT FOR INANIMATE UNIT FRAMES"); if (newTarget.GetComponent() != null) { //Debug.Log("PlayerController.SetTarget(): InamePlateUnit is not null"); UIManager.MyInstance.MyFocusUnitFrameController.SetTarget(newTarget); @@ -659,7 +655,7 @@ public IEnumerator _Lock(bool lockMovement, bool lockAction, bool timed, float d } public void HandleDeath(CharacterStats characterStats) { - Debug.Log(gameObject.name + ".PlayerController.HandleDeath()"); + //Debug.Log(gameObject.name + ".PlayerController.HandleDeath()"); Lock(true, true, false, 0.1f, 0f); } diff --git a/Characters/Player/PlayerStats.cs b/Characters/Player/PlayerStats.cs index 87f4b983a..3c49e9439 100644 --- a/Characters/Player/PlayerStats.cs +++ b/Characters/Player/PlayerStats.cs @@ -8,7 +8,7 @@ protected override void Awake() { //Debug.Log(gameObject.name + ".PlayerStats.Awake()"); base.Awake(); baseCharacter = GetComponent() as ICharacter; - // TESTING DO THIS HERE SO WE CAN CATCH EQUIPMENT EVENTS + // DO THIS HERE SO WE CAN CATCH EQUIPMENT EVENTS CreateEventReferences(); } diff --git a/GameManager/EquipmentManager.cs b/GameManager/EquipmentManager.cs index c836e41b3..a1bb586ed 100644 --- a/GameManager/EquipmentManager.cs +++ b/GameManager/EquipmentManager.cs @@ -153,8 +153,6 @@ public void HandleWeaponSlot(Equipment newItem, GameObject playerUnitObject = nu } else { //Debug.Log("We could not find the target bone " + newItem.TargetBone + " when trying to Equip " + newItem.MyName); } - //(PlayerManager.MyInstance.MyCharacter.MyCharacterUnit.MyCharacterAnimator as PlayerAnimator).OnEquipmentChanged(null, newItem); - // testing was that above line why animations weren't set on zone load? if (PlayerManager.MyInstance.MyPlayerUnitSpawned == true && usedObject == PlayerManager.MyInstance.MyPlayerUnitObject) { //Debug.Log("EquipmentManager.HandleWeaponSlot(): Player Unit is spawned and the object we are using as the player unit, go ahead and animate attacks"); (PlayerManager.MyInstance.MyCharacter.MyCharacterUnit.MyCharacterAnimator as PlayerAnimator).OnEquipmentChanged(newItem, null); @@ -168,12 +166,8 @@ public void Equip (Equipment newItem) { //Debug.Log("Instructed to Equip a null item!"); return; } - //Equipment oldItem = Unequip(newItem.equipSlot); - // TESTING, THIS STUFF NEEDS TO BE HANDLED THROUGH CHARACTER PANEL? - //CharacterPanel.MyInstance. if (currentEquipment.ContainsKey(newItem.equipSlot) && currentEquipment[newItem.equipSlot] != null) { currentEquipment[newItem.equipSlot].MyCharacterButton.DequipEquipment(); - //Unequip(newItem.equipSlot); } // for now manually handle exclusive slots @@ -182,8 +176,6 @@ public void Equip (Equipment newItem) { if ((newItem as Weapon).MyWeaponAffinity == AnyRPGWeaponAffinity.Staff || (newItem as Weapon).MyWeaponAffinity == AnyRPGWeaponAffinity.Sword2H || (newItem as Weapon).MyWeaponAffinity == AnyRPGWeaponAffinity.Mace2H) { if (currentEquipment.ContainsKey(EquipmentSlot.OffHand) && currentEquipment[EquipmentSlot.OffHand] != null) { currentEquipment[EquipmentSlot.OffHand].MyCharacterButton.DequipEquipment(); - //Unequip(newItem.equipSlot); - //Unequip(EquipmentSlot.OffHand); } } } @@ -193,8 +185,6 @@ public void Equip (Equipment newItem) { if (currentEquipment.ContainsKey(EquipmentSlot.MainHand) && currentEquipment[EquipmentSlot.MainHand] != null && ((currentEquipment[EquipmentSlot.MainHand] as Weapon).MyWeaponAffinity == AnyRPGWeaponAffinity.Staff || (currentEquipment[EquipmentSlot.MainHand] as Weapon).MyWeaponAffinity == AnyRPGWeaponAffinity.Sword2H || (currentEquipment[EquipmentSlot.MainHand] as Weapon).MyWeaponAffinity == AnyRPGWeaponAffinity.Mace2H)) { if (currentEquipment[EquipmentSlot.MainHand] != null && currentEquipment[EquipmentSlot.MainHand].MyCharacterButton != null) { currentEquipment[EquipmentSlot.MainHand].MyCharacterButton.DequipEquipment(); - //Unequip(newItem.equipSlot); - //Unequip(EquipmentSlot.MainHand); } } } @@ -220,7 +210,7 @@ public Equipment Unequip(EquipmentSlot equipmentSlot, int slotIndex = -1) { Destroy(destroyObject); } Equipment oldItem = currentEquipment[equipmentSlot]; - // TESTING SKIP THIS STUFF IF THE PLAYER UNIT IS NOT SPAWNED BECAUSE WE ARE UNEQUIPPING A PREVIEW UNIT + // SKIP THIS STUFF IF THE PLAYER UNIT IS NOT SPAWNED BECAUSE WE ARE UNEQUIPPING A PREVIEW UNIT if (PlayerManager.MyInstance.MyPlayerUnitSpawned) { if (oldItem.UMARecipe != null && PlayerManager.MyInstance.MyAvatar != null) { // Clear the item from the UMA slot on the UMA character diff --git a/GameManager/InputManager.cs b/GameManager/InputManager.cs index 5967d0eb0..6f35dfe8a 100644 --- a/GameManager/InputManager.cs +++ b/GameManager/InputManager.cs @@ -157,7 +157,7 @@ private void RegisterMouseActions() { if (Input.GetMouseButtonDown(1)) { rightMouseButtonDown = true; rightMouseButtonDownPosition = Input.mousePosition; - // TESTING, IGNORE NAMEPLATES FOR THE PURPOSE OF CAMERA MOVEMENT + // IGNORE NAMEPLATES FOR THE PURPOSE OF CAMERA MOVEMENT if (EventSystem.current.IsPointerOverGameObject() && (NamePlateCanvasController.MyInstance != null ? !NamePlateCanvasController.MyInstance.MouseOverNamePlate() : true)) { rightMouseButtonClickedOverUI = true; } diff --git a/GameManager/InventoryManager.cs b/GameManager/InventoryManager.cs index 47cf65709..601cc6f54 100644 --- a/GameManager/InventoryManager.cs +++ b/GameManager/InventoryManager.cs @@ -67,18 +67,6 @@ public static InventoryManager MyInstance { private int bagCount = 5; private int bankCount = 8; - public int MyEmptySlotCount { - get { - int count = 0; - foreach (BagNode bagNode in bagNodes) { - if (bagNode.MyBag != null) { - count += bagNode.MyBagPanel.MyEmptySlotCount; - } - } - return count; - } - } - public int MyTotalSlotCount { get { int count = 0; @@ -90,7 +78,7 @@ public int MyTotalSlotCount { return count; } } - public int MyFullSlotCount { get => MyTotalSlotCount - MyEmptySlotCount; } + public int MyFullSlotCount { get => MyTotalSlotCount - MyEmptySlotCount(); } public SlotScript FromSlot { get { @@ -151,7 +139,6 @@ public void ClearData() { foreach (BagNode bagNode in bagNodes) { //Debug.Log("InventoryManager.ClearData(): got a bag node"); //bagNode.MyBag = null; - // TESTING if (bagNode.MyIsBankNode == false) { //Debug.Log("Got a bag node, removing!"); RemoveBag(bagNode.MyBag); @@ -164,6 +151,17 @@ public void ClearData() { //MyBagNodes.Clear(); } + public int MyEmptySlotCount(bool bankSlot = false) { + int count = 0; + foreach (BagNode bagNode in bagNodes) { + if (bagNode.MyBag != null && bagNode.MyIsBankNode == bankSlot) { + count += bagNode.MyBagPanel.MyEmptySlotCount; + } + } + return count; + } + + public bool CanAddBag(bool addToBank = false) { int counter = 0; foreach (BagNode bagNode in bagNodes) { @@ -200,7 +198,6 @@ public void LoadEquippedBagData(List equippedBagSaveData) { int counter = 0; foreach (EquippedBagSaveData saveData in equippedBagSaveData) { if (saveData.slotCount > 0) { - // TESTING NEW LOADING CODE TO GET REAL BACKPACK AND NOT HAVE TO WORRY ABOUT IMAGE ISSUES Bag newBag = SystemItemManager.MyInstance.GetNewResource(saveData.MyName) as Bag; if (newBag != null) { AddBag(newBag, MyBagNodes[counter]); @@ -392,7 +389,8 @@ public void RemoveBag(Bag bag) { // destroy the bagpanel gameobject before setting its reference to null bagNode.MyBagWindow.DestroyWindowContents(); - // TESTING SO THAT EMPTY BAR GOES AWAY + + // MAKE EMPTY TITLE BAR GO AWAY bagNode.MyBagWindow.CloseWindow(); @@ -446,11 +444,12 @@ public bool AddItem(Item item, bool addToBank = false) { MessageFeedManager.MyInstance.WriteMessage(item.MyName + " is unique. You can only carry one at a time."); return false; } - if (item.MyStackSize > 0) { + if (item.MyMaximumStackSize > 0) { if (PlaceInStack(item, addToBank)) { return true; } } + //Debug.Log("About to attempt placeInEmpty"); return PlaceInEmpty(item, addToBank); } @@ -487,6 +486,10 @@ private bool PlaceInEmpty(Item item, bool addToBank = false) { } } } + if (MyEmptySlotCount(addToBank) == 0) { + //Debug.Log("No empty slots"); + MessageFeedManager.MyInstance.WriteMessage((addToBank == false ? "Inventory" : "Bank") + " is full!"); + } return false; } @@ -501,6 +504,12 @@ private bool PlaceInStack(Item item, bool addToBank = false) { } } } + // commented below because it may result in 2 full messages being displayed if the last item in the bag is a full stack of the same item type + /* + if (MyEmptySlotCount(addToBank) == 0) { + MessageFeedManager.MyInstance.WriteMessage((addToBank == false ? "Inventory" : "Bank") + " is full!"); + } + */ return false; } diff --git a/GameManager/PlayerManager.cs b/GameManager/PlayerManager.cs index 85a29e7e1..e38f8d4b0 100644 --- a/GameManager/PlayerManager.cs +++ b/GameManager/PlayerManager.cs @@ -266,12 +266,12 @@ public void DespawnPlayerUnit() { } public void HandlePlayerDeath () { - Debug.Log("PlayerManager.KillPlayer()"); + //Debug.Log("PlayerManager.KillPlayer()"); PlayDeathEffect(); } public void RespawnPlayer() { - Debug.Log("PlayerManager.RespawnPlayer()"); + //Debug.Log("PlayerManager.RespawnPlayer()"); DespawnPlayerUnit(); MyCharacter.MyCharacterStats.ReviveRaw(); SpawnPlayerUnit(); @@ -297,7 +297,6 @@ public void SpawnPlayerUnit(Vector3 spawnLocation) { // spawn the player unit //playerUnitObject = Instantiate(currentPlayerUnitPrefab, spawnLocation, Quaternion.LookRotation(Vector3.forward), playerUnitParent.transform); - // TESTING ROTATION FROM SAVE FILE Vector3 spawnRotation = LevelManager.MyInstance.GetSpawnRotation(); //Debug.Log("PlayerManager.SpawnPlayerUnit(): spawning player unit at location: " + playerUnitParent.transform.position + " with rotation: " + spawnRotation); playerUnitObject = Instantiate(currentPlayerUnitPrefab, spawnLocation, Quaternion.LookRotation(spawnRotation), playerUnitParent.transform); diff --git a/GameManager/SaveManager.cs b/GameManager/SaveManager.cs index df0d76a6b..28f3d947e 100644 --- a/GameManager/SaveManager.cs +++ b/GameManager/SaveManager.cs @@ -119,7 +119,6 @@ public AnyRPGSaveData LoadSaveDataFromFile(string fileName) { public AnyRPGSaveData InitializeResourceLists(AnyRPGSaveData anyRPGSaveData, bool overWrite) { //Debug.Log("SaveManager.InitializeResourceLists()"); - // TESTING: COMMENTING IF STATEMENTS TO ENSURE WE DON'T JUST KEEP EXTENDING EXISTING LISTS IF WE SAVE A GAME IN PROGRESS MORE THAN ONCE if (anyRPGSaveData.questSaveData == null || overWrite) { anyRPGSaveData.questSaveData = new List(); } @@ -728,7 +727,7 @@ public void LoadGame(AnyRPGSaveData anyRPGSaveData) { // moved to clearshareddata to have central clearing method //ClearSystemManagedCharacterData(); - // TESTING MOVE HERE SO THE PLAYERSTATS EXISTS TO SUBSCRIBE TO THE EQUIP EVENTS AND INCREASE STATS + // THIS NEEDS TO BE DOWN HERE SO THE PLAYERSTATS EXISTS TO SUBSCRIBE TO THE EQUIP EVENTS AND INCREASE STATS LoadSharedData(anyRPGSaveData); // complex data diff --git a/GameManager/SystemEventManager.cs b/GameManager/SystemEventManager.cs index e612cccb2..fca2590a8 100644 --- a/GameManager/SystemEventManager.cs +++ b/GameManager/SystemEventManager.cs @@ -202,7 +202,7 @@ public void NotifyOnLevelChanged(int newLevel) { public void NotifyOnQuestStatusUpdated() { //Debug.Log("SystemEventManager.NotifyOnQuestStatusUpdated"); if (PlayerManager.MyInstance != null && PlayerManager.MyInstance.MyPlayerUnitSpawned == false) { - // TESTING - STOP STUFF FROM REACTING WHEN PLAYER ISN'T SPAWNED + // STOP STUFF FROM REACTING WHEN PLAYER ISN'T SPAWNED return; } OnQuestStatusUpdated(); diff --git a/Interactables/CutSceneInteractable.cs b/Interactables/CutSceneInteractable.cs index 7b581f9c8..f4711bf07 100644 --- a/Interactables/CutSceneInteractable.cs +++ b/Interactables/CutSceneInteractable.cs @@ -49,7 +49,7 @@ public override bool Interact(CharacterUnit source) { // save character position and stuff here //PopupWindowManager.MyInstance.interactionWindow.CloseWindow(); LevelManager.MyInstance.LoadCutSceneWithDelay(CutSceneName); - // TESTING, CLOSE WINDOWS BEFORE CUTSCENE LOADS TO PREVENT INVALID REFERENCE ON LOAD + // CLOSE WINDOWS BEFORE CUTSCENE LOADS TO PREVENT INVALID REFERENCE ON LOAD PopupWindowManager.MyInstance.interactionWindow.CloseWindow(); PopupWindowManager.MyInstance.questGiverWindow.CloseWindow(); return true; diff --git a/Interactables/GatheringNode.cs b/Interactables/GatheringNode.cs index 0edf16e2b..08be2ba11 100644 --- a/Interactables/GatheringNode.cs +++ b/Interactables/GatheringNode.cs @@ -63,7 +63,7 @@ public override bool Interact(CharacterUnit source) { private IEnumerator StartSpawnCountdown() { //Debug.Log(gameObject.name + ".GatheringNode.StartSpawnCountdown()"); - // TESTING - THIS SHOULD DISABLE MINIMAP ICON WHILE ITEM IS NOT SPAWNED + // DISABLE MINIMAP ICON WHILE ITEM IS NOT SPAWNED HandlePrerequisiteUpdates(); currentTimer = spawnTimer; while (currentTimer > 0) { diff --git a/Interactables/Interactable.cs b/Interactables/Interactable.cs index 5b514e44f..5639c1582 100644 --- a/Interactables/Interactable.cs +++ b/Interactables/Interactable.cs @@ -507,7 +507,6 @@ public void OnMouseHover() { // added pivot so the tooltip doesn't bounce around UIManager.MyInstance.ShowToolTip(new Vector2(0, 1), UIManager.MyInstance.MyMouseOverWindow.transform.position, this); - // testing, switch this to current interactables - valid means it will glow if its spawned, even if there is nothing to interact with if (GetCurrentInteractables(PlayerManager.MyInstance.MyCharacter.MyCharacterUnit).Count == 0) { //if (GetValidInteractables(PlayerManager.MyInstance.MyCharacter.MyCharacterUnit).Count == 0) { //Debug.Log(gameObject.name + ".Interactable.OnMouseEnter(): No valid Interactables. Not glowing."); @@ -531,7 +530,7 @@ public void OnMouseHover() { } - // TESTING: DISABLE UNITY ONMOUSEOVER CODE AND USE OUR OWN RAYCAST INSTEAD SINCE UNITY DOESN'T ALLOW SETTING CULLING MASK ON MOUSE :( ... + // DISABLE UNITY ONMOUSEOVER CODE AND USE OUR OWN RAYCAST INSTEAD SINCE UNITY DOESN'T ALLOW SETTING CULLING MASK ON MOUSE :( ... /* public void OnMouseEnter() { @@ -601,15 +600,6 @@ public void OnTriggerEnter(Collider other) { } } - /* - TESTING SINCE THIS GOES IN LEVELUNLOADHANDLER ANYWAY - - public void OnDestroy() { - //Debug.Log(gameObject.name + ".Interactable.OnDestroy()"); - CleanupEverything(); - } - */ - public void ClearFromPlayerRangeTable() { //Debug.Log(gameObject.name + ".Interactable.ClearFromPlayerRangeTable()"); // prevent bugs if a unit despawns before the player moves out of range of it diff --git a/Interactables/InteractableOption.cs b/Interactables/InteractableOption.cs index 50e06442a..1271fc834 100644 --- a/Interactables/InteractableOption.cs +++ b/Interactables/InteractableOption.cs @@ -84,7 +84,6 @@ public virtual bool CanInteract(CharacterUnit source) { public virtual bool Interact(CharacterUnit source) { //Debug.Log(gameObject.name + ".InteractableOption.Interact()"); - // TESTING, ALLOW BASE TO SEND OUT SUCCESSFUL INTERACTION NOTIFICATIONS - MAYBE JUST FORCE CHARACTER TO INTERACT INSTEAD OF DIRECTLY INTERACTING TO AVOID HAVING AN INTERACTABLE SET AND NOT NULL IN PLAYERCONTROLLER SystemEventManager.MyInstance.NotifyOnInteractionWithOptionStarted(this); return true; } @@ -131,7 +130,6 @@ public virtual string GetSummary() { } public virtual void OnDisable () { - // TESTING CleanupEventReferences(); } diff --git a/Inventory/SlotScript.cs b/Inventory/SlotScript.cs index 548011e11..81b275329 100644 --- a/Inventory/SlotScript.cs +++ b/Inventory/SlotScript.cs @@ -34,7 +34,7 @@ public bool IsEmpty { public bool IsFull { get { - if (IsEmpty || MyCount < MyItem.MyStackSize) { + if (IsEmpty || MyCount < MyItem.MyMaximumStackSize) { return false; } return true; @@ -195,7 +195,7 @@ public void HandleLeftClick() { //Debug.Log("SlotScript.HandleLeftClick(): We are trying to drop a bag into the inventory."); // the handscript had a bag in it, and therefore we are trying to unequip a bag Bag bag = (Bag)HandScript.MyInstance.MyMoveable; - if (bag.MyBagPanel != MyBag && InventoryManager.MyInstance.MyEmptySlotCount - bag.MySlots > 0) { + if (bag.MyBagPanel != MyBag && InventoryManager.MyInstance.MyEmptySlotCount() - bag.MySlots > 0) { //Debug.Log("SlotScript.HandleLeftClick(): We are trying to drop a bag into the inventory. There is enough empty space."); AddItem(bag); InventoryManager.MyInstance.RemoveBag(bag); @@ -290,7 +290,7 @@ public void UseItem() { } public bool StackItem(Item item) { - if (!IsEmpty && item.MyName == MyItem.MyName && MyItems.Count < MyItem.MyStackSize) { + if (!IsEmpty && item.MyName == MyItem.MyName && MyItems.Count < MyItem.MyMaximumStackSize) { MyItems.Add(item); UpdateSlot(); item.MySlot = this; @@ -328,7 +328,7 @@ private bool MergeItems(SlotScript from) { } if (SystemResourceManager.MatchResource(from.MyItem.MyName, MyItem.MyName) && !IsFull) { // how many free slots there are in the new stack - int free = MyItem.MyStackSize - MyCount; + int free = MyItem.MyMaximumStackSize - MyCount; if (free >= from.MyCount) { for (int i = 0; i < free; i++) { AddItem(from.MyItems[0]); diff --git a/Items/Equipment.cs b/Items/Equipment.cs index 3ee333cb4..920ef8b8e 100644 --- a/Items/Equipment.cs +++ b/Items/Equipment.cs @@ -90,6 +90,9 @@ public override string GetSummary() { if (armorModifier > 0) { abilitiesList.Add(string.Format(" +{0} Armor", armorModifier)); } + if (damageModifier > 0) { + abilitiesList.Add(string.Format(" +{0} Damage", damageModifier)); + } if (staminaModifier > 0) { abilitiesList.Add(string.Format(" +{0} Stamina", staminaModifier)); } @@ -102,6 +105,7 @@ public override string GetSummary() { if (agilityModifier > 0) { abilitiesList.Add(string.Format(" +{0} Agility", agilityModifier)); } + if (onEquipAbility != null) { abilitiesList.Add(string.Format("Cast On Equip: {0}", onEquipAbility.MyName)); } diff --git a/Items/Item.cs b/Items/Item.cs index c59b48e99..0863540b8 100644 --- a/Items/Item.cs +++ b/Items/Item.cs @@ -35,7 +35,7 @@ public class Item : DescribableResource, IMoveable { [SerializeField] private int price; - public int MyStackSize { get => stackSize; set => stackSize = value; } + public int MyMaximumStackSize { get => stackSize; set => stackSize = value; } public SlotScript MySlot { get => slot; set => slot = value; } public Quality MyQuality { get => quality; } public int MyPrice { get => price; set => price = value; } diff --git a/Items/Weapon.cs b/Items/Weapon.cs index f58b35497..31b75f9c8 100644 --- a/Items/Weapon.cs +++ b/Items/Weapon.cs @@ -39,10 +39,11 @@ public override string GetSummary() { if (onHitAbility != null ) { abilitiesList.Add(string.Format("Cast On Hit: {0}", onHitAbility.MyName)); } - if (abilitiesList.Count != 0) { - return base.GetSummary() + "\n" + string.Join("", abilitiesList); - } else { - return base.GetSummary(); + string abilitiesString = string.Empty; + if (abilitiesList.Count > 0) { + abilitiesString = "\n" + string.Join("\n", abilitiesList); } + return base.GetSummary() + abilitiesString; } + } diff --git a/Quest/Quest.cs b/Quest/Quest.cs index 3050ba404..90488e1f0 100644 --- a/Quest/Quest.cs +++ b/Quest/Quest.cs @@ -243,7 +243,6 @@ public void CheckMarkComplete(bool notifyOnUpdate = true, bool printMessages = t } PlayerManager.MyInstance.PlayLevelUpEffects(0); - // testing adding markedComplete and turnedIn to see if this makes achievements save and load properly markedComplete = true; turnedIn = true; } else { diff --git a/Quest/QuestNode.cs b/Quest/QuestNode.cs index db1e734e8..f8c26d39f 100644 --- a/Quest/QuestNode.cs +++ b/Quest/QuestNode.cs @@ -21,9 +21,4 @@ public class QuestNode { public Quest MyQuest { get => questTemplate; set => questTemplate = value; } public GameObject MyGameObject { get => questObject; set => questObject = value; } - // TESTING - /* - public void Awake() { - } - */ } diff --git a/UI/Buttons/ActionButton.cs b/UI/Buttons/ActionButton.cs index 3b72cd129..3cc75f652 100644 --- a/UI/Buttons/ActionButton.cs +++ b/UI/Buttons/ActionButton.cs @@ -112,7 +112,7 @@ public void OnPointerClick(PointerEventData eventData) { // no matter whether we sent our useable over or not, we can now clear our useable and set whatever is in the handscript ClearUseable(); SetUseable(HandScript.MyInstance.MyMoveable as IUseable); - // TESTING - seems to work + HandScript.MyInstance.Drop(); } } @@ -155,9 +155,6 @@ public void SetUseable(IUseable useable) { UIManager.MyInstance.RefreshTooltip(useable as IDescribable); initialized = true; - // TESTING - //HandScript.MyInstance.Drop(); - } public void OnUseableUse(IAbility ability) { @@ -276,18 +273,7 @@ public void EnableFullCoolDownIcon() { } public void UpdateItemCount(Item item) { - // this code will be run for every actionbutton on the screen because we could have this item in more than one slot so we have to update all their counts - /* - if (item is IUseable && MyUseable != null) { - if (SystemResourceManager.MatchResource(MyUseable.MyName, item.MyName)) { - Debug.Log("we are updating an item count and were passed item: " + item.GetInstanceID().ToString()); - int count = InventoryManager.MyInstance.GetUseableCount(item as IUseable); - MyUseable = InventoryManager.MyInstance.GetUseable(item as IUseable); - UIManager.MyInstance.UpdateStackSize(this, count, true); - } - } - */ - // testing, that code above is basically duplicated in updatevisual but it does far more checking + if (item is IUseable) { UpdateVisual(); } diff --git a/UI/Buttons/CharacterButton.cs b/UI/Buttons/CharacterButton.cs index a675e4d9e..99e804b1c 100644 --- a/UI/Buttons/CharacterButton.cs +++ b/UI/Buttons/CharacterButton.cs @@ -141,13 +141,12 @@ public void UpdateVisual(bool resetDisplay = true) { icon.enabled = false; } - // TESTING - ANY EQUIPMENT CHANGE SHOULD UPDATE THE TEXT DISPLAY AND CHARACTER PREVIEW WINDOWS if (PlayerManager.MyInstance.MyPlayerUnitSpawned == false) { - // hopefully prevent unnecessary actions when player is not spawned + // prevent unnecessary actions when player is not spawned return; } if (PopupWindowManager.MyInstance.characterPanelWindow.IsOpen == false) { - // hopefully prevent unnecessary actions when window is not open + // prevent unnecessary actions when window is not open return; } if (resetDisplay) { diff --git a/UI/Buttons/VendorButton.cs b/UI/Buttons/VendorButton.cs index 13154d412..3be20fe92 100644 --- a/UI/Buttons/VendorButton.cs +++ b/UI/Buttons/VendorButton.cs @@ -18,6 +18,9 @@ public class VendorButton : TransparencyButton, IPointerEnterHandler, IPointerEx [SerializeField] private Text descriptionText; + [SerializeField] + private Outline qualityColorOutline; + [SerializeField] private Text quantity; @@ -31,7 +34,14 @@ public void AddItem(VendorItem vendorItem) { if (vendorItem.MyQuantity > 0 || vendorItem.Unlimited) { icon.sprite = vendorItem.MyItem.MyIcon; - title.text = string.Format("{1}", QualityColor.MyColors[vendorItem.MyItem.MyQuality], vendorItem.MyItem.MyName); + //title.text = string.Format("{1}", QualityColor.MyColors[vendorItem.MyItem.MyQuality], vendorItem.MyItem.MyName); + title.text = string.Format("{0}", vendorItem.MyItem.MyName); + + Color newColor = Color.white; + if (ColorUtility.TryParseHtmlString(QualityColor.MyColors[vendorItem.MyItem.MyQuality], out newColor)) { + qualityColorOutline.effectColor = newColor; + } + if (!vendorItem.Unlimited) { quantity.text = vendorItem.MyQuantity.ToString(); } else { diff --git a/UI/Buttons/VendorButton.prefab b/UI/Buttons/VendorButton.prefab index 249de6ddd..0c18085c5 100644 --- a/UI/Buttons/VendorButton.prefab +++ b/UI/Buttons/VendorButton.prefab @@ -37,7 +37,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} - m_AnchoredPosition: {x: 76, y: 0} + m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 0, y: 0} m_Pivot: {x: 0.5, y: 0.5} --- !u!222 &3086834351012971506 @@ -317,6 +317,7 @@ MonoBehaviour: title: {fileID: 3881708514823031310} price: {fileID: 3881708513257922897} descriptionText: {fileID: 8811690366828371320} + qualityColorOutline: {fileID: 4966958950922670107} quantity: {fileID: 3881708512920861674} currencyIcon: {fileID: 3283193668304829338} --- !u!114 &3881708512996398462 @@ -510,7 +511,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} - m_AnchoredPosition: {x: 18, y: 0} + m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 0, y: 0} m_Pivot: {x: 0.5, y: 0.5} --- !u!222 &3881708513315095357 @@ -832,6 +833,8 @@ GameObject: - component: {fileID: 3881708514823031310} - component: {fileID: 2270939658353148746} - component: {fileID: 3559987953651957713} + - component: {fileID: 4966958950922670107} + - component: {fileID: 7349701478515030995} m_Layer: 5 m_Name: Name m_TagString: Untagged @@ -855,8 +858,8 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} - m_AnchoredPosition: {x: 98.5, y: 0} - m_SizeDelta: {x: 187, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} m_Pivot: {x: 0.5, y: 0.5} --- !u!222 &3881708514823031345 CanvasRenderer: @@ -929,6 +932,36 @@ MonoBehaviour: m_EditorClassIdentifier: m_HorizontalFit: 0 m_VerticalFit: 2 +--- !u!114 &4966958950922670107 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3881708514823031308} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: -900027084, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_EffectColor: {r: 1, g: 1, b: 1, a: 0.23921569} + m_EffectDistance: {x: 1, y: -1} + m_UseGraphicAlpha: 1 +--- !u!114 &7349701478515030995 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3881708514823031308} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: -900027084, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_EffectColor: {r: 0, g: 0, b: 0, a: 1} + m_EffectDistance: {x: 2, y: -2} + m_UseGraphicAlpha: 1 --- !u!1 &7637392781365042336 GameObject: m_ObjectHideFlags: 0 @@ -965,8 +998,8 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} - m_AnchoredPosition: {x: 98.5, y: 0} - m_SizeDelta: {x: 187, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} m_Pivot: {x: 0.5, y: 0.5} --- !u!222 &1803819922858294132 CanvasRenderer: diff --git a/UI/CloseableWindows/CharacterCreatorPanel.cs b/UI/CloseableWindows/CharacterCreatorPanel.cs index cc2209ee2..c91b9f09f 100644 --- a/UI/CloseableWindows/CharacterCreatorPanel.cs +++ b/UI/CloseableWindows/CharacterCreatorPanel.cs @@ -122,7 +122,7 @@ public override void OnCloseWindow() { previewCameraController.ClearTarget(); CharacterCreatorManager.MyInstance.HandleCloseWindow(); OnCloseWindowHandler(this); - // testing, close interaction window too for smoother experience + // close interaction window too for smoother experience PopupWindowManager.MyInstance.interactionWindow.CloseWindow(); } diff --git a/UI/CloseableWindows/CharacterPanel.cs b/UI/CloseableWindows/CharacterPanel.cs index c20cd289f..0375eb281 100644 --- a/UI/CloseableWindows/CharacterPanel.cs +++ b/UI/CloseableWindows/CharacterPanel.cs @@ -235,7 +235,11 @@ public void UpdateStatsDescription() { updateString += "Health: " + PlayerManager.MyInstance.MyCharacter.MyCharacterStats.currentHealth + " / " + PlayerManager.MyInstance.MyCharacter.MyCharacterStats.MyMaxHealth + "\n"; updateString += "Mana: " + PlayerManager.MyInstance.MyCharacter.MyCharacterStats.currentMana + " / " + PlayerManager.MyInstance.MyCharacter.MyCharacterStats.MyMaxMana + "\n\n"; updateString += "Amor: " + PlayerManager.MyInstance.MyCharacter.MyCharacterStats.MyArmor + "\n"; - updateString += "Damage: " + PlayerManager.MyInstance.MyCharacter.MyCharacterStats.MyMeleeDamage + "\n"; + updateString += "Damage: " + PlayerManager.MyInstance.MyCharacter.MyCharacterStats.MyMeleeDamage; + if (PlayerManager.MyInstance.MyCharacter.MyCharacterStats.MyMeleeDamage != PlayerManager.MyInstance.MyCharacter.MyCharacterStats.MyBaseMeleeDamage) { + updateString += " ( " + PlayerManager.MyInstance.MyCharacter.MyCharacterStats.MyBaseMeleeDamage + " + " + (PlayerManager.MyInstance.MyCharacter.MyCharacterStats.MyMeleeDamage - PlayerManager.MyInstance.MyCharacter.MyCharacterStats.MyBaseMeleeDamage) + " )"; + } + updateString += "\n"; updateString += "SpellPower: " + PlayerManager.MyInstance.MyCharacter.MyCharacterStats.MySpellPower + "\n\n"; updateString += "Movement Speed: " + Mathf.Clamp(PlayerManager.MyInstance.MyCharacter.MyCharacterStats.MyMovementSpeed, 0, PlayerManager.MyInstance.MyMaxMovementSpeed) + " (m/s)\n\n"; @@ -292,7 +296,7 @@ public void TargetReadyCallbackCommon(bool updateCharacterButton = true) { SaveManager.MyInstance.LoadUMASettings(umaAvatar); EquipmentManager.MyInstance.EquipCharacter(CharacterCreatorManager.MyInstance.MyPreviewUnit, updateCharacterButton); - // TESTING SEE WEAPONS AND ARMOR IN PLAYER PREVIEW SCRENE + // SEE WEAPONS AND ARMOR IN PLAYER PREVIEW SCREEN CharacterCreatorManager.MyInstance.MyPreviewUnit.layer = 12; foreach (Transform childTransform in CharacterCreatorManager.MyInstance.MyPreviewUnit.GetComponentsInChildren(true)) { childTransform.gameObject.layer = 12; diff --git a/UI/CloseableWindows/CloseableWindow.cs b/UI/CloseableWindows/CloseableWindow.cs index 2e1f0edf6..f5bdae9b5 100644 --- a/UI/CloseableWindows/CloseableWindow.cs +++ b/UI/CloseableWindows/CloseableWindow.cs @@ -115,7 +115,7 @@ public virtual void OpenWindow() { //Debug.Log(gameObject.name + ".CloseableWindow.OpenWindow(): + windowContents was null!"); } - // TESTING - MOVED TO HERE SO WINDOWS THAT NEED TO AUTO-CLOSE THEMSELVES ON OPEN IN THE OPEN WINDOW HANDLER DON'T END UP JUST RE-ENABLING THEMSELVES WITH THE ABOVE CODE AFTER THE CLOSE FUNCTION IS RUN + // THIS MUST BE HERE SO WINDOWS THAT NEED TO AUTO-CLOSE THEMSELVES ON OPEN IN THE OPEN WINDOW HANDLER DON'T END UP JUST RE-ENABLING THEMSELVES WITH THE ABOVE CODE AFTER THE CLOSE FUNCTION IS RUN if (windowContents != null) { //Debug.Log(gameObject.name + ".CloseableWindow.OpenWindow(): window contents was not null, calling openwindow"); windowContents.OnOpenWindow(); diff --git a/UI/CloseableWindows/CraftingUI.cs b/UI/CloseableWindows/CraftingUI.cs index ff2e645a8..db56f3c0d 100644 --- a/UI/CloseableWindows/CraftingUI.cs +++ b/UI/CloseableWindows/CraftingUI.cs @@ -91,11 +91,11 @@ private void Start() { public void DeactivateButtons() { Button craftButtonComponent = craftButton.GetComponent