Files
tcg-client/Assets/TcgEngine/Scripts/FX/AimTargetFX.cs
yaoyanwei 2f2a601227 init
2025-08-04 16:45:48 +08:00

43 lines
939 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using TcgEngine.Client;
namespace TcgEngine.FX
{
/// <summary>
/// The crosshair target that appears when targeting with a spell
/// </summary>
public class AimTargetFX : MonoBehaviour
{
public GameObject fx;
void Start()
{
}
void Update()
{
bool visible = false;
HandCard hcard = HandCard.GetDrag();
if (hcard != null)
{
Card caster = hcard.GetCard();
if (caster.CardData.IsRequireTarget())
visible = true;
}
if (fx.activeSelf != visible)
fx.SetActive(visible);
if (visible)
{
Vector3 dest = GameBoard.Get().RaycastMouseBoard();
transform.position = dest;
}
}
}
}