RiftMayhem/Assets/Scripts/AbilitySystem/AreaOfEffectOverTimeAbility.cs
Pedro Gomes 59c74b1d31 New abilities, bugfix necro autosummon, updated effects
- Knight Challenging Shout AoE Taunt ability
- Mage Firewall AoE Burn ability
- Added support for movement speed modifier effects to slow enemies instead of only buffing allies.
- Added different movement speed minimum cap to enemies and bosses
2024-12-21 20:40:31 +00:00

87 lines
3.4 KiB
C#

using Photon.Pun;
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;
public bool rotateOnSpawn = false;
private NetworkedAreaOfEffectOverTime networkedAreaOfEffectOverTime;
Quaternion rot;
public override void Execute(PhotonView user, Taggable userTag)
{
SpendResourcesNecessary(user, userTag);
if (spawnUnderUser)
{
instantiatedArea = PhotonNetwork.Instantiate("Abilities/" + aoePrefab.name, user.transform.position, Quaternion.identity);
//instantiatedArea.transform.parent = user.transform;
networkedAreaOfEffectOverTime = instantiatedArea.GetComponent<NetworkedAreaOfEffectOverTime>();
SetupValues(user, userTag);
networkedAreaOfEffectOverTime.Init();
return;
}
rot = Quaternion.LookRotation(user.GetComponentInChildren<AoERayHitLocationSnapshotController>().aoeRayHitLocationSnapshot.position - user.transform.position);
instantiatedArea = PhotonNetwork.Instantiate("Abilities/" + aoePrefab.name, user.GetComponentInChildren<AoERayHitLocationSnapshotController>().aoeRayHitLocationSnapshot.position, rotateOnSpawn ? rot : Quaternion.identity);
networkedAreaOfEffectOverTime = instantiatedArea.GetComponent<NetworkedAreaOfEffectOverTime>();
SetupValues(user, userTag);
networkedAreaOfEffectOverTime.Init();
}
public override void Execute(PhotonView user, Taggable userTag, Vector3 point)
{
SpendResourcesNecessary(user, userTag);
instantiatedArea = PhotonNetwork.Instantiate("Abilities/" + aoePrefab.name, point, Quaternion.identity);
networkedAreaOfEffectOverTime = instantiatedArea.GetComponent<NetworkedAreaOfEffectOverTime>();
SetupValues(user, userTag);
networkedAreaOfEffectOverTime.Init();
}
public override void Execute(PhotonView user, Taggable userTag, Transform target)
{
SpendResourcesNecessary(user, userTag);
instantiatedArea = PhotonNetwork.Instantiate("Abilities/" + aoePrefab.name, target.position, Quaternion.identity);
networkedAreaOfEffectOverTime = instantiatedArea.GetComponent<NetworkedAreaOfEffectOverTime>();
SetupValues(user, userTag);
networkedAreaOfEffectOverTime.Init(target);
}
private void SetupValues(PhotonView user, Taggable userTag)
{
networkedAreaOfEffectOverTime.owner = user;
networkedAreaOfEffectOverTime.ownerTag = userTag;
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;
}
}