mirror of
https://github.com/hanetzer/sdraw_mods_cvr.git
synced 2025-09-05 03:19:23 +00:00
Custom event classes for patched methods
Update to LeapCSharp 6.15.0
This commit is contained in:
parent
4b879d53d5
commit
85925a7072
76 changed files with 3443 additions and 2187 deletions
|
@ -1,6 +1,8 @@
|
|||
using ABI.CCK.Components;
|
||||
using ABI_RC.Core.Savior;
|
||||
using ABI_RC.Systems.InputManagement;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
|
||||
namespace ml_pmc
|
||||
|
@ -72,5 +74,26 @@ namespace ml_pmc
|
|||
p_pose.bodyRotation.w *= -1f;
|
||||
p_pose.bodyPosition.x *= -1f;
|
||||
}
|
||||
|
||||
public static bool IsInSight(CapsuleCollider p_source, CapsuleCollider p_target, float p_limit)
|
||||
{
|
||||
bool l_result = false;
|
||||
if((p_source != null) && (p_target != null))
|
||||
{
|
||||
Ray l_ray = new Ray();
|
||||
l_ray.origin = p_source.bounds.center;
|
||||
l_ray.direction = p_target.bounds.center - l_ray.origin;
|
||||
List<RaycastHit> l_hits = Physics.RaycastAll(l_ray, p_limit).ToList();
|
||||
if(l_hits.Count > 0)
|
||||
{
|
||||
l_hits.RemoveAll(hit => hit.collider.gameObject.layer == LayerMask.NameToLayer("UI Internal")); // Somehow layer mask in RaycastAll just ignores players entirely
|
||||
l_hits.RemoveAll(hit => hit.collider.gameObject.layer == LayerMask.NameToLayer("PlayerLocal"));
|
||||
l_hits.RemoveAll(hit => hit.collider.gameObject.layer == LayerMask.NameToLayer("PlayerClone"));
|
||||
l_hits.Sort((a, b) => ((a.distance < b.distance) ? -1 : 1));
|
||||
l_result = (l_hits.First().collider.gameObject.transform.root == p_target.transform.root);
|
||||
}
|
||||
}
|
||||
return l_result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue