Ejemplo n.º 1
0
 private void OnDrawGizmos()
 {
     for (float t = 0; t <= 1; t += 0.05f)
     {
         gposition = MMathf.Powed(1 - t, 3) * cpoints[0].position + 3 * MMathf.Powed(1 - t, 2) * t * cpoints[1].position +
                     3 * (1 - t) * MMathf.Powed(t, 2) * cpoints[2].position + MMathf.Powed(t, 3) * cpoints[3].position;
         Gizmos.DrawCube(gposition, new Vector3(0.25f, 0.25f, 0.25f));
         //Gizmos.
         Gizmos.color = Color.green;
     }
     Gizmos.DrawLine(new Vector2(cpoints[0].position.x, cpoints[0].position.y), new Vector2(cpoints[1].position.x, cpoints[1].position.y));
     Gizmos.DrawLine(new Vector2(cpoints[2].position.x, cpoints[2].position.y), new Vector2(cpoints[3].position.x, cpoints[3].position.y));
 }
Ejemplo n.º 2
0
    private IEnumerator GoIEnumerator(int rnum)
    {
        IenumeratorAllowed = false;
        Vector2 p1 = rts[rnum].GetChild(0).position;
        Vector2 p2 = rts[rnum].GetChild(1).position;
        Vector2 p3 = rts[rnum].GetChild(2).position;
        Vector2 p4 = rts[rnum].GetChild(3).position;

        while (tParam < 1 && mousedown)
        {
            tParam   += Time.deltaTime * speedMod;
            tpar     += Time.deltaTime * speedMod;
            cPosition = MMathf.Powed(1 - tParam, 3) * p1 + 3
                        * MMathf.Powed(1 - tParam, 2) * tParam * p2 + 3
                        * (1 - tParam) * MMathf.Powed(tParam, 2) * p3 +
                        MMathf.Powed(tParam, 3) * p4;
            //print(cPosition);
            transform.position = cPosition;
            yield return(new WaitForEndOfFrame());
        }

        if (tParam < 1)
        {
        }
        else
        {
            score += 25;
            tParam = 0;
            rtsGo += 1;
        }
        if (rtsGo > rts.Length - 1)
        {
            tpar    = 0;
            goToCam = false;
            Camera.main.transform.position = new Vector3(31.44f, -4.450001f, -10); rtsGo = 0;
            OpenAppLevel.THIS.loadNext();
        }
        IenumeratorAllowed = true;
    }