RiftMayhem/Assets/Scripts/AoERayHitLocationSnapshotController.cs
Pedro Gomes 81f2ac424e Insane update
Abilities:

- area of effect ability with impact event/chain reaction type added
- melee slash timing bugfix
- melee slash VFX added
- blizzard (second mage ability) added
- holy circle (ultimate priest ability) added
- consecration (ultimate knight ability) added
- whirling axes (second barbarian ability) added
- glacial bomb (ultimate mage ability) added
- ice shard (first mage ability) added

Others:

- aoe location snapshot on cast mechanic added
- reduced realtime shadows on rifthunters inn
2024-07-04 21:27:15 +01:00

60 lines
1.4 KiB
C#

using Photon.Pun;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class AoERayHitLocationSnapshotController : MonoBehaviour
{
public Transform aoeRayHitLocationSnapshot;
public LayerMask movementMask;
protected PhotonView photonView;
Ray ray;
protected RaycastHit hit;
protected Vector3 targetPoint = new Vector3();
bool isCasting;
protected virtual void Awake()
{
photonView = GetComponentInParent<PhotonView>();
aoeRayHitLocationSnapshot.parent = null;
}
private void OnEnable()
{
CastBarHandler.Instance.OnCastingStateChanged.AddListener(UpdateIsCastingState);
}
private void OnDisable()
{
CastBarHandler.Instance.OnCastingStateChanged.RemoveListener(UpdateIsCastingState);
}
protected virtual void Start()
{
if (!photonView.IsMine) this.enabled = false;
}
private void UpdateIsCastingState(bool isCasting)
{
this.isCasting = isCasting;
if (isCasting)
{
ray = Camera.main.ScreenPointToRay(Input.mousePosition);
if (Physics.Raycast(ray, out hit, 100f, movementMask))
{
aoeRayHitLocationSnapshot.position = hit.point;
}
}
}
private void OnDestroy()
{
Destroy(aoeRayHitLocationSnapshot.gameObject);
}
}