206 lines
4.3 KiB
C#
206 lines
4.3 KiB
C#
// ***********************************************************************
|
|
// Assembly : Game
|
|
// Author : Kimch
|
|
// Created : 2020-09-02
|
|
// Description :
|
|
// Last Modified By :
|
|
// Last Modified On :
|
|
// ***********************************************************************
|
|
// <copyright file= "Ef_base" company="Kimch"></copyright>
|
|
// <summary></summary>
|
|
// ***********************************************************************
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
namespace G
|
|
{
|
|
public class Ef_base : MonoBehaviour
|
|
{
|
|
protected Transform m_transform;
|
|
|
|
protected float m_delay;
|
|
|
|
protected bool m_start;
|
|
|
|
protected Collider m_collider;
|
|
|
|
protected bool m_isTrigger;
|
|
|
|
protected Vector3 m_localScale;
|
|
|
|
public int m_posType;
|
|
|
|
public bool m_rotationWithTarget;
|
|
|
|
internal float[] m_param = new float[4];
|
|
|
|
[HideInInspector]
|
|
public Object m_objParam;
|
|
|
|
public float m_endDelay = 1f;
|
|
|
|
public float m_startTrigger = -1f;
|
|
|
|
public float m_endTrigger = -1f;
|
|
|
|
public float m_radius = 0.35f;
|
|
|
|
public EntityCha m_scriptUser
|
|
{
|
|
get;
|
|
set;
|
|
}
|
|
|
|
public Transform m_user
|
|
{
|
|
get;
|
|
set;
|
|
}
|
|
|
|
public int m_skillId
|
|
{
|
|
get;
|
|
set;
|
|
}
|
|
|
|
public virtual void Awake()
|
|
{
|
|
m_objParam = this;
|
|
}
|
|
|
|
public void Destroy(GameObject obj)
|
|
{
|
|
//PrefabManager.Instance().Despawn(obj.transform);
|
|
}
|
|
|
|
public void Destroy2(GameObject obj)
|
|
{
|
|
//PrefabManager.Instance().Despawn(obj.transform);
|
|
}
|
|
|
|
public static void GetPosByType(Transform fx, Transform target, int type, bool isRotation)
|
|
{
|
|
if (!target)
|
|
{
|
|
return;
|
|
}
|
|
if (isRotation)
|
|
{
|
|
fx.rotation = target.rotation;
|
|
}
|
|
//EntityCha component = target.GetComponent<EntityCha>();
|
|
//if (component == null)
|
|
//{
|
|
// fx.position = target.position;
|
|
// return;
|
|
//}
|
|
//float modHeight = component.modHeight;
|
|
//switch (type)
|
|
//{
|
|
//case 0:
|
|
// fx.position = target.position;
|
|
// break;
|
|
//case 1:
|
|
//{
|
|
// float d4 = modHeight;
|
|
// fx.position = target.position + Vector3.up * d4;
|
|
// break;
|
|
//}
|
|
//case 2:
|
|
//{
|
|
// float num = modHeight * 0.5f;
|
|
// if (num < 0.1f)
|
|
// {
|
|
// num = 0.1f;
|
|
// }
|
|
// fx.position = target.position + Vector3.up * num;
|
|
// break;
|
|
//}
|
|
//case 3:
|
|
// fx.position = component.GetLeftHandPos();
|
|
// break;
|
|
//case 4:
|
|
// fx.position = component.GetRightHandPos();
|
|
// break;
|
|
//case 5:
|
|
//{
|
|
// Vector3 modPos4 = component.GetModPos();
|
|
// float d3 = modHeight * 0.5f;
|
|
// fx.position = modPos4 + Vector3.up * d3;
|
|
// break;
|
|
//}
|
|
//case 6:
|
|
//{
|
|
// Vector3 modPos3 = component.GetModPos();
|
|
// float d2 = modHeight * 0.5f;
|
|
// fx.position = modPos3 - Vector3.up * d2;
|
|
// break;
|
|
//}
|
|
//case 7:
|
|
//{
|
|
// Vector3 vector = fx.position = component.GetModPos();
|
|
// break;
|
|
//}
|
|
//case 8:
|
|
//{
|
|
// Vector3 modPos = component.GetModPos();
|
|
// modPos = ((Player)component).m_hero.m_back.position;
|
|
// float d = modHeight * 0.5f;
|
|
// fx.position = modPos - Vector3.up * d;
|
|
// break;
|
|
//}
|
|
//default:
|
|
// Debug.LogError("======PosType = " + type);
|
|
// break;
|
|
//}
|
|
}
|
|
|
|
public static List<Transform> GetEnemyInRange(Transform user, float maxLen)
|
|
{
|
|
List<Transform> list = new List<Transform>();
|
|
if (user == null || user.GetComponent<EntityCha>() == null)
|
|
{
|
|
return list;
|
|
}
|
|
//if (user.GetComponent<EntityCha>().IsPlayer())
|
|
//{
|
|
// List<Enemy> existingEnemies = EnemyCtrl.instance.GetExistingEnemies();
|
|
// foreach (Enemy item in existingEnemies)
|
|
// {
|
|
// Vector3 position = item.transform.position;
|
|
// position.y = 0f;
|
|
// Vector3 position2 = user.position;
|
|
// position2.y = 0f;
|
|
// float num = Vector3.Distance(position, position2);
|
|
// if (num <= maxLen)
|
|
// {
|
|
// list.Add(item.transform);
|
|
// }
|
|
// }
|
|
// GameObject gameObject = GameObject.FindGameObjectWithTag("OtherPlayer");
|
|
// if (gameObject != null)
|
|
// {
|
|
// list.Add(gameObject.transform);
|
|
// }
|
|
//}
|
|
//else
|
|
//{
|
|
// GameObject gameObject2 = GameObject.FindGameObjectWithTag("Player");
|
|
// if (gameObject2 != null)
|
|
// {
|
|
// list.Add(gameObject2.transform);
|
|
// }
|
|
//}
|
|
return list;
|
|
}
|
|
|
|
protected void SetCollider(bool bEnable)
|
|
{
|
|
if ((bool)m_collider)
|
|
{
|
|
m_collider.enabled = bEnable;
|
|
}
|
|
}
|
|
}
|
|
}
|