Esempio n. 1
0
 // Use this for initialization
 void Start()
 {
     Config.Init();
     buildArea     = GameObject.FindGameObjectWithTag("BuildArea").GetComponent <Collider>();
     molecules     = new List <GameObject>();
     interacteMode = InteracteMode.GRAB;
     currentMoleId = 0;
     prefebMole    = (GameObject)Resources.Load("_Prefebs/Molecule") as GameObject;
 }
Esempio n. 2
0
    public static void SwitchMode(InteracteMode mode)
    {
        interacteMode = mode;
        if (mode == InteracteMode.SELECT)
        {
            foreach (GameObject molecule in molecules)
            {
                for (int i = 0; i < molecule.transform.childCount; i++)
                {
                    GameObject child = molecule.transform.GetChild(i).gameObject;
                    if (child.GetComponent <Atom>() != null)
                    {
                        AtomsAction aa = child.AddComponent <AtomsAction>();
                        aa.touchHighlightColor = Config.UsingSelectedColor;
                        aa.isUsable            = true;
                        aa.holdButtonToUse     = false;
                    }
                    else
                    {
                        BondsAction ba = child.AddComponent <BondsAction>();
                        ba.touchHighlightColor = Config.UsingSelectedColor;
                        ba.isUsable            = true;
                        ba.holdButtonToUse     = false;
                    }
                }
            }

            GameObject.FindGameObjectWithTag("EventManager").GetComponent <UiDisplayController>().ShowSelectAtomCanvas(false);
        }
        else
        {
            foreach (GameObject molecule in molecules)
            {
                molecule.GetComponent <MoleculesAction>().DisableAllComponent();
            }
        }
    }