-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reaction to CVRPointer component with
ragdoll
type
- Loading branch information
Showing
4 changed files
with
75 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
using ABI.CCK.Components; | ||
using UnityEngine; | ||
|
||
namespace ml_prm | ||
{ | ||
[DisallowMultipleComponent] | ||
class RagdollTrigger : MonoBehaviour | ||
{ | ||
static int ms_localPlayerLayer = 0; | ||
|
||
Collider m_lastCollider = null; | ||
bool m_triggered = false; | ||
|
||
void Start() | ||
{ | ||
ms_localPlayerLayer = LayerMask.NameToLayer("PlayerLocal"); | ||
} | ||
|
||
void OnTriggerEnter(Collider p_other) | ||
{ | ||
CVRPointer l_pointer = p_other.gameObject.GetComponent<CVRPointer>(); | ||
if((l_pointer != null) && l_pointer.type == "ragdoll" && p_other.gameObject.layer == ms_localPlayerLayer && (m_lastCollider != p_other)) | ||
{ | ||
m_lastCollider = p_other; | ||
m_triggered = true; | ||
} | ||
} | ||
|
||
void OnTriggerExit(Collider p_other) | ||
{ | ||
if(m_lastCollider == p_other) | ||
m_lastCollider = null; | ||
} | ||
|
||
public bool GetStateWithReset() | ||
{ | ||
bool l_state = m_triggered; | ||
m_triggered = false; | ||
return l_state; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters