private void updateSelectionStats() { if (selected is Sentry) { Sentry s = (Sentry)selected; selectionStats = new string[] { "TYPE: " + Sentry.read(s.getType()), "SPEED: " + s.getSpeed(), "DIRECTION: " + s.interpretDirection(), "SECONDARY TYPE: " + Sentry.read(s.getSecondary()) }; } else if (selected is Platform) { Platform p = (Platform)selected; selectionStats = new string[] { "WIDTH: " + p.getWidth() }; } }
private void hovering() { Point l = mover.getLocation(); bool found = false; HasLocation hovered = null; // Player check if (Math.Abs(l.X - players.ElementAt(0).getLocation().X) <= 10 && Math.Abs(l.Y - players.ElementAt(0).getLocation().Y) <= 10) { found = true; hovered = players.ElementAt(0); } // Platform check for (int i = 0; i < platforms.Count && !found; i++) { Point p = platforms.ElementAt(i).getLocation(); int w = platforms.ElementAt(i).getWidth() / 2; if (Math.Abs(l.X - p.X) < w && Math.Abs(l.Y - p.Y) <= 10) { hovered = platforms.ElementAt(i); found = true; break; } } if (!found) { foreach (Sentry s in sentries) { if (Math.Abs(l.X - s.getLocation().X) <= 10 && Math.Abs(l.Y - s.getLocation().Y) <= 10) { hovered = s; found = true; break; } } } if (found) { if (hovered is Player) { crossHairColor = Color.FromArgb(255, 0, 0); updateSelectionContext( "<Player spawn is linked to starting platform>", new string[0]); } else { crossHairColor = Color.FromArgb(0, 255, 0); selectable = hovered; if (hovered is Sentry) { Sentry s = (Sentry)hovered; updateSelectionContext( "<" + controls[6] + "> to select - SENTRY " + (sentries.IndexOf(s) + 1), new string[] { "TYPE: " + Sentry.read(s.getType()), "SPEED: " + s.getSpeed(), "DIRECTION: " + s.interpretDirection(), "SECONDARY TYPE: " + Sentry.read(s.getSecondary()) }); } if (hovered is Platform) { Platform p = (Platform)hovered; int pIndex = platforms.IndexOf(p); switch (pIndex) { case 0: updateSelectionContext( "<" + controls[6] + "> to select - STARTING PLATFORM", new string[] { "WIDTH: " + p.getWidth() }); break; default: updateSelectionContext( "<" + controls[6] + "> to select - PLATFORM " + (pIndex + 1), new string[] { "WIDTH: " + p.getWidth() }); break; } } } } else { selectable = null; updateSelectionContext(" ", new string[0]); crossHairColor = Color.FromArgb(155, 155, 155); } }