Exemplo n.º 1
0
    public void AddNewArc(Unitoken Source, string Predicate, unitoken Target)
    {
        //Unitoken target = AddNewToken();
        Unitoken source = Source;
        Unitoken target = TokenFactory.Instance.AddNewToken(Target);

        source.arcCount += 1;
        target.arcCount += 1;


        source.tokenRotation = (360.0f / (source.arcCount + 1.0f));
        Vector3 rotationVector = new Vector3(Mathf.Sin(source.tokenRotation * Mathf.Deg2Rad), Mathf.Cos(source.tokenRotation * Mathf.Deg2Rad), 0);
        Vector3 offset         = rotationVector * ArcMapManager.Instance.mapScale;

        target.transform.position += offset;
        Arc arc = CreateJoinArc(source, target);

        arc.SetLabel(Predicate);

        source.transform.parent = arc.transform;
        target.transform.parent = arc.transform;
        ArcMapManager.Instance.selectedUnitoken = target;
        Debug.Log("Creating arcs");


        //Fragment frag = new GameObject("Fragment").AddComponent<Fragment>();
        //frag.Initialize(arc);
    }
Exemplo n.º 2
0
    public void Initialize(unitoken token)
    {
        myUnitokenStruct = token;

        myLabel.text           = token.Label;
        this.TransientPosition = token.TransientPosition;
        myType  = Type.Unitoken;
        myArcs  = new List <Arc>();
        mCamera = Camera.main;
    }
Exemplo n.º 3
0
 public void Initialize(string label, Vector3 transientPosition, string uri)
 {
     myUnitokenStruct = new unitoken {
         URI = uri, TransientPosition = transientPosition, Label = label
     };
     myLabel.text           = label;
     this.TransientPosition = transientPosition;
     myType  = Type.Unitoken;
     myArcs  = new List <Arc>();
     mCamera = Camera.main;
 }
Exemplo n.º 4
0
    public void CollapseArc()
    {
        string   label  = ArcMapManager.Instance.selectedArc.Collapse();
        Vector3  center = ArcMapManager.Instance.selectedArc.TransientPosition;
        unitoken token  = new unitoken();

        token.Label             = label;
        token.TransientPosition = center;

        TokenFactory.Instance.AddNewToken(token);
    }
Exemplo n.º 5
0
    public Unitoken AddNewToken(unitoken token)
    {
        Vector3 mouseWorldPos = mCamera.ScreenToWorldPoint(Input.mousePosition);
        float   h             = mouseWorldPos.x;
        float   v             = mouseWorldPos.y;
        Vector3 mouseDelta    = new Vector3(h, v, 0);
        //transform.position = mouseDelta;
        Unitoken newToken = Instantiate(unitokenPrefab, token.TransientPosition, Quaternion.identity, transform.parent).GetComponent <Unitoken>();

        newToken.transform.position = token.TransientPosition;
        newToken.transform.name     = "Unitoken";
        newToken.Initialize(token);

        ArcMapManager.Instance.AddTokenToList(newToken);

        return(newToken);
    }
Exemplo n.º 6
0
    public static unitoken[] LoadUnitokens()
    {
        transientPositions = PlayerPrefsX.GetVector3Array(keys[0]);
        unitokenLabels     = PlayerPrefsX.GetStringArray(keys[1]);

        //if(rngLoad)
        //Random.InitState(42);

        unitoken[] loadedTokens = new unitoken[transientPositions.Length];

        for (int i = 0; i < loadedTokens.Length; i++)
        {
            unitoken newToken = new unitoken();
            newToken.Label             = unitokenLabels[i];
            newToken.TransientPosition = transientPositions[i] + new Vector3(0, 0, Random.Range(-1.0f, 1.0f));
            //newToken.Initialize(unitokenLabels[i],transientPositions[i]);

            loadedTokens[i] = newToken;
        }
        return(loadedTokens);
    }