random stuff i forgot to commit
This commit is contained in:
parent
274af1e5a1
commit
b0625ae834
59 changed files with 7806 additions and 664 deletions
39
Assets/Scripts/Abilities/Ability.cs
Normal file
39
Assets/Scripts/Abilities/Ability.cs
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
public class Ability : MonoBehaviour
|
||||
{
|
||||
[Header("Cooldown")]
|
||||
public float currentCooldown;
|
||||
public float cooldown;
|
||||
[Header("Stats")]
|
||||
public int power;
|
||||
|
||||
[Header("Targetting")]
|
||||
public Transform origin;
|
||||
public Vector3 direction;
|
||||
|
||||
public bool TryAbility()
|
||||
{
|
||||
if (currentCooldown <= 0)
|
||||
{
|
||||
currentCooldown = cooldown;
|
||||
AbilityEffects();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
protected virtual void AbilityEffects()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
protected virtual void Update()
|
||||
{
|
||||
if (currentCooldown >= 0)
|
||||
{
|
||||
currentCooldown -= Time.deltaTime;
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/Abilities/Ability.cs.meta
Normal file
2
Assets/Scripts/Abilities/Ability.cs.meta
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 44b9d09afb8c9b825bf024d2c59ac4bc
|
||||
11
Assets/Scripts/Abilities/EnemyAbility.cs
Normal file
11
Assets/Scripts/Abilities/EnemyAbility.cs
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
using UnityEngine;
|
||||
|
||||
public class EnemyAbility : Ability
|
||||
{
|
||||
[SerializeField] private float cooldownDelta;
|
||||
void Start()
|
||||
{
|
||||
cooldown += Random.Range(-cooldownDelta, cooldownDelta);
|
||||
currentCooldown = Random.Range(0, cooldown);
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/Abilities/EnemyAbility.cs.meta
Normal file
2
Assets/Scripts/Abilities/EnemyAbility.cs.meta
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 9f66fd8bb75c08a0e92e682f4cca0fab
|
||||
19
Assets/Scripts/Abilities/EnemyShootBasic.cs
Normal file
19
Assets/Scripts/Abilities/EnemyShootBasic.cs
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
using System;
|
||||
using Core.Extensions;
|
||||
using UnityEngine;
|
||||
using Random = UnityEngine.Random;
|
||||
|
||||
public class EnemyShootBasic : EnemyAbility
|
||||
{
|
||||
// i think this will just be a debug script since a regular singular bullet attack is kinda boring lol
|
||||
//or atleast i'd need to figure out cool bullet patterns
|
||||
[SerializeField] private Projectile projectile;
|
||||
|
||||
protected override void AbilityEffects()
|
||||
{
|
||||
Projectile newProjectile = Instantiate(projectile, origin.position, Quaternion.identity);
|
||||
newProjectile.transform.Lookat2D(direction);
|
||||
newProjectile.damage = power;
|
||||
newProjectile.tag = tag;
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/Abilities/EnemyShootBasic.cs.meta
Normal file
2
Assets/Scripts/Abilities/EnemyShootBasic.cs.meta
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
fileFormatVersion: 2
|
||||
guid: c2d01df850251ebc4adc091f0274b225
|
||||
17
Assets/Scripts/Abilities/ReisenShoot.cs
Normal file
17
Assets/Scripts/Abilities/ReisenShoot.cs
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
using System;
|
||||
using Core.Extensions;
|
||||
using UnityEngine;
|
||||
|
||||
public class ReisenShoot : Ability
|
||||
{
|
||||
[SerializeField] private Projectile projectile;
|
||||
[SerializeField] private Camera cam;
|
||||
protected override void AbilityEffects()
|
||||
{
|
||||
direction = cam.ScreenToWorldPoint(Input.mousePosition);
|
||||
Projectile newProjectile = Instantiate(projectile, origin.position, Quaternion.identity);
|
||||
newProjectile.transform.Lookat2D(direction);
|
||||
newProjectile.damage = power;
|
||||
newProjectile.tag = tag;
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/Abilities/ReisenShoot.cs.meta
Normal file
2
Assets/Scripts/Abilities/ReisenShoot.cs.meta
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
fileFormatVersion: 2
|
||||
guid: a3b3ef6bc0f1a1f78b2e8af72f1186c1
|
||||
68
Assets/Scripts/Abilities/YoumuDeflect.cs
Normal file
68
Assets/Scripts/Abilities/YoumuDeflect.cs
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
using Random = UnityEngine.Random;
|
||||
|
||||
public class YoumuDeflect : Ability
|
||||
{
|
||||
private List<Projectile> projectilesInRange = new();
|
||||
public float deflectionAngleMin = -48;
|
||||
public float deflectionAngleMax = 90;
|
||||
|
||||
[Header("Effects")]
|
||||
[SerializeField] private ParticleSystem deflectionParticles;
|
||||
[SerializeField] private GameObject swordSweepEffect;
|
||||
private float currentDissipationTime = 0f;
|
||||
[SerializeField] private float dissipationTime;
|
||||
|
||||
protected override void AbilityEffects()
|
||||
{
|
||||
base.AbilityEffects();
|
||||
swordSweepEffect.gameObject.SetActive(true);
|
||||
currentDissipationTime = dissipationTime;
|
||||
foreach (Projectile projectile in projectilesInRange.ToList())
|
||||
{
|
||||
if (!projectile)
|
||||
{
|
||||
projectilesInRange.Remove(projectile);
|
||||
continue;
|
||||
}
|
||||
projectile.transform.eulerAngles = new Vector3(0, 0, Random.Range(deflectionAngleMin, deflectionAngleMax));
|
||||
projectile.direction = projectile.transform.right;
|
||||
projectile.tag = tag;
|
||||
ParticleSystem newParticles = Instantiate(deflectionParticles, projectile.transform);
|
||||
projectilesInRange.Remove(projectile);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void OnTriggerEnter2D(Collider2D other)
|
||||
{
|
||||
if (!other.CompareTag(tag) && other.TryGetComponent(out Projectile isProjectile))
|
||||
{
|
||||
projectilesInRange.Add(isProjectile);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnTriggerExit2D(Collider2D other)
|
||||
{
|
||||
if (!other.CompareTag(tag) && other.TryGetComponent(out Projectile isProjectile) && projectilesInRange.Contains(isProjectile))
|
||||
{
|
||||
projectilesInRange.Add(isProjectile);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void Update()
|
||||
{
|
||||
base.Update();
|
||||
if (currentDissipationTime > 0)
|
||||
{
|
||||
currentDissipationTime -= Time.deltaTime;
|
||||
if (currentDissipationTime <= 0)
|
||||
{
|
||||
swordSweepEffect.SetActive(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/Abilities/YoumuDeflect.cs.meta
Normal file
2
Assets/Scripts/Abilities/YoumuDeflect.cs.meta
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 0fd254066289aba4a8779f6678e0c515
|
||||
Loading…
Add table
Add a link
Reference in a new issue