Example #1
0
 public void CopySettings(FillMode?fillMode     = null, float?stroke      = null,
                          StrokeMode?strokeMode = null, LineDraw?lineDraw = null, SideDraw?sideDraw = null, bool?boundngBox = null)
 {
     if (fillMode != null)
     {
         FillMode = fillMode.Value;
     }
     if (stroke != null)
     {
         Stroke = stroke.Value;
     }
     if (strokeMode != null)
     {
         StrokeMode = strokeMode.Value;
     }
     if (lineDraw != null)
     {
         LineDraw = lineDraw.Value;
     }
     if (sideDraw != null)
     {
         SideDraw = sideDraw.Value;
     }
     if (boundngBox != null)
     {
         DrawBoundingBox = boundngBox.Value;
     }
 }
Example #2
0
    private void Update()
    {
        if (Pause.isPaused == true || camScript_.transition == true)
        {
            return;
        }

        if (StrokeMode_ == StrokeMode.AIMING)
        {
            if (Input.GetMouseButtonDown(0))  //add check for range
            {
                //Cursor.visible = false;
                CircleDrawer_.SetCircle(3, 0);
                DragVector_.startPoint_ = DragVector_.getScreenPosOfMouse();
                charging_ = true;
            }
            if (Input.GetMouseButton(0) && charging_ == true)
            {
                DragVector_.endPoint_ = DragVector_.getScreenPosOfMouse();
                ArrowDrawer_.RenderLine(playerBallRB_.transform.position, DragVector_.secondArrowPos(), playerBallRB_.transform.position.y);
            }
            if (Input.GetMouseButtonUp(0) && charging_ == true)
            {
                parScript_.AddPutt();
                ArrowDrawer_.EndLine();
                DragVector_.endPoint_ = DragVector_.getScreenPosOfMouse();

                StrokeMode_ = StrokeMode.DO_WHACK;
                CircleDrawer_.TurnOff();
                Cursor.visible = true;
                charging_      = false;
            }
        }
    }
Example #3
0
    void FixedUpdate()
    {
        if (playerBallRB_ == null)
        {
            return;
        }

        if (StrokeMode_ == StrokeMode.ROLLING)
        {
            cutoff();
            CheckRollingStatus();
            if (playerBallRB_.velocity.y <= -0.2f)
            {
                slideDown();
            }
            else if (playerBallRB_.velocity.y > 0.2f)
            {
                slideUp();
            }
            return;
        }

        if (StrokeMode_ != StrokeMode.DO_WHACK)
        {
            return;
        }
        smackSound_.ShotSound();
        playerBallRB_.AddForce(DragVector_.calculateDragDirection() * DragVector_.getForceOfDrag(), ForceMode.Impulse);

        StrokeMode_ = StrokeMode.ROLLING;
    }
Example #4
0
        public virtual void CopyFrom <T>(T settings) where T : IPoint
        {
            X = (settings).X;
            Y = (settings).Y;

            if (settings is IDrawInfo)
            {
                DrawnArea = (settings as IDrawInfo).DrawnArea;
            }

            if (settings is IDrawInfo2)
            {
                var drawSettings = settings as IDrawInfo2;
                FillMode        = drawSettings.FillMode;
                StrokeMode      = drawSettings.StrokeMode;
                Stroke          = drawSettings.Stroke;
                LineDraw        = drawSettings.LineDraw;
                SideDraw        = drawSettings.SideDraw;
                DrawBoundingBox = drawSettings.DrawBoundingBox;
            }
            if (settings is IDrawInfo3)
            {
                var shapeInfo = settings as IDrawInfo3;
                Reader = shapeInfo.Reader;
                Writer = shapeInfo.Writer;
            }
        }
Example #5
0
    void FixedUpdate()
    {
        if (playerBallRB_ == null)
        {
            return;
        }

        if (StrokeMode_ == StrokeMode.ROLLING)
        {
            CheckRollingStatus();
            return;
        }

        if (StrokeMode_ != StrokeMode.DO_WHACK)
        {
            return;
        }

        Debug.Log("Whacking it!");
        Vector3 forceVec = new Vector3(0, 0, strokeForce_);

        playerBallRB_.AddForce(Quaternion.Euler(0, strokeAngle_, 0) * forceVec, ForceMode.Impulse);

        StrokeMode_ = StrokeMode.ROLLING;
    }
Example #6
0
 void CheckRollingStatus()
 {
     if (playerBallRB_.IsSleeping())
     {
         StrokeMode_ = StrokeMode.AIMING;
     }
 }
