Exemplo n.º 1
0
    void Start()
    {
        // obtain appropriate references for prefab children
        foreach (Transform child in gameObject.transform)
        {
            string childName = child.name;
            // boardScript contains information on trick attempt
            if (childName == "board")
            {
                boardScript = child.GetComponent <boardScript>();

                // back foot rigidbody used to execute movements on back foot
            }
            else if (childName == "back_foot")
            {
                backFootRGBD       = child.GetComponent <Rigidbody>();
                backFootInitialPos = child.transform.position;
                boardScript.SetFoot(LEFT, child);

                // front foot rigidbody used to execute movements on front foot
            }
            else if (childName == "front_foot")
            {
                frontFootRGBD       = child.GetComponent <Rigidbody>();
                frontFootInitialPos = child.transform.position;
                boardScript.SetFoot(RIGHT, child);

                // fitness function designates how to interpret information
            }
            else if (childName == "fitnessFunctionObject")
            {
                fitnessFunction = child.GetComponent <FitnessFunction>();
            }
            else
            {
                Debug.Log("Unknown child component " + child.name);
            }
        }



        // test ollie action pairs

        /*
         * actionsPairing = new Tuple<float, Vector3, bool>[]{
         *  Tuple.Create(0.9f, new Vector3(0.0f, 1.0f, 0.0f), RIGHT),
         *  Tuple.Create(1f, new Vector3(0.0f, -2.0f, 0), LEFT),
         *  Tuple.Create(1.05f, new Vector3(0.0f, 2.0f, 0.3f), LEFT),
         *  Tuple.Create(1.05f, new Vector3(0.0f, 0.0f, 0.5f), RIGHT),
         *  Tuple.Create(1.4f, new Vector3(0.0f, -2.0f, 0), LEFT),
         *  Tuple.Create(1.4f, new Vector3(0.0f, -2.0f, -1.0f), RIGHT)
         * };
         */
    }