Beispiel #1
0
    private void MoveSelectionToSphere(ISphere s)
    {
        /* Set new position */
        transform.position = s.transform.position;
        s.ResetColor();

        /* Clear spheres object */
        ClearHighlightedAndResetColor();
        spheres_.Clear();

        /* Set info displayed */
        center_sphere_ = s;
        info_ui_.SetAtom(s);

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

            AddSphere(sphere);
        }
    }
Beispiel #2
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 spheres within the previous radius */
        for (int i = 0; i < spheres_.Count; i++)
        {
            ISphere sphere = spheres_[i];
            sphere.SetHighlighted(0);
            sphere.ResetColor();
        }
        spheres_.Clear();

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

            AddSphere(sphere);
        }
    }
Beispiel #3
0
 private void ClearHighlightedAndResetColor()
 {
     foreach (ISphere s in spheres_)
     {
         s.SetHighlighted(HighlightColors.HIGHLIGHT_COLOR.NO_HIGHLIGHT);
         s.ResetColor();
     }
     center_sphere_.SetHighlighted(HighlightColors.HIGHLIGHT_COLOR.NO_HIGHLIGHT);
     center_sphere_.ResetColor();
 }