public override void WakeUp() { base.WakeUp(); //AddGameObject(new Grave(mPhysicsWorld, new Vector2(0, 0))); for (int y = 0; y < 16; ++y) { for (int x = 0; x < 16; ++x) { if (graveyardMap[y, x] == 1) { Grave grave = new Grave( mPhysicsWorld, new Vector2(x - 8, y - 8) * 50 * Camera.kPixelsToUnits, new Vector2(x, y)); grave.mDeathWorld = this; AddGameObject(grave); } } } // for now set countdown timer to 10 seconds mCountdownTimer = 2f * (float)Math.Log(mScore, 2); // clear the score mScore = 0; // initialize state to first mState = DeathWorldStates.DWS_MAIN; }
public virtual void Update(GameTime gameTime) { base.Update(gameTime); mCountdownTimer -= (float)gameTime.ElapsedGameTime.TotalSeconds; switch (mState) { case DeathWorldStates.DWS_MAIN: if (mCountdownTimer < 0) { // go to coalesce phase mState = DeathWorldStates.DWS_WRAPUP; // three seconds should be safe, right? mCountdownTimer = 3.0f; //mPlayer.Disable(); mPlayer.mControllable = false; } break; case DeathWorldStates.DWS_WRAPUP: // collect all the souls foreach (GameObject go in mGameObjects) { if (go is Soul) { float k = 0.99f; float weight = (float)Math.Pow(1f - k, (float)gameTime.ElapsedGameTime.TotalSeconds); //0.9f; go.SetPosition(weight * go.GetPosition() + (1f - weight) * mPlayer.GetPosition()); } } // when you're done, transition out if (mCountdownTimer < 0) { // go to coalesce phase Game1.mDesiredWorld = Game1.mLifeWorld; } break; } }