예제 #1
0
        //public void Update(MouseControls mc)
        //{
        //    bool dbgtxt = true;
        //    string fnId = FnId(clsName, "Update");
        //    HandleMouseInput(mc);

        //    if (dbgtxt) DbgFuncs.AddStr($"{fnId} launched: {launched}");

        //    if (!launched)
        //    {
        //        if (adjustingPosition)
        //        {
        //            position.Set(mousePos);
        //            startPosition.Set(mousePos);
        //        }
        //        if (adjustingAim) { aimTraj.SetEndPoint(mousePos); }
        //        if (adjustingSpin) { spinTraj.SetEndPoint(mousePos); }

        //        SetInitialTrajectory();
        //        CalculateDriftFactor(aimTraj.Rotation, spinTraj.Rotation);
        //        CalculateInitialDriftPerSecond();
        //    }
        //    ApplyDriftPerSecond(gtimer.TotalSeconds);
        //    if (launched)
        //    {
        //        gtimer.Update();
        //        // 2020-01-01 Going to try applying bounce logic here. Collision is determined in the previous frame currently.
        //        CalculateBounceAngle();
        //        rotation += bounceAngle;
        //        position.X = position.X + speed * Math.Cos(rotation);
        //        position.Y = position.Y + speed * Math.Sin(rotation);
        //        if (bounceAngle != 0)
        //        {
        //            lastBounceAngle = bounceAngle;
        //            bounceAngle = 0;
        //        }
        //    }
        //    MoveCollisionPoints(position.X, position.Y, radius, rotation);
        //    if (dbgtxt && DrawDbgTxt)
        //    {
        //        //gtimer.DbgTxt();
        //        dbgPrintAngle(fnId, "driftFactor", driftFactor);
        //        dbgPrintAngle(fnId, "rotation", rotation);
        //        dbgPrintAngle(fnId, "initialDriftPerSecond", initialDriftPerSecond);
        //        DbgFuncs.AddStr($"{fnId} gtimer.TotalSeconds: {gtimer.TotalSeconds}");
        //        DbgFuncs.AddStr($"{fnId} ~~~~ CHECK FOR BOUNCE DBG LOGIC ~~~");
        //        DbgFuncs.AddStr($"{fnId} shouldBounce: {shouldBounce}");
        //        DbgFuncs.AddStr($"{fnId} firstPointHit (index): {firstPointHit}");
        //        dbgPrintAngle(fnId, "bounceAngle", bounceAngle);
        //        dbgPrintAngle(fnId, "lastBounceAngle", lastBounceAngle);
        //        dbgPrintAngle(fnId, "testBounceAngle", testBounceAngle);

        //        DbgFuncs.AddStr($"{fnId} hz: {hz}");
        //        DbgFuncs.AddStr($"{fnId} lastHz: {lastHz}");


        //        if (firstPointHit > -1)
        //        {
        //            launched = false;
        //            aimTraj.Visible = false;
        //            spinTraj.Visible = false;
        //        }
        //    }
        //}

        new public void Draw(Graphics g)
        {
            base.Draw(g);
            btnLaunch.Draw(g);
            aimTraj.Draw(g);
            spinTraj.Draw(g);
        }
        public void Draw(Graphics g)
        {
            SolidBrush sb = new SolidBrush(color);

            launchButton.Draw(g);
            flightPath.Draw(g, !ballLaunched);  // do not draw flight path is ball is launched
            circ2.Draw(g);

            //dbgDrawBounceAngle(g);
            sb.Dispose();
        }