Ejemplo n.º 1
0
    public void OnClickSubmitButton()
    {
        GameObject     atomTarget             = periodicTableControllerScript.GetAtomTarget();
        GameObject     elementPrefabInitiated = periodicTableControllerScript.getElementPrefabInitiated();
        GameObject     newAtom = Instantiate(elementPrefabInitiated, atomTarget.transform.position, Quaternion.identity) as GameObject;
        AtomController newAtomControllerScript = newAtom.GetComponent <AtomController>();

        newAtomControllerScript.DestroyElectron();
        newAtomControllerScript.canSpin = false;
        newAtom.transform.parent        = periodicTableControllerScript.mainEditMolecule.transform;
        newAtom.name = elementPrefabInitiated.name;
        Destroy(atomTarget);
        periodicTableControllerScript.ClosePeriodicTable();
        periodicTableControllerScript.TurnOnOnClickAllAtom();
    }
    public void GenerateAtom(string atomName, Vector3 atomPosition, Quaternion atomRotation, GameObject mainMolecule, bool canClick, bool canShowPanel)
    {
        //Debug.Log(atomName + ":" + atomPosition + ":" + atomRotation + ":" + mainMolecule);
        GameObject atomPrefabForGenerate = Array.Find(elementPrefabs, s => s.name.Equals(atomName));

        if (atomPrefabForGenerate != null)
        {
            GameObject atomGenerated = Instantiate(atomPrefabForGenerate, atomPosition, atomRotation) as GameObject;
            atomGenerated.name             = atomName;
            atomGenerated.transform.parent = mainMolecule.transform;
            AtomController atomGeneratedScript = atomGenerated.GetComponent <AtomController>();
            atomGeneratedScript.canClick     = canClick;
            atomGeneratedScript.canShowPanel = canShowPanel;
            atomGeneratedScript.DestroyElectron();
        }
    }