protected override void OnEvent(EventMessage em, ref object paramRef) { base.OnEvent(em, ref paramRef); if (targetObj == null) { targetObj = gameObject; } if (unlock) { if (!em.paramBool) { ColliderLocker.Lock(targetObj, flag, bRecursive); } else { ColliderLocker.Unlock(targetObj, flag, bRecursive); } } else { if (em.paramBool) { ColliderLocker.Lock(targetObj, flag, bRecursive); } else { ColliderLocker.Unlock(targetObj, flag, bRecursive); } } }
static ColliderLocker GetColliderLocker(GameObject go) { if (go == null) { return(null); } ColliderLocker cl = go.GetComponent <ColliderLocker>(); if (cl == null) { cl = go.AddComponent <ColliderLocker>(); } return(cl); }