This commit is contained in:
CortexCore
2023-11-15 23:55:06 +08:00
parent 5446067f91
commit 70247f0242
82 changed files with 3271 additions and 579 deletions

View File

@@ -3,7 +3,6 @@ using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UIElements;
using System.Reflection;
using UnityEngine.AddressableAssets;
using System;
#if UNITY_EDITOR
using UnityEditor;

View File

@@ -39,6 +39,24 @@ namespace BITKit
}
public static partial class MathV
{
public static bool InFovRange(Vector3 selfPosition,Vector3 selfForward, Vector3 target, float fov)
{
var direction = target - selfPosition;
var angle = Vector3.Angle(direction, selfForward);
return angle < fov;
}
public static bool IsForward(Vector3 selfPosition, Vector3 selfForward,Vector3 targetPos)
{
// Get the direction from referencePos to targetPos
Vector3 directionToTarget = (targetPos - selfPosition).normalized;
// Calculate the dot product
float dotProduct = Vector3.Dot(directionToTarget, selfForward);
// If dot product is greater than 0, targetPos is in front of referencePos
return dotProduct > 0;
}
// 对于 Vector3
public static Vector3 AlignRotation(Vector3 eulerAngles, float angleIncrement)
{

View File

@@ -28,6 +28,12 @@ namespace BITKit
private readonly List<T> _list=new();
public int DefaultCapacity
{
get => defaultCapacity;
set => defaultCapacity = value;
}
public T Get(T element = null, Transform _root = null)
{
if (_list.Count == defaultCapacity)