public virtual void StartDeparture() { takeoffState = TakeoffState.Boarding; Game1.playSound("parrot"); foreach (Parrot parrot in parrots) { parrot.squawkTime = 0.25f; } stateTimer = 0.5f; Game1.player.shouldShadowBeOffset = true; xTile.Dimensions.Rectangle viewport = Game1.viewport; StringBuilder event_string2 = new StringBuilder(); Vector2 farmer_position = Game1.player.Position; event_string2.Append("/0 0/farmer " + Game1.player.getTileX() + " " + Game1.player.getTileY() + " " + Game1.player.facingDirection); event_string2.Append("/playerControl parrotRide"); _takeoffEvent = new Event(event_string2.ToString()) { showWorldCharacters = true, showGroundObjects = true }; event_string2 = null; Game1.currentLocation.currentEvent = _takeoffEvent; _takeoffEvent.checkForNextCommand(Game1.player.currentLocation, Game1.currentGameTime); Game1.player.Position = farmer_position; Game1.eventUp = true; Game1.viewport = viewport; foreach (Parrot parrot2 in parrots) { parrot2.height = 21f; parrot2.position = parrot2.anchorPosition; } }
public virtual void Update(GameTime time) { if (takeoffState == TakeoffState.Idle && !Game1.player.IsBusyDoingSomething()) { bool on_activation_tile = new Microsoft.Xna.Framework.Rectangle((int)position.X / 64, (int)position.Y / 64, 3, 1).Contains(Game1.player.getTileLocationPoint()); if (_onActivationTile != on_activation_tile) { _onActivationTile = on_activation_tile; if (_onActivationTile && Game1.netWorldState.Value.ParrotPlatformsUnlocked.Value) { Activate(); } } } shake = Vector2.Zero; if (takeoffState == TakeoffState.Liftoff) { shake.X = Utility.RandomFloat(-0.5f, 0.5f) * 4f; shake.Y = Utility.RandomFloat(-0.5f, 0.5f) * 4f; } if (stateTimer > 0f) { stateTimer -= (float)time.ElapsedGameTime.TotalSeconds; } if (takeoffState == TakeoffState.Boarding && stateTimer <= 0f) { takeoffState = TakeoffState.BeginFlying; Game1.playSound("dwoop"); } if (takeoffState == TakeoffState.BeginFlying && parrots[0].height >= 64f && stateTimer <= 0f) { takeoffState = TakeoffState.Liftoff; stateTimer = 0.5f; Game1.playSound("treethud"); } if (takeoffState == TakeoffState.Liftoff && stateTimer <= 0f) { takeoffState = TakeoffState.Flying; } if (takeoffState >= TakeoffState.Flying && parrots[0].height >= 64f) { height += liftSpeed; liftSpeed += 0.025f; Game1.player.drawOffset.Value = new Vector2(0f, (0f - height) * 4f); if (height >= 128f && takeoffState != TakeoffState.Finished) { takeoffState = TakeoffState.Finished; _takeoffEvent.command_end(Game1.currentLocation, Game1.currentGameTime, new string[0]); _takeoffEvent = null; LocationRequest locationRequest = Game1.getLocationRequest(currentDestination.Value.Key); locationRequest.OnWarp += delegate { takeoffState = TakeoffState.Idle; Game1.player.shouldShadowBeOffset = false; Game1.player.drawOffset.Value = Vector2.Zero; }; Game1.warpFarmer(locationRequest, currentDestination.Value.Value.X, currentDestination.Value.Value.Y, 2); } } foreach (Parrot parrot in parrots) { parrot.Update(time); } }