You've already forked Darklings-FightingGame
mirror of
https://github.com/izzy2lost/Darklings-FightingGame.git
synced 2026-03-10 11:35:19 -07:00
20 lines
470 B
C#
20 lines
470 B
C#
|
|
using Demonics.Enum;
|
||
|
|
using UnityEngine;
|
||
|
|
|
||
|
|
namespace Demonics.Utility
|
||
|
|
{
|
||
|
|
public class Raycast : MonoBehaviour
|
||
|
|
{
|
||
|
|
public static RaycastHit2D Cast(Vector2 start, Vector2 dir, float length, LayerMaskEnum layerMask, Color color = default)
|
||
|
|
{
|
||
|
|
#if UNITY_EDITOR
|
||
|
|
if (color == default)
|
||
|
|
{
|
||
|
|
color = Color.magenta;
|
||
|
|
}
|
||
|
|
Debug.DrawRay(start, dir * length, color);
|
||
|
|
#endif
|
||
|
|
return Physics2D.Raycast(start, dir, length, LayerProvider.GetLayerMask(layerMask), 0);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|