RiftMayhem/Assets/Scripts/AbilitySystem/ChanneledAbility.cs
2025-02-21 18:35:51 +00:00

52 lines
2.0 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[CreateAssetMenu(fileName = "ChanneledAbility", menuName = "RiftMayhem/AbilitySystem/Abilities/Channeled Ability", order = 0)]
public class ChanneledAbility : BaseAbility
{
public GameObject prefab;
public float duration;
public float radius;
public bool canHitSelf;
public bool followUser;
public bool allowAiming;
public float healthCostPerTick;
public float percentHealthCostPerTick;
public float manaCostPerTick;
public float percentManaCostPerTick;
protected GameObject instanciatedAbility;
private NetworkedChanneling networkedChanneling;
public virtual NetworkedChanneling ExecuteChannel(Taggable user, ref Coroutine channelingCoroutine)
{
base.Execute(user);
instanciatedAbility = Instantiate(prefab, user.GetComponentInChildren<ProjectileSpawnLocationController>().transform.position, user.GetComponentInChildren<ProjectileSpawnLocationController>().transform.rotation);
networkedChanneling = instanciatedAbility.GetComponent<NetworkedChanneling>();
networkedChanneling.ownerTag = user;
networkedChanneling.ability = this;
networkedChanneling.duration = duration;
networkedChanneling.radius = radius;
networkedChanneling.canHitSelf = canHitSelf;
networkedChanneling.followUser = followUser;
networkedChanneling.allowAiming = allowAiming;
networkedChanneling.healthCostPerTick = healthCostPerTick;
networkedChanneling.percentHealthCostPerTick = percentHealthCostPerTick;
networkedChanneling.manaCostPerTick = manaCostPerTick;
networkedChanneling.percentManaCostPerTick = percentManaCostPerTick;
networkedChanneling.ownerHealth = user.GetComponent<Health>();
networkedChanneling.ownerMana = user.GetComponent<Mana>();
networkedChanneling.Init(ref channelingCoroutine);
return networkedChanneling;
}
}