- new Projectile + Area of effect over time with tick event implemented - New Tornado projectile+AoEOverTime ability for Barb/Naturalist
89 lines
3.6 KiB
C#
89 lines
3.6 KiB
C#
using Photon.Pun;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
[CreateAssetMenu(fileName = "ProjectileAreaOfEffectOverTimeAbility", menuName = "RiftMayhem/AbilitySystem/Abilities/Projectile Area Of Effect Over Time Ability", order = 0)]
|
|
public class ProjectileAreaOfEffectOverTimeAbility : AreaOfEffectAbility
|
|
{
|
|
[Header("Projectile:")]
|
|
public ProjectileAbility projectileAbility;
|
|
|
|
[Header("AreaOfEffectOverTime:")]
|
|
public float duration;
|
|
public bool followUser;
|
|
public bool followTarget;
|
|
public bool damageFollowingTarget;
|
|
|
|
|
|
private NetworkedProjectileAreaOfEffectOverTimeWithTickEvent networkedAreaOfEffectOverTime;
|
|
|
|
|
|
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<NetworkedProjectileAreaOfEffectOverTimeWithTickEvent>();
|
|
|
|
SetupValues(user, userTag);
|
|
|
|
networkedAreaOfEffectOverTime.Init();
|
|
return;
|
|
}
|
|
|
|
instantiatedArea = PhotonNetwork.Instantiate("Abilities/" + aoePrefab.name, user.GetComponentInChildren<ProjectileSpawnLocationController>().transform.position, user.GetComponentInChildren<ProjectileSpawnLocationController>().transform.rotation);
|
|
|
|
networkedAreaOfEffectOverTime = instantiatedArea.GetComponent<NetworkedProjectileAreaOfEffectOverTimeWithTickEvent>();
|
|
|
|
SetupValues(user, userTag);
|
|
|
|
networkedAreaOfEffectOverTime.Init();
|
|
}
|
|
|
|
public override void Execute(PhotonView user, Taggable userTag, Vector3 point)
|
|
{
|
|
SpendResourcesNecessary(user, userTag);
|
|
|
|
instantiatedArea = PhotonNetwork.Instantiate("Abilities/" + aoePrefab.name, user.GetComponentInChildren<ProjectileSpawnLocationController>().transform.position, user.GetComponentInChildren<ProjectileSpawnLocationController>().transform.rotation);
|
|
|
|
networkedAreaOfEffectOverTime = instantiatedArea.GetComponent<NetworkedProjectileAreaOfEffectOverTimeWithTickEvent>();
|
|
|
|
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<NetworkedProjectileAreaOfEffectOverTimeWithTickEvent>();
|
|
|
|
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;
|
|
networkedAreaOfEffectOverTime.projectileAbility = projectileAbility;
|
|
}
|
|
}
|