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) { HandleTransparency(gameTime); movementScript.RotationState = camera.RotationState; Interaction = false; actorManager.IntersectsWithCoin(this.CollisionRectangle); actorManager.InteractsWithHiddenWall(this.CollisionRectangle, this); actorManager.IntersectsWithCloneBox(this.CollisionRectangle, this); ManipulateVector(ref velocity, 320.0f, 10f); base.Update(gameTime); if (VCollided) { applyJumpForce = false; } velocity += Gravity; AdjustLocationInMap(); AdjustCamera(); }