public override void Update(GameTime gameTime) { if (playerToRecord.CollisionRectangle.Intersects(this.InteractionRectangle)) { if (IsAlive) { particleManager.AddRecordingParticles(this.WorldCenter, (queueLimit), 2, 2, 80); } Reset(); location = playerToRecord.location; particleManager.AddRecordingParticles(playerToRecord.Center, (queueLimit - Velocities.Count) / 2, 1, 1, 25); return; } else if (!(playerToRecord.CollisionRectangle.Intersects(this.InteractionRectangle)) && HaveToRecord && !IsAlive) { // if (this.location == Vector2.Zero) // location = playerToRecord.location; particleManager.AddRecordingParticles(playerToRecord.Center, (queueLimit - Velocities.Count) / 2, 1, 1, 25); Velocities.Enqueue(playerToRecord.Velocity); interactions.Enqueue(playerToRecord.Interaction); if (!HaveToRecord) { enabled = true; IsAlive = true; } } else if (IsAlive) { if (Velocities.Count > 0) { this.Velocity = Velocities.Dequeue(); particleManager.AddRecordingParticles(this.WorldCenter, (Velocities.Count) / 2, 1, 1, 25); if (interactions.Dequeue()) { Interact(); } } else { particleManager.AddRecordingParticles(this.WorldCenter, (queueLimit), 2, 2, 70); // particleManager.AddRectangleDestructionParticles(this.location, this.frameWidth, this.frameHeight, 1, 1); Destroy = true; } actorManager.IntersectsWithCoin(this.CollisionRectangle); actorManager.InteractsWithHiddenWall(this.CollisionRectangle, this); base.Update(gameTime); AdjustLocationInMap(); //TODO: may not be necessary // if (Collided) // Destroy = true; } }
public override void Update(GameTime gameTime) { movementScript.RotationState = camera.RotationState; Interaction = false; if (movementScript.MoveUp) { velocity += new Vector2(0, -step); movementState = 0; } else if (movementScript.MoveDown) { velocity += new Vector2(0, +step); movementState = 1; } if (movementScript.MoveLeft) { velocity += new Vector2(-step, 0); movementState = 2; } else if (movementScript.MoveRight) { velocity += new Vector2(step, 0); movementState = 3; } //TODO: get input from input configuration if (PuzzleEngineAlpha.Input.InputHandler.IsKeyReleased(Keys.Space)) { Interaction = true; ToggleGate(); } actorManager.IntersectsWithCoin(this.CollisionRectangle); actorManager.InteractsWithHiddenWall(this.CollisionRectangle, this); actorManager.IntersectsWithCloneBox(this.CollisionRectangle, this); ManipulateVector(ref velocity, 240.0f, 10f); base.Update(gameTime); AdjustLocationInMap(); }