Esempio n. 1
0
    public static NodeGraphicScript CreateGraphic(NodeScript node, Vector3 position, float radius)
    {
        // XXX: Collision checking for finding position
        Vector3 pos = position + UnityEngine.Random.onUnitSphere * radius;

        // XXX: Spawn far away (in param) and MoveTo position
        GameObject newNode;

        newNode = GameObject.Instantiate(nodePrefab, pos, Quaternion.identity, gameObject.transform) as GameObject;
        newNode.SetActive(true);
        NodeGraphicScript script = newNode.GetComponent <NodeGraphicScript>();

        script.Init(node);
        nodes.Add(node.GetAddress(), script);

        return(script);
    }