Example #1
0
 void CheckJumpAngle()
 {
     //Se space foi apertado AND o player está no chão
     if ((Input.GetKey(KeyCode.Space) && controller.collisions.bellow) || toggleAim)
     {
         jumpDistance = 6f;
         //Desenha a trajetória e não se move.
         if (Input.GetKey(KeyCode.D))
         {
             jumpAngle = jumpAngle + (70 * Time.fixedDeltaTime);
         }
         else if (Input.GetKey(KeyCode.A))
         {
             jumpAngle = jumpAngle - (70 * Time.fixedDeltaTime);
         }
         playerState = State.Aiming;
         animator.SetBool("isAiming", true);
         trajectory.PhysicsData(jumpGravity, standartGravity, timeToJumpPeak);
         trajectory.Draw(jumpAngle, jumpDistance);
     }
     else
     {
         trajectory.DrawPoints.Clear();
     }
 }
Example #2
0
    private void ProcessUpdate()
    {
        if (points.Count > 1)
        {
            ProcessMoving();
            trajectory.Draw(points);
        }

        circle.Draw(points[0]);
    }
Example #3
0
        void OnRenderObject()
        {
            if (Root == null)
            {
                Root = transform;
            }

            UltiDraw.Begin();
            UltiDraw.DrawGUICircle(new Vector2(0.5f, 0.85f), 0.075f, UltiDraw.Black.Transparent(0.5f));
            Quaternion rotation = Quaternion.AngleAxis(-360f * ((PFNN)NN.Model).GetPhase() / (2f * Mathf.PI), Vector3.forward);
            Vector2    a        = rotation * new Vector2(-0.005f, 0f);
            Vector2    b        = rotation * new Vector3(0.005f, 0f);
            Vector3    c        = rotation * new Vector3(0f, 0.075f);

            UltiDraw.DrawGUITriangle(new Vector2(0.5f + b.x / Screen.width * Screen.height, 0.85f + b.y), new Vector2(0.5f + a.x / Screen.width * Screen.height, 0.85f + a.y), new Vector2(0.5f + c.x / Screen.width * Screen.height, 0.85f + c.y), UltiDraw.Cyan);
            UltiDraw.End();

            if (Application.isPlaying)
            {
                UltiDraw.Begin();
                UltiDraw.DrawLine(Trajectory.Points[RootPointIndex].GetPosition(), Trajectory.Points[RootPointIndex].GetPosition() + TargetDirection, 0.05f, 0f, UltiDraw.Red.Transparent(0.75f));
                UltiDraw.DrawLine(Trajectory.Points[RootPointIndex].GetPosition(), Trajectory.Points[RootPointIndex].GetPosition() + TargetVelocity, 0.05f, 0f, UltiDraw.Green.Transparent(0.75f));
                UltiDraw.End();
                Trajectory.Draw(10);
            }

            if (!Application.isPlaying)
            {
                Character.FetchTransformations(Root);
            }
            Character.Draw();

            if (Application.isPlaying)
            {
                UltiDraw.Begin();
                for (int i = 0; i < Joints.Length; i++)
                {
                    Character.Segment segment = Character.FindSegment(Joints[i].name);
                    if (segment != null)
                    {
                        UltiDraw.DrawArrow(
                            Joints[i].position,
                            Joints[i].position + Velocities[i] * 60f,
                            0.75f,
                            0.0075f,
                            0.05f,
                            UltiDraw.Purple.Transparent(0.5f)
                            );
                    }
                }
                UltiDraw.End();
            }
        }
