示例#1
0
        public void Update(GameTime time)
        {
            if (Visible)
            {
                Vector2 pos    = experienceBar.Position;
                Vector2 center = new Vector2(pos.X + (experienceBar.cage.Width / 2), pos.Y + (experienceBar.cage.Height / 2));
                Angle = Math.Atan2(center.Y - Position.Y, center.X - Position.X);

                Position.X += (moveSpeed * Settings.gameSpeed) * (float)Math.Cos(Angle);
                Position.Y += (moveSpeed * Settings.gameSpeed) * (float)Math.Sin(Angle);

                Rectangle cage    = experienceBar.GetBoundingBox();
                Rectangle orbRect = GetBoundingBox();
                if (cage.Intersects(orbRect))
                {
#if DEBUG
                    Debugger.Log(1, "Main", string.Format("XPBar gained {0} experience points.\n", strength));
#endif
                    Visible = false;
                    Play();
                    yat.ExperiencePoints += strength;
                }
            }
        }