AkiraPixelWind/Assets/Scripts/Main/Common/Common.cs
2023-01-17 17:28:47 +08:00

56 lines
1.6 KiB
C#

using UnityEngine;
using UnityEngine.UI;
namespace Game
{
public class Common
{
static public bool CheckTagIsRole(string tag,out E_NODE_TYPE nodetype)
{
switch (tag)
{
case Tags.MainPlayer:
nodetype = E_NODE_TYPE.N_MAINPLAYER;
return true;
case Tags.NPC:
nodetype = E_NODE_TYPE.N_NPC;
return true;
case Tags.Monster:
nodetype = E_NODE_TYPE.N_MONSTER;
return true;
}
nodetype = E_NODE_TYPE.N_FREE;
return false;
}
#region
static public string GetBulletProfabPath(string Name)
{
return $"Assets/GameAssets/Prefabs/Bullet/{Name}.prefab"; ;
}
static public string GetBulletCfgPath(string Name)
{
return "Assets/GameAssets/ScriptableObjectCfg/BulletCfg/" + Name + ".asset"; ;
}
#endregion
/// <summary>
/// 根据角度算向量
/// </summary>
/// <param name="angle"></param>
static public Vector3 GetVecForAngleXZ(float angle)
{
return new Vector3(100 * Mathf.Cos(angle * Mathf.PI / 180), 0,100 * Mathf.Sin(angle * Mathf.PI / 180)).normalized;
}
/// <summary>
/// 根据角度算向量
/// </summary>
/// <param name="angle"></param>
static public Vector3 GetVecForAngleXY(float angle)
{
return new Vector3(100 * Mathf.Cos(angle * Mathf.PI / 180),100 * Mathf.Sin(angle * Mathf.PI / 180),0).normalized;
}
}
}