Update to build 2023r171ex7p2

This commit is contained in:
SDraw 2023-06-28 08:16:36 +03:00
parent 6f8fa13c94
commit d210ed4636
No known key found for this signature in database
GPG key ID: BB95B4DAB2BB8BB5
76 changed files with 3349 additions and 1220 deletions

61
ml_prm/RagdollTrigger.cs Normal file
View file

@ -0,0 +1,61 @@
using ABI.CCK.Components;
using ABI_RC.Core.Player;
using UnityEngine;
namespace ml_prm
{
[DisallowMultipleComponent]
class RagdollTrigger : MonoBehaviour
{
Collider m_collider = null;
Collider m_lastTrigger = null;
bool m_triggered = false;
void Start()
{
m_collider = this.GetComponent<Collider>();
}
void Update()
{
if(!ReferenceEquals(m_lastTrigger, null))
{
if(m_lastTrigger != null)
{
if(!m_collider.bounds.Intersects(m_lastTrigger.bounds))
m_lastTrigger = null;
}
else
m_lastTrigger = null;
}
}
void OnTriggerEnter(Collider p_other)
{
CVRPointer l_pointer = p_other.GetComponent<CVRPointer>();
if((l_pointer != null) && (l_pointer.type == "ragdoll") && !IsIgnored(l_pointer.transform) && (m_lastTrigger != p_other))
{
m_lastTrigger = p_other;
m_triggered = true;
}
}
void OnTriggerExit(Collider p_other)
{
if(m_lastTrigger == p_other)
m_lastTrigger = null;
}
public bool GetStateWithReset()
{
bool l_state = m_triggered;
m_triggered = false;
return l_state;
}
static bool IsIgnored(Transform p_transform)
{
return (Settings.IgnoreLocal && (p_transform.root == PlayerSetup.Instance.transform));
}
}
}