public override void Update(GameTime gameTime) { if (firstTime) { StaticData.EngineManager.CollisionManagerEngine.AddRigidWithNonCollidableRigids(this, StaticData.EngineManager.CookieRB); firstTime = false; } if (CanCatchCookie) { if (base.IsClicked && StaticData.GameSessionMode == SessionMode.DesignMode && StaticData.ManipulationGameMode == ManipulationGameMode.ChangingCompsDirection) { // Change the direction if ((int)this.Dir < 7) { UpdateDirection((Direction)((int)this.Dir + 1)); } else { this.Dir = Direction.East; UpdateDirection((Direction)((int)this.Dir)); } } if (StaticData.GameSessionMode == SessionMode.PlayingMode) { if (!IsCookieCatched && !IsActivated) { // Is the cookie near? if (RigidsHelperModule.IsCloseEnough(StaticData.EngineManager.CookieRB, this, StaticData.RocketCarrierCloseArea)) { if (!IsCookieAttachedToRope()) { this.IsCookieCatched = true; this.IsActivated = true; StaticData.EngineManager.RocketsCarrierManagerEngine.SetRocketNew(this); this._particleEngine.MaxParticles = 4; } } } if (IsCookieCatched) { if (!CookieCollidedWithBump()) { StaticData.EngineManager.CookieRB.PositionXNA = this.PositionXNACenter - StaticData.EngineManager.CookieRB.getHalfSize(); } else { this.CanCatchCookie = false; } if (IsClicked) { this.CanCatchCookie = false; var c = StaticData.EngineManager.CookieRB; c.SetLastFrameAccelaration(Vector3.Zero); c.SetInitTorque(0); c.SetOrientation(0); c.SetVelocity(Vector3.Zero); c.AddForce(new Vector3(0, 3000, 0)); //Vector3 force = GetForceVector(this.Dir); //StaticData.EngineManager.CookieRB.AddForce(new Vector3(force.X * 10, 0, 0)); } } } } if (IsActivated && StaticData.GameSessionMode == SessionMode.PlayingMode) { this.AddForce(GetForceVector(this.Dir)); } _particleEngine.EmitterLocation = new Vector2(this.PositionXNACenter.X, this.PositionXNA.Y + this.HalfSize.Y); _particleEngine.Update(VelocityVec); base.Update(gameTime); }
public void Update(GameTime gameTime) { this.AddForce(ForceThrottle); _particleEngine.EmitterLocation = new Vector2(this.PositionXNA.X, this.PositionXNA.Y) + new Vector2(10, 0); _particleEngine.Update(StaticData.BasicParticleVelocity); }