literally half of the game
This commit is contained in:
parent
1590b5faa6
commit
b842289076
77 changed files with 11904 additions and 72 deletions
46
Assets/Scripts/Entity/Abilities/Ability.cs
Normal file
46
Assets/Scripts/Entity/Abilities/Ability.cs
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
using System;
|
||||
using Core.Extensions;
|
||||
using UnityEngine;
|
||||
|
||||
public class Ability : MonoBehaviour
|
||||
{
|
||||
[Header("Flags")]
|
||||
public bool cooldownBlocked;
|
||||
public bool blocked;
|
||||
[Header("Cooldown")]
|
||||
public float cooldown;
|
||||
protected float currentCooldown;
|
||||
[Header("Stats")]
|
||||
public float power;
|
||||
|
||||
public bool TryAbility()
|
||||
{
|
||||
if (!blocked && currentCooldown <= 0)
|
||||
{
|
||||
currentCooldown = cooldown;
|
||||
AbilityEffects();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
protected virtual void AbilityEffects()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (currentCooldown > 0 && !cooldownBlocked)
|
||||
{
|
||||
currentCooldown -= Time.deltaTime;
|
||||
}
|
||||
}
|
||||
|
||||
protected void ShootBullet(Projectile projectile, Vector3 direction)
|
||||
{
|
||||
Projectile newProjectile = Instantiate(projectile, transform.position, Quaternion.identity);
|
||||
newProjectile.transform.Lookat2D(direction);
|
||||
newProjectile.tag = tag; //will have to figure out stats and projectile creation
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue