Inheritance: MonoBehaviour
示例#1
0
    //public delegate void ComandAction(CommandGesture command);
    //public event ComandAction ComandStart;
    //public event ComandAction ComandFinish;

    /*
     * ~ComandManagr()
     * {
     *  MoveTool.MoveHome();
     * }*/

    void Start()
    {
        hand_model = GetComponent <HandModel>();
        leap_hand  = hand_model.GetLeapHand();
        SphereRB   = Tool.GetComponent <Rigidbody>();
        MoveTool   = Tool.GetComponent <SphereMove>();
    }
    // Use this for initialization
    void Start()
    {
        sphere       = GameObject.Find("Sphere");
        sphereScript = sphere.GetComponent <SphereMove>();
        startingCube = GameObject.Find("StartCube");
        fakeCube     = GameObject.Find("FakeCube");
        randIndex    = Random.Range(0, pathLength);

        path    = new GameObject[pathLength];
        path[0] = startingCube;

        for (int i = 1; i < pathLength; i++)
        {
            float random = Random.value;
            path[i] = Instantiate(startingCube, this.transform);
            if (random <= 0.5f)
            {
                path[i].transform.position = new Vector3(path[i - 1].transform.position.x + distMove, path[i - 1].transform.position.y, path[i - 1].transform.position.z);
                if (i == 1)
                {
                    sphereScript.l_or_r = true;
                }
            }
            else
            {
                path[i].transform.position = new Vector3(path[i - 1].transform.position.x, path[i - 1].transform.position.y, path[i - 1].transform.position.z + distMove);
                if (i == 1)
                {
                    sphereScript.l_or_r = false;
                }
            }
        }
        cubeX    = path[pathLength - 1].transform.position.x;
        cubeZ    = path[pathLength - 1].transform.position.z;
        updatedX = cubeX;
        updatedZ = cubeZ;
    }