- Necromancer class playable - Savage minion ability & npc - Mage minion ability & npc - rogue minion ability & npc - warrior minion ability & npc - golem minion ability & npc - minion abilities - Class resource (used to automatically summon minions based on the amount of souls drained, in case of necromancer) - class resource spender (auto cast from priority list) - class resource regen instant effect option
43 lines
1.3 KiB
C#
43 lines
1.3 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class ClassResourceSpender : MonoBehaviour
|
|
{
|
|
RiftPlayer player;
|
|
Taggable playerTag;
|
|
ClassResource classResource;
|
|
ClassAbilityPriorityManager abilityPriorityManager;
|
|
AbilityCooldownTracker abilityCooldownTracker;
|
|
|
|
|
|
|
|
private void Awake()
|
|
{
|
|
player = GetComponentInParent<RiftPlayer>();
|
|
abilityPriorityManager = player.GetComponentInChildren<ClassAbilityPriorityManager>();
|
|
abilityCooldownTracker = player.GetComponentInChildren<AbilityCooldownTracker>();
|
|
playerTag = player.GetComponent<Taggable>();
|
|
classResource = player.GetComponent<ClassResource>();
|
|
|
|
classResource.onResourceChanged.AddListener(OnClassResourceValueChanged);
|
|
}
|
|
|
|
public void OnClassResourceValueChanged(float value)
|
|
{
|
|
BaseAbility autocastAbility = abilityPriorityManager.GetHighestPriorityAvailableAbility();
|
|
|
|
|
|
if (autocastAbility == null)
|
|
{
|
|
Debug.Log("No abilities available for current conditional state");
|
|
return;
|
|
}
|
|
|
|
autocastAbility.Execute(player.photonView, playerTag);
|
|
|
|
if (autocastAbility.cooldown > 0)
|
|
abilityCooldownTracker.StartAbilityCooldown(autocastAbility);
|
|
}
|
|
}
|