internal void Destroy() { bool flag = this.Shape.ShapeType == ShapeType.Polygon; if (flag) { ((PolygonShape)this.Shape).Vertices.AttachedToBody = false; } Debug.Assert(this.ProxyCount == 0); this.Proxies = null; this.Shape = null; this.UserData = null; this.BeforeCollision = null; this.OnCollision = null; this.OnSeparation = null; this.AfterCollision = null; bool flag2 = this.Body._world.FixtureRemoved != null; if (flag2) { this.Body._world.FixtureRemoved(this); } this.Body._world.FixtureAdded = null; this.Body._world.FixtureRemoved = null; this.OnSeparation = null; this.OnCollision = null; }
internal void Destroy() { // The proxies must be destroyed before calling this. Debug.Assert(ProxyCount == 0); // Free the proxy array. Proxies = null; Shape = null; BeforeCollision = null; OnCollision = null; OnSeparation = null; AfterCollision = null; if (Body.World.FixtureRemoved != null) { Body.World.FixtureRemoved(this); } //GW: Wtf were this 2 lines present? FixtureAdded is a global callback //Body.World.FixtureAdded = null; //Body.World.FixtureRemoved = null; OnSeparation = null; OnCollision = null; }
internal void Destroy() { #if DEBUG if (ShapeType == ShapeType.Polygon) { ((PolygonShape)Shape).Vertices.AttachedToBody = false; } #endif // The proxies must be destroyed before calling this. Debug.Assert(ProxyCount == 0); // Free the proxy array. Proxies = null; Shape = null; //FPE: We set the userdata to null here to help prevent bugs related to stale references in GC UserData = null; BeforeCollision = null; OnCollision = null; OnSeparation = null; AfterCollision = null; if (Body.World.FixtureRemoved != null) { Body.World.FixtureRemoved(this); } Body.World.FixtureAdded = null; Body.World.FixtureRemoved = null; OnSeparation = null; OnCollision = null; }
internal void destroy() { #if DEBUG if (shape.shapeType == ShapeType.Polygon) { ((PolygonShape)shape).vertices.attachedToBody = false; } #endif // The proxies must be destroyed before calling this. Debug.Assert(proxyCount == 0); // Free the proxy array. proxies = null; shape = null; //FPE: We set the userdata to null here to help prevent bugs related to stale references in GC userData = null; beforeCollision = null; onCollision = null; onSeparation = null; afterCollision = null; if (body._world.onFixtureRemoved != null) { body._world.onFixtureRemoved(this); } body._world.onFixtureAdded = null; body._world.onFixtureRemoved = null; onSeparation = null; onCollision = null; }
public BodyConstructor WithOnSeparation(string fixtureName, OnSeparationEventHandler handler) { if (fixtureBuilderData.ContainsKey(fixtureName)) { var newData = new FixtureData { OnSeparation = handler }; fixtureBuilderData.Add(fixtureName, newData); } else { fixtureBuilderData[fixtureName].OnSeparation = handler; } return(this); }
protected override void Recycle(bool isReleasing) { if (isReleasing) { BroadphaseProxy.Recycle(); } WorldTransform = Matrix3.Identity; RemoveNextUpdate = false; Owner = null; Shape = null; BeforeCollision = null; OnCollision = null; AfterCollision = null; OnSeparation = null; base.Recycle(isReleasing); }
internal void Destroy() { // The proxies must be destroyed before calling this. Debug.Assert(ProxyCount == 0); // Free the proxy array. Proxies = null; Shape = null; BeforeCollision = null; OnCollision = null; OnSeparation = null; AfterCollision = null; if (Body.World.FixtureRemoved != null) { Body.World.FixtureRemoved(this); } }
public CursorModel(ContentManager content, World world, GamepadController pad, SmashBros.Controllers.GamepadController.NavigationKey navigationMethod, OnCollisionEventHandler col, OnSeparationEventHandler sep,bool enabled = false) { Cursor = new Sprite(content, "Cursors/Player" + pad.PlayerIndex, 70, 70, 280 * pad.PlayerIndex + 100, 680); Cursor.BoundRect(world, 5, 5, BodyType.Dynamic); Cursor.StaticPosition = true; Cursor.Category = Category.Cat4; Cursor.CollidesWith = Category.Cat5; Cursor.Layer = 1002; Cursor.Mass = 1; Cursor.UserData = pad.PlayerIndex; Cursor.BoundBox.IgnoreGravity = true; Cursor.Origin = new Vector2(50, 20); this.Pad = pad; this.Navigation = navigationMethod; this.OnCollision = col; this.OnSeparation = sep; this.Enabled = enabled; }
public CursorModel(ContentManager content, World world, GamepadController pad, SmashBros.Controllers.GamepadController.NavigationKey navigationMethod, OnCollisionEventHandler col, OnSeparationEventHandler sep, bool enabled = false) { Cursor = new Sprite(content, "Cursors/Player" + pad.PlayerIndex, 70, 70, 280 * pad.PlayerIndex + 100, 680); Cursor.BoundRect(world, 5, 5, BodyType.Dynamic); Cursor.StaticPosition = true; Cursor.Category = Category.Cat4; Cursor.CollidesWith = Category.Cat5; Cursor.Layer = 1002; Cursor.Mass = 1; Cursor.UserData = pad.PlayerIndex; Cursor.BoundBox.IgnoreGravity = true; Cursor.Origin = new Vector2(50, 20); this.Pad = pad; this.Navigation = navigationMethod; this.OnCollision = col; this.OnSeparation = sep; this.Enabled = enabled; }
public BodyConstructor WithOnSeparation(OnSeparationEventHandler handler) { anonymousFixtureData.OnSeparation = handler; return(this); }
protected override void Recycle(bool isReleasing) { if (isReleasing) BroadphaseProxy.Recycle(); WorldTransform = Matrix3.Identity; RemoveNextUpdate = false; Owner = null; Shape = null; BeforeCollision = null; OnCollision = null; AfterCollision = null; OnSeparation = null; base.Recycle(isReleasing); }
internal void Destroy() { // The proxies must be destroyed before calling this. Debug.Assert(ProxyCount == 0); // Free the proxy array. Proxies = null; Shape = null; BeforeCollision = null; OnCollision = null; OnSeparation = null; AfterCollision = null; if (Body.World.FixtureRemoved != null) { Body.World.FixtureRemoved(this); } Body.World.FixtureAdded = null; Body.World.FixtureRemoved = null; OnSeparation = null; OnCollision = null; }
private void Spawn(Utility.Timer timer) { if (nextPiece == null) { nextPiece = getRandomTetrisPiece(); } currentPiece = nextPiece; currentPieceMaxLen = Math.Max(currentPiece.shape.GetLength(0), currentPiece.shape.GetLength(1)); currentPiece.body.Position = getSpawnPosition(); currentPieceCollide = new OnCollisionEventHandler(currentPieceCollision); currentPieceSeparate = new OnSeparationEventHandler(currentPieceSeparation); currentPiece.body.OnCollision += currentPieceCollide; currentPiece.body.OnSeparation += currentPieceSeparate; currentPieceRotation = JointFactory.CreateFixedAngleJoint(_world, currentPiece.body); pieces.Add(currentPiece); activePieces.Add(currentPiece); currentCheat = null; --countdownToCheat; if (countdownToCheat < 0) { currentCheat = new TetrisPiece(_world, tetrisTextures[2], tetrisShapes[2], currentPiece.body.WorldCenter + new Vector2(1, -2)); currentCheat.body.FixedRotation = true; currentCheat.body.Rotation = (float)Math.PI / 2; currentCheat.body.OnCollision += currentPieceCollide; currentCheat.body.OnSeparation += currentPieceSeparate; JointFactory.CreateRevoluteJoint(_world, currentCheat.body, currentPiece.body, currentPiece.body.LocalCenter); pieces.Add(currentCheat); activePieces.Add(currentCheat); countdownToCheat = 5; } currentPiece.body.Enabled = true; if(currentCheat!=null) currentCheat.body.Enabled = true; nextPiece = getRandomTetrisPiece(); //Debug.Print("Spawn new tetris piece at: {0}, {1}", currentPiece.body.Position.X, currentPiece.body.Position.Y); }
public void AddSeparationHandler(OnSeparationEventHandler eventHandler) { m_body.OnSeparation += eventHandler; }
internal void Destroy() { #if DEBUG if (ShapeType == ShapeType.Polygon) ((PolygonShape)Shape).Vertices.AttachedToBody = false; #endif // The proxies must be destroyed before calling this. Debug.Assert(ProxyCount == 0); // Free the proxy array. Proxies = null; Shape = null; //FPE: We set the userdata to null here to help prevent bugs related to stale references in GC UserData = null; BeforeCollision = null; OnCollision = null; OnSeparation = null; AfterCollision = null; if (Body.World.FixtureRemoved != null) { Body.World.FixtureRemoved(this); } Body.World.FixtureAdded = null; Body.World.FixtureRemoved = null; OnSeparation = null; OnCollision = null; }
public BodyConstructor WithOnSeparation(string fixtureName, OnSeparationEventHandler handler) { if (fixtureBuilderData.ContainsKey(fixtureName)) { var newData = new FixtureData { OnSeparation = handler }; fixtureBuilderData.Add(fixtureName, newData); } else fixtureBuilderData[fixtureName].OnSeparation = handler; return this; }
public BodyConstructor WithOnSeparation(OnSeparationEventHandler handler) { anonymousFixtureData.OnSeparation = handler; return this; }