Example #4
0
    public void Rotate(float distance, float angleY)
    {
        var        angleForCalculateToSpeed = _linerDistanceToAngleConverter.StraightPointCalculation(distance, minDistance, maxDistance);
        var        angleCannon    = _linerAngleToAngleConverter.StraightPointCalculation(angleForCalculateToSpeed);
        Quaternion toAngle        = Quaternion.Euler(0, 0, angleForCalculateToSpeed);
        Quaternion newCannonAngle = Quaternion.Euler(0, angleCannon, 0);

        transform.rotation             = Quaternion.Euler(0, angleY, transform.eulerAngles.z);
        transform.rotation             = Quaternion.Slerp(transform.rotation, toAngle, Time.deltaTime * speedRotate);
        cannonCartBarrel.localRotation = Quaternion.Slerp(cannonCartBarrel.localRotation, newCannonAngle, Time.deltaTime * speedRotate);
        _trajectory.Draw(_trajectory.CalculatePoints(transform.up * CalculateVelocity(firingPoint)));
    }
        void OnRenderObject()
        {
            /*
             * UltiDraw.Begin();
             * UltiDraw.DrawGUICircle(new Vector2(0.5f, 0.85f), 0.075f, UltiDraw.Black.Transparent(0.5f));
             * Quaternion rotation = Quaternion.AngleAxis(-360f * NN.GetPhase() / (2f * Mathf.PI), Vector3.forward);
             * Vector2 a = rotation * new Vector2(-0.005f, 0f);
             * Vector2 b = rotation *new Vector3(0.005f, 0f);
             * Vector3 c = rotation * new Vector3(0f, 0.075f);
             * UltiDraw.DrawGUITriangle(new Vector2(0.5f + b.x/Screen.width*Screen.height, 0.85f + b.y), new Vector2(0.5f + a.x/Screen.width*Screen.height, 0.85f + a.y), new Vector2(0.5f + c.x/Screen.width*Screen.height, 0.85f + c.y), UltiDraw.Cyan);
             * UltiDraw.End();
             */

            if (Application.isPlaying)
            {
                if (NN.Parameters == null)
                {
                    return;
                }

                UltiDraw.Begin();
                // 红色是目标面朝方向
                UltiDraw.DrawLine(Trajectory.Points[RootPointIndex].GetPosition(), Trajectory.Points[RootPointIndex].GetPosition() + TargetDirection, 0.05f, 0f, UltiDraw.Red.Transparent(0.75f));
                // 绿色是目标移动方向
                UltiDraw.DrawLine(Trajectory.Points[RootPointIndex].GetPosition(), Trajectory.Points[RootPointIndex].GetPosition() + TargetVelocity, 0.05f, 0f, UltiDraw.Green.Transparent(0.75f));
                UltiDraw.End();

                // 画地面轨迹
                Trajectory.Draw(10);

                UltiDraw.Begin();
                for (int i = 0; i < Actor.Bones.Length; i++)
                {
                    // 紫色是画 骨骼速度
                    UltiDraw.DrawArrow(
                        Actor.Bones[i].Transform.position,
                        Actor.Bones[i].Transform.position + Velocities[i],
                        0.75f,
                        0.0075f,
                        0.05f,
                        UltiDraw.Purple.Transparent(0.5f)
                        );
                }
                UltiDraw.End();
            }
        }
Example #6
0
    void OnRenderObject()
    {
        if (Application.isPlaying)
        {
            UltiDraw.Begin();
            UltiDraw.DrawLine(Trajectory.Points[RootPointIndex].GetPosition(), Trajectory.Points[RootPointIndex].GetPosition() + TargetDirection, 0.05f, 0f, UltiDraw.Red.Transparent(0.75f));
            UltiDraw.DrawLine(Trajectory.Points[RootPointIndex].GetPosition(), Trajectory.Points[RootPointIndex].GetPosition() + TargetVelocity, 0.05f, 0f, UltiDraw.Green.Transparent(0.75f));
            UltiDraw.End();
            Trajectory.Draw(10);
        }

        if (!Application.isPlaying)
        {
            Character.FetchTransformations(Root);
        }
        Character.Draw();

        if (Application.isPlaying)
        {
            UltiDraw.Begin();
            for (int i = 0; i < Joints.Length; i++)
            {
                Character.Segment segment = Character.FindSegment(Joints[i].name);
                if (segment != null)
                {
                    UltiDraw.DrawArrow(
                        Joints[i].position,
                        Joints[i].position + Velocities[i],
                        0.75f,
                        0.0075f,
                        0.05f,
                        UltiDraw.Cyan.Transparent(0.75f)
                        );
                }
            }
            UltiDraw.End();
        }
    }
Example #7
0
 private void pboxWorkSpace_Paint(object sender, PaintEventArgs e)
 {
     objTrajectory.Draw(pboxWorkSpace, e);
 }
Example #8
0
 void OnRenderObject()
 {
     Trajectory.Draw();
     Character.Draw();
 }