Example #7
0
            public Curve( ICurve curve,  float stroke,  StrokeMode mode,  FillMode fill,  bool assignID = true): this()
            {
                Geometry.GetStrokeAreas(curve.Data.X, curve.Data.Y, curve.Data.Width, curve.Data.Height, out IRectangleF o, out IRectangleF i, stroke, mode);

                PointF cpt = default(PointF), cptc = default(PointF);

                if (!(curve).Full)
                {
                    IEnumerable<PointF> source = curve.PieTriangle;

                    var Pair = source.StrokePoints("Trapezoid", stroke, mode);
                    IList<PointF> main = Pair.Item1, child = Pair.Item2;
                    if (curve.Type.CrossStroke())
                        MathHelper.Swap(ref main, ref child);

                    cpt = curve.Name == "Pie" ? main[0] :  default(PointF);
                    cptc = curve.Name == "Pie" ? child[0] : default(PointF);
                }

                if (fill == FillMode.Outer)
                    Initialize(curve, o, assignID, cpt);

                else if (fill == FillMode.Inner)
                    Initialize(curve, i, assignID, cptc);
                else
                {
                    var curve2 = new Curve();
                    curve2.Initialize(curve, i, assignID, cptc);
                    Initialize(curve, o, assignID, cpt, curve2);
                }
            }
Example #8
0
        public void UpdateStroke()
        {
            StrokeMode newMode = StrokeMode.STROKE_NORMAL;

            if (m_isSelected || m_isMouseHover)
            {
                newMode = StrokeMode.STROKE_SELECTED;
            }
            else if (m_isCandidate)
            {
                newMode = StrokeMode.STROKE_CANDIDATE;
            }
            else
            {
                newMode = StrokeMode.STROKE_NORMAL;
            }

            if (newMode != m_strokeMode)
            {
                m_strokeMode = newMode;

                this.Dispatcher.BeginInvoke((ThreadStart) delegate
                {
                    switch (m_strokeMode)
                    {
                    case StrokeMode.STROKE_SELECTED:
                        StrokeThickness = 5.5;
                        this.Stroke     = new SolidColorBrush(Color.FromRgb(255, 157, 38));
                        Canvas.SetZIndex(this, -1);
                        break;

                    case StrokeMode.STROKE_CANDIDATE:
                        StrokeThickness = 5.5;
                        this.Stroke     = new SolidColorBrush(Color.FromArgb(255, 169, 111, 42));
                        Canvas.SetZIndex(this, m_schemeColorList.Count > 0 ? -2 : -3);
                        break;

                    case StrokeMode.STROKE_NORMAL:
                    default:
                        StrokeThickness = 2.0;
                        this.Stroke     = new SolidColorBrush(Color.FromArgb(100, 150, 150, 150));
                        int zIdx        = -6;
                        if (m_orderData != null)
                        {
                            zIdx = -4;
                        }
                        else if (m_schemeColorList.Count > 0)
                        {
                            zIdx = -5;
                        }
                        Canvas.SetZIndex(this, zIdx);
                        break;
                    }
                });
            }
        }
Example #9
0
 void CheckRollingStatus()
 {
     if (playerBallRB_.IsSleeping())
     {
         StrokeMode_ = StrokeMode.AIMING;
         CircleDrawer_.SetCircle(2, 0.2f);
         playerBallRB_.drag        = 0.5f;
         playerBallRB_.angularDrag = 0.05f;
     }
 }
Example #10
0
 public virtual void Flush()
 {
     X               = Y = 0;
     FillMode        = FillMode.Original;
     StrokeMode      = StrokeMode.Middle;
     Stroke          = 0;
     LineDraw        = LineDraw.AA;
     SideDraw        = SideDraw.All;
     DrawBoundingBox = false;
 }
Example #11
0
    public void Putt(Vector3 dir)
    {
        currentSlowTimer          = 0;
        playerBallRB_.drag        = 0.5f;
        playerBallRB_.angularDrag = 0.05f;
        playerBallRB_.velocity    = Vector3.zero;
        playerBallRB_.AddForce(dir, ForceMode.Impulse);
        ArrowDrawer_.EndLine();
        CircleDrawer_.TurnOff();
        Cursor.visible = true;
        charging_      = false;

        StrokeMode_ = StrokeMode.ROLLING;
    }
Example #12
0
 private void Update()
 {
     if (StrokeMode_ == StrokeMode.AIMING)
     {
         if (Input.GetMouseButtonDown(0))
         {
             getScreenPosOfClick();
         }
         if (Input.GetMouseButtonDown(0))
         {
             StrokeMode_ = StrokeMode.DO_WHACK;
         }
     }
 }
Example #13
0
        public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            double     radius = (double)values[0];
            double     stroke = (double)values[1];
            StrokeMode mode   = (StrokeMode)values[2];

            switch (mode)
            {
            case StrokeMode.Inside:
                return(radius - stroke);

            case StrokeMode.Outside:
                return(radius);

            default:
                return(radius - stroke / 2);
            }
        }
Example #14
0
 public virtual ICurve newCurve(ICurve curve, float stroke, StrokeMode mode, FillMode fill, bool assignID = true) =>
 new Curve(curve, stroke, mode, fill, assignID);