You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
822 B

using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
/// <summary>
/// 特效基类
/// </summary>
public abstract class Effect : MonoBehaviour
{
public Transform followTarget;
public bool isFollow = false;
public void ChangeEffectPos(Vector3 pos)
{
isFollow = false;
followTarget = null;
transform.position = pos;
}
public void ChangeEffectPos(Transform transform)
{
followTarget = transform;
if (followTarget)
{
isFollow = true;
}
}
private void Update()
{
if (isFollow && Camera.main.WorldToScreenPoint(followTarget.position).z>=0)
{
transform.position = Camera.main.WorldToScreenPoint(followTarget.position);
}
}
}