private void OnTriggerStay2D(Collider2D other) { if (other.gameObject.CompareTag("Player") && OnTriggerEnter != null) { OnTriggerEnter.Invoke(gameObject, other); } }
private static bool HandleEnter(CNWSTrigger trigger, CScriptEvent scriptEvent) { OnTriggerEnter eventData = ProcessEvent(new OnTriggerEnter { Trigger = trigger.ToNwObject <NwTrigger>() !, EnteredObject = scriptEvent.GetObjectID(0).ToNwObject <NwGameObject>() !, IsTrap = trigger.m_bTrap.ToBool(), IsTrapForceSet = scriptEvent.GetInteger(0).ToBool(), });
private void PlayerEnter() { if (Paused) { _triggered = true; return; } _animator.SetTrigger(PlayerEnterTrigger); OnTriggerEnter?.Invoke(); }
/// <summary> /// Method to fire trigger events based on certain conditions. /// </summary> /// <param name="other"></param> /// <param name="side"></param> public void Trigger(GameObject other, Side side) { if (!triggeredGameObj.Contains(other)) { triggeredGameObj.Add(other); OnTriggerEnter?.Invoke(this, other, side); } if (!triggeredThisFrame.Contains(other)) { triggeredThisFrame.Add(other); } OnTrigger?.Invoke(this, other, side); }
public void HandlePhysicsEvents() { for (int i = 0; i < currentlyCollidingWith.Count; i++) { if (lastCollidedWith.Contains(currentlyCollidingWith[i])) { //Collided with it last frame. if (coll.isTrigger) { OnTriggerStay?.Invoke(currentlyCollidingWith[i]); } else { OnCollisionStay?.Invoke(new TFCollision(currentlyCollidingWith[i])); } } else { //Did not collide with last frame. if (coll.isTrigger) { OnTriggerEnter?.Invoke(currentlyCollidingWith[i]); } else { OnCollisionEnter?.Invoke(new TFCollision(currentlyCollidingWith[i])); } } } for (int w = 0; w < lastCollidedWith.Count; w++) { //If we've exited collision with a collider. if (!currentlyCollidingWith.Contains(lastCollidedWith[w])) { if (coll.isTrigger) { OnTriggerExit?.Invoke(lastCollidedWith[w]); } else { OnCollisionExit?.Invoke(new TFCollision(lastCollidedWith[w])); } } } lastCollidedWith = new List <TFCollider>(currentlyCollidingWith); currentlyCollidingWith.Clear(); }
private void OnTriggerEnter(Collider other) { for (int i = 0; i < triggers.Count; i++) { if (triggers[i] is OnTriggerEnter) { OnTriggerEnter trigger = (OnTriggerEnter)triggers[i]; if (other.CompareTag(other.tag)) { State toState = trigger.ValidateTransitions(); if (toState != null) { CurrentState.DoExit(); currentStateIndex = controller.states.FindIndex(x => x.id == toState.id); CurrentState.DoEnter(); } } } } }
private void OnTriggerEnter2D(Collider2D otherCollider) { OnTriggerEnter?.Invoke(otherCollider); }
void OnTriggerEnter2D(Collider2D collider) { OnTriggerEnter?.Invoke(collider); }
private void OnTriggerEnter2D(Collider2D other) { OnTriggerEnter?.Invoke(other, gameObject); }
public void DoCollisionCheck(bool triggered = false, CollidAble collidable = null) { if (IsActiv) { List <CollidAble> collisions; List <int> alreadyExists = new List <int>(); if (!triggered) { grids = CollisionDetection.ActivCollisionDetection.UpdateGrids(this); collisions = CollisionDetection.ActivCollisionDetection.CheckCollision(this); } else { collisions = new List <CollidAble>(); collisions.Add(collidable); } if (OnCollisionExit != null || OnTriggerExit != null) { for (int i = 0; i < previouseCollisions.Length; i++) { if (!collisions.Contains(previouseCollisions[i])) { if (blocking && previouseCollisions[i].blocking) { OnCollisionExit?.Invoke(previouseCollisions[i], new CollisionArgs(previouseCollisions[i])); if (!triggered) { collisions[i].DoCollisionCheck(true, this); } } else { OnTriggerExit?.Invoke(previouseCollisions[i], new CollisionArgs(previouseCollisions[i])); if (!triggered) { collisions[i].DoCollisionCheck(true, this); } } } else { alreadyExists.Add(i); } } } for (int i = 0; i < collisions.Count; i++) { if (!alreadyExists.Contains(i)) { if (blocking && collisions[i].blocking) { OnCollisionEnter?.Invoke(collisions[i], new CollisionArgs(collisions[i])); if (!triggered) { collisions[i].DoCollisionCheck(true, this); } } else { OnTriggerEnter?.Invoke(collisions[i], new CollisionArgs(collisions[i])); if (!triggered) { collisions[i].DoCollisionCheck(true, this); } } } else { if (blocking && collisions[i].blocking) { OnCollision?.Invoke(collisions[i], new CollisionArgs(collisions[i])); if (!triggered) { collisions[i].DoCollisionCheck(true, this); } } else { OnTrigger?.Invoke(collisions[i], new CollisionArgs(collisions[i])); if (!triggered) { collisions[i].DoCollisionCheck(true, this); } } } } } }
private void OnTriggerEnter2D(Collider2D col) { OnTriggerEnter?.Invoke(col); }
public void TriggerEnter(ChunkLinker.Chunk chunk) { Debug.Log("[ENTER] " + chunk.Description); OnTriggerEnter?.Invoke(chunk); }
public void FireEventEnter(Rigidbody other) => OnTriggerEnter?.Invoke(other);
protected override void OnEnter(T component) => OnTriggerEnter?.Invoke();
public static void TriggerEnter(BC_TriggerData data) { //DebugManager.LogToFile("[OnTriggerEnter] " + data.collider.name + " entered collision with " + data.myCollider.name); OnTriggerEnter?.Invoke(data); }