diff --git a/Assets/Prefabs/Characters/Beasiculus/Bascileus_BaseModel.prefab b/Assets/Prefabs/Characters/Beasiculus/Bascileus_BaseModel.prefab index 393a8217a..973f9883a 100644 --- a/Assets/Prefabs/Characters/Beasiculus/Bascileus_BaseModel.prefab +++ b/Assets/Prefabs/Characters/Beasiculus/Bascileus_BaseModel.prefab @@ -105634,6 +105634,7 @@ MonoBehaviour: matchTarget: {fileID: 0} triggerDieBehaviour: 0 m_ignoreTriggers: 1 + healthRecoveryCap: 1 useAnimationBasedRotation: 0 strafeRollForwardAnim: Roll_Forward strafeRollBackwardAnim: Roll_Backward @@ -106537,6 +106538,7 @@ MonoBehaviour: animClipName: MagicPush m_selectedType: 1 currentSelectedSpellName: + isPlaying: 0 actionInput: useInput: 1 isAxisInUse: 0 @@ -106573,7 +106575,6 @@ MonoBehaviour: OnEndAnimation: m_PersistentCalls: m_Calls: [] - isPlaying: 0 --- !u!114 &2511567495449288316 MonoBehaviour: m_ObjectHideFlags: 0 @@ -108049,10 +108050,11 @@ MonoBehaviour: faithMult: 0 damageMult: 0 speedMult: 0 - staminaMult: 0 attackSpeedMult: 0 faithRegenMult: 0 thornDamageMult: 0 + staminaMult: 0 + soulfireDamageMult: 0 effectBalance: 0 effectCalmness: 0 effectFaithVampirism: 0 @@ -108065,6 +108067,7 @@ MonoBehaviour: effectRose: 0 effectDarkening: 0 effectEclipse: 0 + effectAngelEye: 0 --- !u!114 &8972349826141935600 MonoBehaviour: m_ObjectHideFlags: 0 diff --git a/Assets/Prefabs/Characters/Player/Animator/Invector@MeleeCombat Player PRO2.controller b/Assets/Prefabs/Characters/Player/Animator/Invector@MeleeCombat Player PRO2.controller index 6dde532e0..9c70d4fa3 100644 --- a/Assets/Prefabs/Characters/Player/Animator/Invector@MeleeCombat Player PRO2.controller +++ b/Assets/Prefabs/Characters/Player/Animator/Invector@MeleeCombat Player PRO2.controller @@ -6557,7 +6557,7 @@ AnimatorController: m_Controller: {fileID: 9100000} - m_Name: AttackSpeed m_Type: 1 - m_DefaultFloat: 1 + m_DefaultFloat: 1.5 m_DefaultInt: 0 m_DefaultBool: 0 m_Controller: {fileID: 9100000} diff --git a/Assets/Scripts/Powers/FlaskManager.cs b/Assets/Scripts/Powers/FlaskManager.cs new file mode 100644 index 000000000..fb07e737f --- /dev/null +++ b/Assets/Scripts/Powers/FlaskManager.cs @@ -0,0 +1,183 @@ +using UnityEngine; +using UnityEngine.UI; +using System.Collections; +using Invector.vCharacterController; +// We don't need the Invector vActions namespace here anymore since we use your custom Respawner + +namespace Beyond +{ + public class FlaskManager : MonoBehaviour + { + [Header("Flask Settings")] + [SerializeField] private int maxFlaskCharges = 5; + [SerializeField] private int healAmount = 50; + [SerializeField] private float cooldownTime = 3.0f; + [Tooltip("Time into the animation when the health is actually applied")] + [SerializeField] private float healDelay = 1.0f; + [Tooltip("Total time the player is locked in place")] + [SerializeField] private float totalAnimationDuration = 2.0f; + + [Header("Animation")] + [SerializeField] private string animatorTrigger = "DrinkFlask"; + [Tooltip("Audio clip to play when drinking")] + [SerializeField] private AudioClip drinkSound; + + [Header("UI References")] + [SerializeField] private Button uiButton; + [SerializeField] private Image radialIconImage; + [SerializeField] private Text countText; + + private int currentCharges; + private float lastDrinkTime; + private bool isDrinking; + + // Dependencies + private Player playerRef; + + private void Start() + { + // 1. Get Player Instance + playerRef = Player.Instance; + if (playerRef == null) + { + Debug.LogError("FlaskManager: No Player Instance found!"); + return; + } + + // 2. Initialize charges + ResetFlasks(); + + // 3. Hook into YOUR custom Respawner + // The previous error was looking for Invector.vActions.Respawner + // We now look for Beyond.Respawner + var respawner = playerRef.GetComponent(); + if (respawner != null) + { + respawner.m_onRespawned.AddListener(ResetFlasks); + } + else + { + Debug.LogWarning("FlaskManager: No Beyond.Respawner found on Player. Flasks won't refill on death."); + } + + // 4. Hook up UI Button + if (uiButton) + { + uiButton.onClick.AddListener(AttemptDrinkFlask); + } + } + + private void OnDestroy() + { + if (playerRef != null) + { + var respawner = playerRef.GetComponent(); + if (respawner != null) + { + respawner.m_onRespawned.RemoveListener(ResetFlasks); + } + } + } + + private void Update() + { + UpdateUI(); + + // Optional: Input for drinking (e.g. 'R') + if (Input.GetKeyDown(KeyCode.R)) + { + AttemptDrinkFlask(); + } + } + + public void ResetFlasks() + { + currentCharges = maxFlaskCharges; + lastDrinkTime = -cooldownTime; // Ensure cooldown is ready immediately + isDrinking = false; + UpdateUI(); + } + + public void AttemptDrinkFlask() + { + // Validation + if (isDrinking) return; + if (currentCharges <= 0) + { + playerRef.PlayICantDoThatYet(); + return; + } + + float timeSinceLast = Time.time - lastDrinkTime; + if (timeSinceLast < cooldownTime) return; + + StartCoroutine(DrinkRoutine()); + } + + private IEnumerator DrinkRoutine() + { + isDrinking = true; + lastDrinkTime = Time.time; + + // Lock Input + playerRef.PlayerInput.SetLockAllInput(true); + + // Stop movement + playerRef.ThirdPersonController.input = Vector2.zero; + + // --- UNITY VERSION FIX --- + // If you are on Unity 6 (Preview/Beta), keep 'linearVelocity'. + // If you are on Unity 2022 LTS or older, change 'linearVelocity' to 'velocity'. +#if UNITY_6000_0_OR_NEWER + playerRef.ThirdPersonController._rigidbody.linearVelocity = Vector3.zero; +#else + playerRef.ThirdPersonController._rigidbody.velocity = Vector3.zero; +#endif + + // Trigger Animation + if (playerRef.ThirdPersonController.animator) + { + playerRef.ThirdPersonController.animator.SetTrigger(animatorTrigger); + } + + // Play Sound + if (drinkSound) playerRef.PlaySingleSound(drinkSound); + + // Wait for heal moment + yield return new WaitForSeconds(healDelay); + + // Apply Heal + currentCharges--; + + // Accessing Invector controller health directly + playerRef.ThirdPersonController.ChangeHealth(healAmount); + + // Wait remaining animation time + float remainingTime = totalAnimationDuration - healDelay; + if (remainingTime > 0) yield return new WaitForSeconds(remainingTime); + + // Unlock Input + playerRef.PlayerInput.SetLockAllInput(false); + isDrinking = false; + } + + private void UpdateUI() + { + if (countText) countText.text = currentCharges.ToString(); + + if (radialIconImage) + { + if (currentCharges == 0) + { + radialIconImage.fillAmount = 0; + } + else + { + float timeSinceLast = Time.time - lastDrinkTime; + float pct = Mathf.Clamp01(timeSinceLast / cooldownTime); + radialIconImage.fillAmount = pct; + } + } + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Powers/FlaskManager.cs.meta b/Assets/Scripts/Powers/FlaskManager.cs.meta new file mode 100644 index 000000000..8988d4306 --- /dev/null +++ b/Assets/Scripts/Powers/FlaskManager.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 07df64b7e76c34a9694ba702b7b8f747 \ No newline at end of file