using Photon.Pun; using System.Collections; using System.Collections.Generic; using UnityEngine; [CreateAssetMenu(fileName = "SlashAbility", menuName = "RiftMayhem/AbilitySystem/Abilities/Simple Slash Ability", order = 0)] public class SimpleMeleeSlashAbility : BaseAbility { public GameObject slashPrefab; public bool regenHealthOnHit; public bool regenManaOnHit; public float healthOnHit; public float manaOnHit; public float lifeSpan; public float range; private GameObject instantiatedSlash; private NetworkedSlash networkedSlash; public override void Execute(PhotonView user, Taggable userTag) { base.Execute(user, userTag); Debug.Log($"Player {user.name} used {this.name} and spent {manaCost} mana."); instantiatedSlash = PhotonNetwork.Instantiate("Abilities/" + slashPrefab.name, user.GetComponentInChildren().transform.position, user.GetComponentInChildren().transform.rotation); networkedSlash = instantiatedSlash.GetComponent(); networkedSlash.owner = user; networkedSlash.ownerTag = userTag; networkedSlash.ability = this; networkedSlash.lifeSpan = lifeSpan; networkedSlash.range = range; networkedSlash.regenHealthOnHit = regenHealthOnHit; networkedSlash.regenManaOnHit = regenManaOnHit; networkedSlash.healthOnHit = healthOnHit; networkedSlash.manaOnHit = manaOnHit; networkedSlash.Init(); } }