Пример #1
0
 void Start()
 {
     space1 = CartesianVectorSpace.CreateCartesianVectorSpace(new Rect(-400, 0, 700, 700), 100f, Vector2.right, Vector2.up, Vector2.zero, new Vector2(-20, 20), new Vector2(-20, 20));
     space2 = CartesianVectorSpace.CreateCartesianVectorSpace(new Rect(400, 0, 700, 700), 100f, Vector2.right, Vector2.one, Vector2.zero, new Vector2(-20, 20), new Vector2(-20, 20), 1.5f);
     space1.DrawVector(i, colors[0], true, true);
     space2.DrawVector(i, colors[0], true, true);
     space1.DrawVector(j, colors[1], true, true);
     space2.DrawVector(j, colors[1], true, true);
 }
Пример #2
0
    public static CartesianVectorSpace CreateCartesianVectorSpace(Rect position, float zoom, Vector2 i, Vector2 j, Vector2 origin, Vector2 xr, Vector2 yr, float animationSpeed = 3f)
    {
        if (planePrefab == null)
        {
            planePrefab = Resources.Load <GameObject>("Prefabs/Plot");
        }
        CartesianVectorSpace space = Instantiate(planePrefab, FindObjectOfType <Canvas>().transform).GetComponent <CartesianVectorSpace>();

        space.frame          = position;
        space.zoom           = zoom;
        space.iHat           = i;
        space.jHat           = j;
        space.xRange         = xr;
        space.yRange         = yr;
        space.origin         = origin;
        space.animationSpeed = animationSpeed;
        space.animationCurve = Tween.EaseInOutStrong;
        space.axisPrefab     = Resources.Load <GameObject>("Prefabs/AxisLine");
        space.vectorPrefab   = Resources.Load <GameObject>("Prefabs/Vector");
        return(space);
    }