cool title screen

This commit is contained in:
Sylvia 2026-06-27 04:59:03 -07:00
parent b0625ae834
commit 949135cecb
33 changed files with 4977 additions and 7 deletions

View file

@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Unity.Mathematics;
using UnityEngine;
using Random = UnityEngine.Random;
@ -10,17 +11,47 @@ public class YoumuDeflect : Ability
public float deflectionAngleMin = -48;
public float deflectionAngleMax = 90;
[Header("SlashCharge")]
[SerializeField] private float mouseHoldTime;
private float currentMouseHoldTime;
private float currentChargeTime;
private bool isCharging;
[SerializeField] private float maxChargeTime;
[SerializeField] private float chargeCooldown;
private float currentChargeCooldown;
private float currentUnleashedChargeTime;
[Header("Effects")]
[SerializeField] private ParticleSystem deflectionParticles;
[SerializeField] private GameObject swordSweepEffect;
[SerializeField] private GameObject chargeSweepEffect;
private float currentDissipationTime = 0f;
[SerializeField] private float dissipationTime;
protected override void AbilityEffects()
{
base.AbilityEffects();
if (currentChargeCooldown > 0)
{
RegularDeflection();
}
else
{
currentMouseHoldTime = mouseHoldTime;
currentChargeTime = 0;
}
}
private void RegularDeflection()
{
//Debug.Log("Regular Deflection");
swordSweepEffect.gameObject.SetActive(true);
currentDissipationTime = dissipationTime;
DeflectProjectiles();
}
private void DeflectProjectiles()
{
foreach (Projectile projectile in projectilesInRange.ToList())
{
if (!projectile)
@ -64,5 +95,49 @@ public class YoumuDeflect : Ability
swordSweepEffect.SetActive(false);
}
}
if (currentMouseHoldTime >= 0)
{
currentMouseHoldTime -= Time.deltaTime;
if (currentMouseHoldTime <= 0 && Input.GetMouseButton(1) && currentChargeTime <= 0)
{
isCharging = true;
}
else if (Input.GetMouseButtonUp(1))
{
RegularDeflection();
}
}
if (isCharging && Input.GetMouseButton(1)) //this code REEKS
{
currentChargeTime += Time.deltaTime;
}
else if (isCharging && Input.GetMouseButtonUp(1))
{
Debug.Log("here");
chargeSweepEffect.SetActive(true);
currentUnleashedChargeTime = Math.Clamp(currentChargeTime, 0, maxChargeTime) * 2;
currentChargeCooldown = chargeCooldown;
isCharging = false;
}
else if (currentUnleashedChargeTime > 0)
{
currentUnleashedChargeTime -= Time.deltaTime;
if (currentUnleashedChargeTime < 0)
{
chargeSweepEffect.SetActive(false);
}
if (projectilesInRange.Count > 0)
{
DeflectProjectiles();
}
}
if (currentChargeCooldown > 0)
{
currentChargeCooldown -= Time.deltaTime;
}
Debug.Log(currentChargeTime);
}
}