Esempio n. 1
0
    /* Change selection radius */
    public void ChangeRadius()
    {
        transform.localScale = 2 * new Vector3(Atoms.SELECTION_MODE_SPHERE_RADIUS, Atoms.SELECTION_MODE_SPHERE_RADIUS, Atoms.SELECTION_MODE_SPHERE_RADIUS);

        /* Set radius of the transparent sphere */
        ISphere s = GetComponent <ISphere>();

        s.SetRadius(Atoms.SELECTION_MODE_SPHERE_RADIUS);

        /* Reset cylinders within the previous radius */
        for (int i = 0; i < cylinders_.Count; i++)
        {
            ICylinder cylinder = cylinders_[i];
            cylinder.SetHighlighted(0);
            cylinder.ResetColor();
        }
        cylinders_.Clear();

        /* Get the new cylinders within radius */
        Collider[] hitColliders = Physics.OverlapSphere(this.transform.position, Atoms.SELECTION_MODE_SPHERE_RADIUS);
        foreach (Collider c in hitColliders)
        {
            ICylinder cylinder = c.gameObject.GetComponent <ICylinder>();
            if (cylinder == null || cylinder == center_cylinder_)
            {
                continue;
            }

            AddCylinder(cylinder);
        }
    }
Esempio n. 2
0
    void Start()
    {
        /* Set the scale based on the selection radius used */
        transform.localScale = 2 * new Vector3(Atoms.SELECTION_MODE_SPHERE_RADIUS, Atoms.SELECTION_MODE_SPHERE_RADIUS, Atoms.SELECTION_MODE_SPHERE_RADIUS);

        /* Make the selection sphere transparent */
        ISphere s = GetComponent <ISphere>();

        s.SetTransparent(true);
        s.SetRadius(Atoms.SELECTION_MODE_SPHERE_RADIUS);
        s.SetColor(new Color(0.1f, 0.1f, 0.1f, 0));

        /* Set color circle parameters */
        colors_       = new Color[3, 3];
        colors_[0, 0] = color_bottom_left;
        colors_[0, 1] = color_bottom;
        colors_[0, 2] = color_bottom_right;
        colors_[1, 0] = color_left;
        colors_[1, 2] = color_right;
        colors_[2, 0] = color_top_left;
        colors_[2, 1] = color_top;
        colors_[2, 2] = color_top_right;

        /* Set arrow parameters */
        arrows_       = new GameObject[3, 3];
        arrows_[0, 0] = Instantiate(prefab_arrow_bottom_left, new Vector3(0, 0, 0), Quaternion.identity);
        arrows_[0, 1] = Instantiate(prefab_arrow_bottom, new Vector3(0, 0, 0), Quaternion.identity);
        arrows_[0, 2] = Instantiate(prefab_arrow_bottom_right, new Vector3(0, 0, 0), Quaternion.identity);
        arrows_[1, 0] = Instantiate(prefab_arrow_left, new Vector3(0, 0, 0), Quaternion.identity);
        arrows_[1, 2] = Instantiate(prefab_arrow_right, new Vector3(0, 0, 0), Quaternion.identity);
        arrows_[2, 0] = Instantiate(prefab_arrow_top_left, new Vector3(0, 0, 0), Quaternion.identity);
        arrows_[2, 1] = Instantiate(prefab_arrow_top, new Vector3(0, 0, 0), Quaternion.identity);
        arrows_[2, 2] = Instantiate(prefab_arrow_top_right, new Vector3(0, 0, 0), Quaternion.identity);
        //arrows_[0, 0].transform.parent = transform;
        //arrows_[0, 1].transform.parent = transform;
        //arrows_[0, 2].transform.parent = transform;
        //arrows_[1, 0].transform.parent = transform;
        //arrows_[1, 2].transform.parent = transform;
        //arrows_[2, 0].transform.parent = transform;
        //arrows_[2, 1].transform.parent = transform;
        //arrows_[2, 2].transform.parent = transform;
        arrows_[0, 0].SetActive(false);
        arrows_[0, 1].SetActive(false);
        arrows_[0, 2].SetActive(false);
        arrows_[1, 0].SetActive(false);
        arrows_[1, 2].SetActive(false);
        arrows_[2, 0].SetActive(false);
        arrows_[2, 1].SetActive(false);
        arrows_[2, 2].SetActive(false);

        if (visualization == SelectionVisualizationMethod.ARROWS)
        {
            transform.GetChild(0).gameObject.SetActive(false);
        }
        else
        {
            transform.GetChild(0).gameObject.SetActive(true);
        }

        /* Get info box object */
        info_ui_ = Camera.main.transform.Find("AtomInfoBox").GetComponent <AtomInfoBox>();

        /* Get parent atoms object */
        atoms_object_ = transform.parent.GetComponent <Atoms>();
    }