basically the whole game
This commit is contained in:
parent
949135cecb
commit
96dcfa9064
315 changed files with 34386 additions and 396 deletions
|
|
@ -16,6 +16,8 @@ public class ReisenShoot : Ability
|
|||
[SerializeField] private float maxChargeTime;
|
||||
[SerializeField] private float chargeCooldown;
|
||||
private float currentChargeCooldown;
|
||||
[Header("Effects")]
|
||||
[SerializeField] private Transform chargeMeter;
|
||||
protected override void AbilityEffects()
|
||||
{
|
||||
if (currentChargeCooldown > 0)
|
||||
|
|
@ -24,17 +26,20 @@ public class ReisenShoot : Ability
|
|||
}
|
||||
else
|
||||
{
|
||||
isCharging = true;
|
||||
currentMouseHoldTime = mouseHoldTime;
|
||||
}
|
||||
}
|
||||
|
||||
private void ShootBullet(Projectile projectileToShoot, int damage)
|
||||
{
|
||||
WaveManager.instance.audioSource.PlayOneShot(projectileToShoot.projectileShootSFX, projectileToShoot.volume);
|
||||
direction = cam.ScreenToWorldPoint(Input.mousePosition);
|
||||
Projectile newProjectile = Instantiate(projectileToShoot, origin.position, Quaternion.identity);
|
||||
newProjectile.transform.Lookat2D(direction);
|
||||
newProjectile.damage = damage;
|
||||
newProjectile.tag = tag;
|
||||
newProjectile.playerBullet = true;
|
||||
GameManager.instance.projectilesShot++; //i shouldn't be directly modifying the variable but i don't actually care
|
||||
}
|
||||
|
||||
protected override void Update()
|
||||
|
|
@ -43,8 +48,9 @@ public class ReisenShoot : Ability
|
|||
if (currentMouseHoldTime >= 0)
|
||||
{
|
||||
currentMouseHoldTime -= Time.deltaTime;
|
||||
if (currentMouseHoldTime <= 0 && Input.GetMouseButton(1) && currentChargeTime <= 0)
|
||||
if (currentMouseHoldTime <= 0 && Input.GetMouseButton(0) && currentChargeTime <= 0)
|
||||
{
|
||||
currentChargeTime += mouseHoldTime;
|
||||
isCharging = true;
|
||||
}
|
||||
else if (Input.GetMouseButtonUp(0))
|
||||
|
|
@ -55,12 +61,13 @@ public class ReisenShoot : Ability
|
|||
if (isCharging && Input.GetMouseButton(0)) //this code REEKS
|
||||
{
|
||||
currentChargeTime += Time.deltaTime;
|
||||
chargeMeter.localScale = new Vector3(Math.Clamp(currentChargeTime, 0, maxChargeTime)/maxChargeTime, 1f, 1f);
|
||||
}
|
||||
else if (isCharging && Input.GetMouseButtonUp(0))
|
||||
else if (currentChargeTime > 0 && isCharging && Input.GetMouseButtonUp(0))
|
||||
{
|
||||
Debug.Log("here");
|
||||
currentChargeTime = 0;
|
||||
ShootBullet(chargedProjectile, power * (int)Math.Clamp(currentChargeTime, 0, maxChargeTime));
|
||||
currentChargeTime = 0;
|
||||
chargeMeter.localScale = new Vector3(0f, 1f, 1f);
|
||||
currentChargeCooldown = chargeCooldown;
|
||||
isCharging = false;
|
||||
}
|
||||
|
|
@ -69,6 +76,6 @@ public class ReisenShoot : Ability
|
|||
{
|
||||
currentChargeCooldown -= Time.deltaTime;
|
||||
}
|
||||
Debug.Log(currentChargeTime);
|
||||
//Debug.Log(currentChargeTime);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue