Esempio n. 1
0
        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() };
            }
        }
Esempio n. 2
0
        public static Color sentryColor(Sentry sentry)
        {
            switch (sentry.getType())
            {
            case Sentry.Type.PUSH:
                return(Color.FromArgb(0, 0, 255));

            case Sentry.Type.SHOVE:
                return(Color.FromArgb(0, 0, 127));

            case Sentry.Type.PULL:
                return(Color.FromArgb(100, 255, 255));

            case Sentry.Type.DROP:
                return(Color.FromArgb(120, 0, 0));

            case Sentry.Type.HORZ_MAGNET:
                return(Color.FromArgb(255, 100, 255));

            case Sentry.Type.GRAV_FLIP:
                return(Color.FromArgb(127, 255, 127));

            case Sentry.Type.GRAV_DOUBLE:
                return(Color.FromArgb(255, 127, 127));

            case Sentry.Type.MOVE:
                return(Color.FromArgb(0, 255, 0));

            case Sentry.Type.DECAY:
                return(Color.FromArgb(255, 255, 0));

            case Sentry.Type.FLEE:
                return(Color.FromArgb(255, 255, 255));

            case Sentry.Type.SPREAD:
                return(Color.FromArgb(0, 151, 151));

            case Sentry.Type.EXPAND:
                return(Color.FromArgb(255, 100, 0));

            case Sentry.Type.SPAWN:
                return(Color.FromArgb(150, 100, 0));

            case Sentry.Type.GRAV_RED:
                return(Color.FromArgb(100, 100, 255));

            case Sentry.Type.GRAV_INC:
                return(Color.FromArgb(255, 255, 127));

            case Sentry.Type.GOD:
                return(Color.FromArgb(150, 0, 150));

            case Sentry.Type.RANDOM:
                return(Color.FromArgb(20, 20, 20));

            case Sentry.Type.NECROMANCER:
                return(Color.FromArgb(160, 160, 160));

            default:
                return(Color.FromArgb(0, 0, 0));
            }
        }
Esempio n. 3
0
        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);
            }
        }