private void OnCollisionEnter(Collision collision) { ListObjectInstance itemInstance = collision.gameObject.GetComponent <ListObjectInstance>(); if (itemInstance != null) { if (onCollisionContact != null) { onCollisionContact.Invoke(itemInstance); } } }
private void OnTriggerEnter(Collider other) { ListObjectInstance itemInstance = other.gameObject.GetComponent <ListObjectInstance>(); if (itemInstance != null) { if (onTriggerContact != null) { onTriggerContact.Invoke(itemInstance); } } }
private bool OnSensorCollision(Fixture fixtureA, Fixture fixtureB, Contact contact) { // we assume that fixtureA is always our self System.Diagnostics.Debug.Assert(fixtureA.Body.UserData == this.Entity); var entity2 = (Entity)fixtureB.Body.UserData; if (currentlyVisibleEntities.ContainsKey(entity2)) { currentlyVisibleEntities[entity2]++; } else { currentlyVisibleEntities.Add(entity2, 1); OnContact?.Invoke(Name, entity2, contact); } return(true); }