示例#1
0
            public static Cinematics Calculate(
                double motorAngle,
                double beamX,
                double beamY,
                double beamLength,
                double conrodX,
                double conrodY,
                double conrodLength,
                double rodLength)
            {
                Cinematics result = new Cinematics();

                result.ConrodEndX = conrodX + Math.Cos(motorAngle) * conrodLength;
                result.ConrodEndY = conrodY - Math.Sin(motorAngle) * conrodLength;

                double cx1 = result.ConrodEndX;
                double cy1 = result.ConrodEndY;

                double cx2 = beamX;
                double cy2 = beamY;

                double l1 = rodLength;
                double l2 = beamLength;

                double dx = cx2 - cx1;
                double dy = cy2 - cy1;
                double d  = Math.Sqrt(dx * dx + dy * dy);

                double beta = CalculateAngleInTriangle(l2, l1, d);
                double alfa = Math.Acos(dx / d);

                double gamma = alfa + beta;

                result.BeamEndX = cx1 + Math.Cos(gamma) * l1;
                result.BeamEndY = cy1 - Math.Sin(gamma) * l1;

                double bDy = result.BeamEndY - cy2;

                double sinBeanAngle = bDy / l2;

                result.BeamAngle = Math.Asin(sinBeanAngle);

                return(result);
            }
    public override void OnInspectorGUI()
    {
        Cinematics cinematics = (Cinematics)target;

        DrawDefaultInspector();
        GUILayout.Space(10);
        if (GUILayout.Button("Load Cinematic Characters SLB"))
        {
            cinematics.LoadCinCharSlb();
        }
        if (GUILayout.Button("Load Cinematic Camera SLB (WIP)"))
        {
            cinematics.LoadCinCamSlb();
        }
        GUILayout.Space(10);
        if (GUILayout.Button("Save Cinematic Characters SLB"))
        {
            cinematics.SaveCinCharSlb();
        }
    }
示例#3
0
        protected override void OnRender(DrawingContext context)
        {
            SolidColorBrush fore = new SolidColorBrush(Colors.Black);

            Cinematics state = Cinematics.Calculate(_angleRadians,
                                                    150, 130, 100,
                                                    55, 220, 40,
                                                    90);

            DrawStationaryParts(context, fore);
            DrawСonrod(context, fore, 55, 220, RadiansToDegrees(_angleRadians));
            DrawBeam(context, fore, 150, 130, RadiansToDegrees(state.BeamAngle));

            context.DrawLine(
                new Pen(fore, 3),
                new Point(state.BeamEndX, state.BeamEndY),
                new Point(state.ConrodEndX, state.ConrodEndY));

            //DrawAxis(context, 150, 130);
            //DrawAxis(context, 55, 250);
            //DrawAxis(context, state.ConrodEndX, state.ConrodEndY);
            //DrawAxis(context, state.BeamEndX, state.BeamEndY);
        }
示例#4
0
            public static Cinematics Calculate(
                double motorAngle,
                double beamX,
                double beamY,
                double beamLength,
                double conrodX,
                double conrodY,
                double conrodLength,
                double rodLength)
            {
                Cinematics result = new Cinematics();
                result.ConrodEndX = conrodX + Math.Cos(motorAngle) * conrodLength;
                result.ConrodEndY = conrodY - Math.Sin(motorAngle) * conrodLength;

                double cx1 = result.ConrodEndX;
                double cy1 = result.ConrodEndY;

                double cx2 = beamX;
                double cy2 = beamY;

                double l1 = rodLength;
                double l2 = beamLength;

                double dx = cx2 - cx1;
                double dy = cy2 - cy1;
                double d = Math.Sqrt(dx * dx + dy * dy);

                double beta = CalculateAngleInTriangle(l2, l1, d);
                double alfa = Math.Acos(dx / d);

                double gamma = alfa + beta;

                result.BeamEndX = cx1 + Math.Cos(gamma) * l1;
                result.BeamEndY = cy1 - Math.Sin(gamma) * l1;

                double bDy = result.BeamEndY - cy2;

                double sinBeanAngle = bDy / l2;
                result.BeamAngle = Math.Asin(sinBeanAngle);

                return result;
            }
示例#5
0
 void Start()
 {
     playerHealth = FindObjectOfType<PlayerHealthController> ();
     _camMovement = FindObjectOfType<MainCameraMovement> ();
     _cinematics = FindObjectOfType<Cinematics> ();
 }