Ejemplo n.º 1
0
        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;
            }
        }