81 lines
2.9 KiB
C#
81 lines
2.9 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
[CreateAssetMenu(fileName = "AoEOverTimeAbility", menuName = "RiftMayhem/AbilitySystem/Abilities/Area of Effect Over Time Ability", order = 0)]
|
|
public class AreaOfEffectOverTimeAbility : AreaOfEffectAbility
|
|
{
|
|
public float duration;
|
|
public bool followUser;
|
|
public bool followTarget;
|
|
public bool damageFollowingTarget;
|
|
|
|
private NetworkedAreaOfEffectOverTime networkedAreaOfEffectOverTime;
|
|
|
|
public override void Execute(Taggable user)
|
|
{
|
|
SpendResourcesNecessary(user);
|
|
|
|
if (spawnUnderUser)
|
|
{
|
|
instantiatedArea = Instantiate(aoePrefab, user.transform.position, Quaternion.identity);
|
|
//instantiatedArea.transform.parent = user.transform;
|
|
networkedAreaOfEffectOverTime = instantiatedArea.GetComponent<NetworkedAreaOfEffectOverTime>();
|
|
|
|
SetupValues(user);
|
|
|
|
networkedAreaOfEffectOverTime.Init();
|
|
return;
|
|
}
|
|
|
|
rot = Quaternion.LookRotation(user.GetComponentInChildren<AoERayHitLocationSnapshotController>().aoeRayHitLocationSnapshot.position - user.transform.position);
|
|
instantiatedArea = Instantiate(aoePrefab, user.GetComponentInChildren<AoERayHitLocationSnapshotController>().aoeRayHitLocationSnapshot.position, rotateOnSpawn ? rot : Quaternion.identity);
|
|
|
|
networkedAreaOfEffectOverTime = instantiatedArea.GetComponent<NetworkedAreaOfEffectOverTime>();
|
|
|
|
SetupValues(user);
|
|
|
|
networkedAreaOfEffectOverTime.Init();
|
|
}
|
|
|
|
public override void Execute(Taggable user, Vector3 point)
|
|
{
|
|
SpendResourcesNecessary(user);
|
|
|
|
instantiatedArea = Instantiate(aoePrefab, point, Quaternion.identity);
|
|
|
|
networkedAreaOfEffectOverTime = instantiatedArea.GetComponent<NetworkedAreaOfEffectOverTime>();
|
|
|
|
SetupValues(user);
|
|
|
|
networkedAreaOfEffectOverTime.Init();
|
|
}
|
|
|
|
public override void Execute(Taggable user, Transform target)
|
|
{
|
|
SpendResourcesNecessary(user);
|
|
|
|
instantiatedArea = Instantiate(aoePrefab, target.position, Quaternion.identity);
|
|
|
|
networkedAreaOfEffectOverTime = instantiatedArea.GetComponent<NetworkedAreaOfEffectOverTime>();
|
|
|
|
SetupValues(user);
|
|
|
|
networkedAreaOfEffectOverTime.Init(target);
|
|
}
|
|
|
|
private void SetupValues(Taggable user)
|
|
{
|
|
networkedAreaOfEffectOverTime.ownerTag = user;
|
|
networkedAreaOfEffectOverTime.ability = this;
|
|
networkedAreaOfEffectOverTime.radius = radius;
|
|
networkedAreaOfEffectOverTime.telegraphDelay = telegraphDelay;
|
|
networkedAreaOfEffectOverTime.lifeSpan = lifeSpan;
|
|
networkedAreaOfEffectOverTime.duration = duration;
|
|
networkedAreaOfEffectOverTime.followUser = followUser;
|
|
networkedAreaOfEffectOverTime.followTarget = followTarget;
|
|
networkedAreaOfEffectOverTime.damageFollowingTarget = damageFollowingTarget;
|
|
networkedAreaOfEffectOverTime.canHitSelf = canHitSelf;
|
|
}
|
|
}
|