示例#1
0
    // Update is called once per frame
    void Update()
    {
        //
        // update group nodes position.
        //

        float t = spawnInfo.GetT();

        if (t > 1.0f)
        {
            DestroyLoopEnter();
            return;
        }

        //        t += (1.0f/30.0f)*Time.deltaTime;
        t += (2.0f) * Time.deltaTime;
        spawnInfo.SetT(t);

        float h = 3 * Mathf.Pow(t, 2) - 2 * Mathf.Pow(t, 3);

        Vector2 pos = spawnInfo.GetPosition() + h * spawnInfo.GetRPosition();

        spawnInfo.SetCurrentPosition(pos);

        InvalidateNodeComponentPosition();

        //
        // update edge position
        //

        foreach (int nodeIndex in spawnInfo.GetNodeIndecies())
        {
            loop.IterateEdge(nodeIndex);
        }
    }