mirror of
https://github.com/Leahnaya/TheKingsRace.git
synced 2026-04-16 13:56:01 -05:00
>Radial Menu has been bugfixed so the players have a harder time breaking things >King abilities have had some repeated code moved into a seperate class
54 lines
1.1 KiB
C#
54 lines
1.1 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class KingAbility
|
|
{
|
|
|
|
public int CooldownTimer;
|
|
private int CooldownLength;
|
|
private int FramestoSeconds = 0;
|
|
private bool Avaliable = true;
|
|
|
|
private int EnergyCost;
|
|
|
|
public KingAbility() {
|
|
CooldownLength = 3;
|
|
CooldownTimer = CooldownLength;
|
|
EnergyCost = 20;
|
|
}
|
|
|
|
public KingAbility(int cooldown, int energy) {
|
|
CooldownLength = cooldown;
|
|
CooldownTimer = CooldownLength;
|
|
EnergyCost = energy;
|
|
}
|
|
|
|
public void Cooldown() {
|
|
if (Avaliable == false) {
|
|
FramestoSeconds++;
|
|
if (FramestoSeconds == 50) {
|
|
FramestoSeconds = 0;
|
|
CooldownTimer--;
|
|
if (CooldownTimer == 0) {
|
|
CooldownTimer = CooldownLength;
|
|
Avaliable = true;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
public void UseItem() {
|
|
Avaliable = false;
|
|
}
|
|
|
|
public bool IsAvaliable() {
|
|
return Avaliable;
|
|
}
|
|
|
|
public int Energy() {
|
|
return EnergyCost;
|
|
}
|
|
|
|
}
|