public virtual void OnRemovalFromSpace(ISpace oldSpace) { oldSpace.Remove(PhysicsObject); if (baseJoint != null) { oldSpace.Remove(baseJoint); } }
public override void OnRemovalFromSpace(ISpace oldSpace) { //Remove any supplements from the space too. oldSpace.Remove(Body); oldSpace.Remove(HorizontalMotionConstraint); oldSpace.Remove(VerticalMotionConstraint); //This character controller requires the standard implementation of Space. ((Space)oldSpace).BoundingBoxUpdater.Finishing -= ExpandBoundingBox; SupportFinder.ClearSupportData(); Body.AngularVelocity = new Vector3(); Body.LinearVelocity = new Vector3(); }
/// <summary> /// Sets up the vehicle's information when being added to the space. /// Called automatically when the space adds the vehicle. /// </summary> public override void OnRemovalFromSpace(ISpace oldSpace) { foreach (Wheel wheel in Wheels) { wheel.OnRemovalFromSpace(oldSpace); } oldSpace.Remove(Body); }
public override void OnRemovalFromSpace(ISpace oldSpace) { //Remove any supplements from the space too. oldSpace.Remove(Body); //This character controller requires the standard implementation of Space. ((Space)oldSpace).BoundingBoxUpdater.Finishing -= ExpandBoundingBox; support = null; supportData = new RayHit(); hasTraction = false; Body.AngularVelocity = new Vector3(); Body.LinearVelocity = new Vector3(); }
protected override void UpdateStage() { SpaceObjectChange change; while (objectsToChange.TryDequeueFirst(out change)) { if (change.ShouldAdd) { space.Add(change.SpaceObject); } else { space.Remove(change.SpaceObject); } } }
/// <summary> /// Binds scene added/removed events to the drawing context. /// </summary> private static void BindSpace(Scene scene, ISpace space) { scene.AddedToScene += (value) => { var spaceObject = value as ISpaceObject; if (spaceObject != null) { space.Add(spaceObject); } }; scene.RemovedFromScene += (value) => { var spaceObject = value as ISpaceObject; if (spaceObject != null) { space.Remove(spaceObject); } }; scene.Traverse <ISpaceObject>(spaceObject => { space.Add(spaceObject); return(TraverseOptions.Continue); }); }
internal void OnRemovalFromSpace(ISpace space) { space.Remove(shape.detector); shape.OnRemovalFromSpace(space); }
/// <summary> /// Removes the motors from the space. Called automatically. /// </summary> public override void OnRemovalFromSpace(ISpace oldSpace) { oldSpace.Remove(LinearMotor); }
public void OnRemovalFromSpace(ISpace oldSpace) { oldSpace.Remove(Model); oldSpace.Remove(joint); Model.Ent.CollisionInformation.Events.PairTouching -= onCollision; }
/// <summary> /// Adds the BeltPiece to an ISpace. /// </summary> /// <param name="oldSpace"></param> public void OnRemovalFromSpace(ISpace oldSpace) { foreach(BaseModel m in models.Union(tubes)) oldSpace.Remove(m); }
/// <summary> /// Updates state /// </summary> /// <param name="gameTime"></param> public override void Update(GameTime gameTime) { base.Update(gameTime); // Check if ball has fallen down. In this case make it inactive. foreach (Ball ball in balls) { ball.Update(gameTime); if (ball.Active == true && ball.Entity.Position.Y < -20.0f) { ball.Entity.BecomeKinematic(); ball.Entity.LinearVelocity = Vector3.Zero; ball.Entity.LinearMomentum = Vector3.Zero; ball.Entity.AngularVelocity = Vector3.Zero; ball.Entity.AngularMomentum = Vector3.Zero; ball.Entity.Position = Position; ISpace space = (ISpace)Game.Services.GetService(typeof(ISpace)); space.Remove(ball.Entity); ball.Active = false; if (ball == pBall) { lastPosition = Position; distance = 0; } } } // Check if it is time to place new ball to the platform if (timeExpired == false) { timePassed += (float)gameTime.ElapsedGameTime.TotalMilliseconds; if (timePassed > 750.0f) { timeExpired = true; timePassed = 0.0f; } } else { // Time expired but we still don't have ball on the platform. if (currentBall == null) { // Find first unused ball. Ball unusedBall = null; foreach (Ball ball in balls) { if (ball.Active == false) { unusedBall = ball; break; } } // If some unused ball exists, place it to the platform. if (unusedBall != null) { currentBall = unusedBall; currentBall.Active = true; } } } //// //float pPeriod = 0.05f; //Vector3 ballPos = pBall.Entity.Position; //distance += (ballPos - lastPosition).Length(); //lastPosition = ballPos; //while (distance >= pPeriod) //{ // psystem.AddParticle(ballPos, 1000); // distance -= pPeriod; //} //for (int n = 0; n < 2; n++ ) // psystem.Update(gameTime); }
public virtual void OnRemovalFromSpace(ISpace s) { foreach(BaseModel m in modelList) if(m.Ent.Space == s) s.Remove(m); foreach(Tube t in tubeList) if(t.Ent.Space == s) s.Remove(t); foreach(Button b in inputs.FindAll(v => { return v is Button; })) { RenderingDevice.Remove(b.Model); //if(b.Model.Ent.Space == null) // s.Remove(b); } (s as Space).DuringForcesUpdateables.Starting -= updateVelocities; }
void ISpaceObject.OnRemovalFromSpace(ISpace oldSpace) { if(/*Ent != null &&*/ Ent.Space != null) oldSpace.Remove(Ent); //else if(mesh != null) // oldSpace.Remove(mesh); }
/// <summary> /// Updates state /// </summary> /// <param name="gameTime"></param> public override void Update(GameTime gameTime) { base.Update(gameTime); // Check if ball has fallen down. In this case make it inactive. foreach (Ball ball in balls) { ball.Update(gameTime); if (ball.Active == true && ball.Entity.Position.Y < -20.0f) { ball.Entity.BecomeKinematic(); ball.Entity.LinearVelocity = Vector3.Zero; ball.Entity.LinearMomentum = Vector3.Zero; ball.Entity.AngularVelocity = Vector3.Zero; ball.Entity.AngularMomentum = Vector3.Zero; ball.Entity.Position = Position; ISpace space = (ISpace)Game.Services.GetService(typeof(ISpace)); space.Remove(ball.Entity); ball.Active = false; } } // Check if it is time to place new ball to the platform if (timeExpired == false) { timePassed += (float)gameTime.ElapsedGameTime.TotalMilliseconds; if (timePassed > 750.0f) { timeExpired = true; timePassed = 0.0f; } } else { // Time expired but we still don't have ball on the platform. if (currentBall == null) { // Find first unused ball. Ball unusedBall = null; foreach (Ball ball in balls) { if (ball.Active == false) { unusedBall = ball; break; } } // If some unused ball exists, place it to the platform. if (unusedBall != null) { currentBall = unusedBall; currentBall.Active = true; } } } // Update score scale if (scoreScale > 1.0f) { scoreScale -= 0.08f; if (scoreScale < 1.0f) { scoreScale = 1.0f; } } }
void ISpaceObject.OnRemovalFromSpace(ISpace oldSpace) { //oldSpace.Remove(m1); //oldSpace.Remove(m2); if(motor != null) oldSpace.Remove(motor); oldSpace.Remove(Ent); GameManager.Space.DuringForcesUpdateables.Starting -= updateVelocities; }
public void OnRemovalFromSpace(ISpace oldSpace) { foreach(OperationalMachine o in machines) oldSpace.Remove(o); foreach(BaseModel m in models) oldSpace.Remove(m); }