Beispiel #1
0
    public void OnManipulationUpdated(ManipulationEventData eventData)
    {
        // Do a raycast into the world from your head direction.
        var headPosition  = Camera.main.transform.position;
        var gazeDirection = Camera.main.transform.forward;

        RaycastHit hitInfo;

        // Use the manipulation gesture to move the object.
        if (Physics.Raycast(headPosition, gazeDirection, out hitInfo, Mathf.Infinity))
        {
            if (hitInfo.transform.name == "Graph1(Clone)")
            {
                HuyGrapher1 graph1Script = hitInfo.transform.gameObject.GetComponent <HuyGrapher1>();
                graph1Script.NetworkTransformUpdate(eventData);
            }
            else
            {
                hitInfo.transform.position += eventData.CumulativeDelta;
            }
        }
    }
Beispiel #2
0
    /// <summary>
    /// Graph type voice commands. Linear, Exponential, Parabola, Sine, Ripple.
    /// </summary>
    /// <param name="graphType"></param>
    public void GraphTypeSetActive(string graphType)
    {
        GameObject graph1 = SharedCollection.Instance.gameObject.transform.Find("Graph1(Clone)").gameObject;
        GameObject graph2 = SharedCollection.Instance.gameObject.transform.Find("Graph2").gameObject;
        GameObject graph3 = SharedCollection.Instance.gameObject.transform.Find("Graph3").gameObject;

        if (graph1.activeSelf)
        {
            HuyGrapher1 grapher1 = graph1.GetComponent <HuyGrapher1>();
            if (graphType == "Linear")
            {
                grapher1.function = HuyGrapher1.FunctionOption.Linear;
            }
            else if (graphType == "Exponential")
            {
                grapher1.function = HuyGrapher1.FunctionOption.Exponential;
            }
            else if (graphType == "Parabola")
            {
                grapher1.function = HuyGrapher1.FunctionOption.Parabola;
            }
            else if (graphType == "Sine")
            {
                grapher1.function = HuyGrapher1.FunctionOption.Sine;
            }
        }

        if (graph2.activeSelf)
        {
            HuyGrapher2 grapher2 = graph2.GetComponent <HuyGrapher2>();
            if (graphType == "Linear")
            {
                grapher2.function = HuyGrapher2.FunctionOption.Linear;
            }
            else if (graphType == "Exponential")
            {
                grapher2.function = HuyGrapher2.FunctionOption.Exponential;
            }
            else if (graphType == "Parabola")
            {
                grapher2.function = HuyGrapher2.FunctionOption.Parabola;
            }
            else if (graphType == "Sine")
            {
                grapher2.function = HuyGrapher2.FunctionOption.Sine;
            }
            else if (graphType == "Ripple")
            {
                grapher2.function = HuyGrapher2.FunctionOption.Ripple;
            }
        }

        if (graph3.activeSelf)
        {
            HuyGrapher3 grapher3 = graph3.GetComponent <HuyGrapher3>();
            if (graphType == "Linear")
            {
                grapher3.function = HuyGrapher3.FunctionOption.Linear;
            }
            else if (graphType == "Exponential")
            {
                grapher3.function = HuyGrapher3.FunctionOption.Exponential;
            }
            else if (graphType == "Parabola")
            {
                grapher3.function = HuyGrapher3.FunctionOption.Parabola;
            }
            else if (graphType == "Sine")
            {
                grapher3.function = HuyGrapher3.FunctionOption.Sine;
            }
            else if (graphType == "Ripple")
            {
                grapher3.function = HuyGrapher3.FunctionOption.Ripple;
            }
        }
    }