示例#1
0
    // Update is called once per frame
    void Update()
    {
        if (isSampling)
        {
            RaycastHit hit;
            if (Physics.Raycast(Camera.main.ScreenPointToRay(Input.mousePosition), out hit, heatmapLayer))
            {
                if (hit.collider.gameObject.name == "HeatMap")
                {
                    Vector3 relatedPoint = transform.InverseTransformPoint(hit.point);
                    if (agentRef != null)
                    {
                        sampledForce = agentRef.SamplePointToForceVectorXY(relatedPoint.x + 0.5f, relatedPoint.y + 0.5f);
                    }
                    else if (agentSimplRef != null)
                    {
                        sampledForce = agentSimplRef.SamplePointToForceVectorXY(relatedPoint.x + 0.5f, relatedPoint.y + 0.5f);
                    }
                    float score = gameSystemRef.EvaluateShot(sampledForce, Color.green);

                    heatmapInfo.text = sampledForce.x + ", " + sampledForce.z + ": " + score;
                }
            }
        }
    }
示例#2
0
    public List <float> SamplingFuncBatch(List <float> x, List <float> y)
    {
        List <Vector3> forces = new List <Vector3>();

        for (int i = 0; i < x.Count; ++i)
        {
            forces.Add(agentRef.SamplePointToForceVectorXY(x[i], y[i]));
        }
        var values = gameSystemRef.EvaluateShotBatch(forces, Color.gray);

        for (int i = 0; i < values.Count; ++i)
        {
            values[i] = Mathf.Clamp01((values[i] + 0.4f) / 2.4f);
        }
        return(values);
    }