public override void OnCollisionBefore(ContactPoint point) { base.OnCollisionBefore(point); if (point.OppositeShape.FilterData.GroupIndex == ContactGroupIndex.Monster) { if (point.OppositeShape.GetBody().GetUserData() is BaseGameObject gameObject) { gameObject.IsDead = true; JumpAfterKillMonster(); } } }
public override void OnCollisionBefore(ContactPoint point) { base.OnCollisionBefore(point); if ( point.OppositeShape.GetBody().GetUserData() is TileObject tileObject && tileObject.TileGroupName == TileGroupName.Collision && point.Normal == new Vec2(IsSeeingLeft ? -1 : 1, 0) ) { IsSeeingLeft = !IsSeeingLeft; _velocityX = 0; } if ( point.MyShape != _hitSensorShape && point.OppositeShape.GetBody().GetUserData() is Character character ) { character.OnHit(); } }