RiftMayhem/Assets/Scripts/AbilitySystem/AreaOfEffectWithImpactEventAbility.cs
Pedro Gomes f9d27b5b01 New assets and class update
- Added new assets, effects and edited existing ones
- Added new Rogue playable class
- Added multiple new rogue abilities both knives and arrows
2025-01-13 18:41:50 +00:00

78 lines
3.8 KiB
C#

using Photon.Pun;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[CreateAssetMenu(fileName = "AoEWithImpactEventAbility", menuName = "RiftMayhem/AbilitySystem/Abilities/Area of Effect With Impact Event Ability", order = 0)]
public class AreaOfEffectWithImpactEventAbility : AreaOfEffectAbility
{
public float impactDelay;
private NetworkedAreaOfEffectWithImpactEvent networkedAreaOfEffectWithImpactEvent;
public override void Execute(PhotonView user, Taggable userTag)
{
user.GetComponent<Mana>().ChangeValue(-manaCost);
if (spawnUnderUser)
{
rot = Quaternion.LookRotation(user.GetComponentInChildren<AoERayHitLocationSnapshotController>().aoeRayHitLocationSnapshot.position - user.transform.position);
instantiatedArea = PhotonNetwork.Instantiate("Abilities/" + aoePrefab.name, user.transform.position, rotateOnSpawn ? rot : Quaternion.identity);
//instantiatedArea.transform.parent = user.transform;
networkedAreaOfEffectWithImpactEvent = instantiatedArea.GetComponent<NetworkedAreaOfEffectWithImpactEvent>();
networkedAreaOfEffectWithImpactEvent.owner = user;
networkedAreaOfEffectWithImpactEvent.ownerTag = userTag;
networkedAreaOfEffectWithImpactEvent.ability = this;
networkedAreaOfEffectWithImpactEvent.radius = radius;
networkedAreaOfEffectWithImpactEvent.telegraphDelay = telegraphDelay;
networkedAreaOfEffectWithImpactEvent.lifeSpan = lifeSpan;
networkedAreaOfEffectWithImpactEvent.canHitSelf = canHitSelf;
networkedAreaOfEffectWithImpactEvent.impactDelay = impactDelay;
networkedAreaOfEffectWithImpactEvent.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);
networkedAreaOfEffectWithImpactEvent = instantiatedArea.GetComponent<NetworkedAreaOfEffectWithImpactEvent>();
networkedAreaOfEffectWithImpactEvent.owner = user;
networkedAreaOfEffectWithImpactEvent.ownerTag = userTag;
networkedAreaOfEffectWithImpactEvent.ability = this;
networkedAreaOfEffectWithImpactEvent.radius = radius;
networkedAreaOfEffectWithImpactEvent.telegraphDelay = telegraphDelay;
networkedAreaOfEffectWithImpactEvent.lifeSpan = lifeSpan;
networkedAreaOfEffectWithImpactEvent.canHitSelf = canHitSelf;
networkedAreaOfEffectWithImpactEvent.impactDelay = impactDelay;
networkedAreaOfEffectWithImpactEvent.Init();
}
public override void Execute(PhotonView user, Taggable userTag, Vector3 point)
{
user.GetComponent<Mana>().ChangeValue(-manaCost);
instantiatedArea = PhotonNetwork.Instantiate("Abilities/" + aoePrefab.name, point, Quaternion.identity);
networkedAreaOfEffectWithImpactEvent = instantiatedArea.GetComponent<NetworkedAreaOfEffectWithImpactEvent>();
networkedAreaOfEffectWithImpactEvent.owner = user;
networkedAreaOfEffectWithImpactEvent.ownerTag = userTag;
networkedAreaOfEffectWithImpactEvent.ability = this;
networkedAreaOfEffectWithImpactEvent.radius = radius;
networkedAreaOfEffectWithImpactEvent.telegraphDelay = telegraphDelay;
networkedAreaOfEffectWithImpactEvent.lifeSpan = lifeSpan;
networkedAreaOfEffectWithImpactEvent.canHitSelf = canHitSelf;
networkedAreaOfEffectWithImpactEvent.impactDelay = impactDelay;
networkedAreaOfEffectWithImpactEvent.Init();
}
}