Esempio n. 1
0
        public static LevelCreatorEditor.CreateShape draw_first_point(bool force_quit = false)
        {
            if (force_quit)
            {
                return(escape());
            }
            // MouseDown 1: create first corner of a shape
            if (Event.current.type == EventType.MouseDown && Event.current.button == 0)
            {
                temporary_arc = ArcBuilder.arc_builder(LevelCreatorEditor.get_mouse_position(), LevelCreatorEditor.is_field, LevelCreatorEditor.allow_self_intersections);
                return(draw_tangent);
            }

            return(draw_first_point);
        }
        /// <summary>
        /// Mutator - MouseDown creates equilateral shape with center at mouse position
        /// </summary>
        /// <returns>The next mode for the state machine.</returns>
        public static LevelCreatorEditor.CreateShape draw_center(bool force_quit = false)
        {
            if (force_quit)
            {
                return(escape());
            }
            // MouseDown: create center of equilateral shape
            if (Event.current.type == EventType.MouseDown && Event.current.button == 0)
            {
                builder = EquilateralBuilder.equilateral_builder(LevelCreatorEditor.get_mouse_position(), LevelCreatorEditor.edges);
                return(draw_equilateral);
            }

            return(draw_center);
        }
Esempio n. 3
0
        /// <summary>
        /// Mutator - MouseDown creates point at position
        /// </summary>
        /// <returns>The next mode for the state machine.</returns>
        private static LevelCreatorEditor.CreateShape draw_nth_point(bool force_quit = false)
        {
            if (force_quit)
            {
                return(escape());
            }
            temporary_arc.data.receive_vector(LevelCreatorEditor.get_mouse_position());

            // MouseDown 2-n: create arc through point using last right-hand-side slope
            if (Event.current.type == EventType.MouseDown && Event.current.button == 0)
            {
                if (temporary_arc.data.valid())
                {
                    temporary_arc.data.next();
                    return(draw_tangent);
                }
            }
            return(draw_nth_point);
        }
        /// <summary>
        /// Mutator - MouseDown finalizes equilateral shape.
        /// </summary>
        /// <returns>The next mode for the state machine.</returns>
        public static LevelCreatorEditor.CreateShape draw_equilateral(bool force_quit = false)
        {
            if (force_quit)
            {
                return(escape());
            }

            builder.data.set_edge(LevelCreatorEditor.get_mouse_position());

            // MouseUp: create first vertex of equilateral shape
            if (Event.current.type == EventType.MouseUp && Event.current.button == 0)
            {
                builder.data.close_shape();
                builder = new optional <EquilateralBuilder>();
                return(draw_center);
            }

            return(draw_equilateral);
        }