Exemplo n.º 1
0
    //private GameObject Rb112;


    // Use this for initialization
    void Start()
    {
        showObject.SetActive(false);

        mTrackableBehaviour.GetComponent <TrackableBehaviour>();
        if (mTrackableBehaviour)
        {
            mTrackableBehaviour.RegisterTrackableEventHandler(this);
        }
        //OnTrackableStateChanged();
    }
Exemplo n.º 2
0
    // Update is called once per frame
    void Update()
    {
        Debug.Log(DistanceBetweenMarkers(track1, track2));
        Debug.Log(CalculateValence(track1.GetComponent <Atom>().element.valence, track2.GetComponent <Atom>().element.valence));
        Debug.Log(track1.GetComponent <Atom>().element.valence.ToString() + ", " + track2.GetComponent <Atom>().element.valence.ToString());

        /*
         *  if:
         *      there are two trackable objects at a given time;
         *      the two trackable objects are close enough to justify the chemical reaction;
         *      the both of them can be bonded without disrupting the valence of the universe
         *      there can be any bonding
         */
        if (track1 != null && track2 != null && DistanceBetweenMarkers(track1, track2) <= threshold && 0 <= CalculateValence(track1.GetComponent <Atom>().element.valence, track2.GetComponent <Atom>().element.valence) && swap == true && reload == true)
        {
            if (!track1.GetComponent <Atom>().element.atomicGroup.Equals(Element.atomicType.Nonmetal) && track2.GetComponent <Atom>().element.atomicGroup.Equals(Element.atomicType.Nonmetal) ||
                track1.GetComponent <Atom>().element.atomicGroup.Equals(Element.atomicType.Nonmetal) && !track2.GetComponent <Atom>().element.atomicGroup.Equals(Element.atomicType.Nonmetal))
            {
                BondAtoms("donated");
                reload = false;
            }
            else if ((track1.GetComponent <Atom>().element.atomicGroup.Equals(Element.atomicType.Nonmetal) && track2.GetComponent <Atom>().element.atomicGroup.Equals(Element.atomicType.Nonmetal)))
            {
                BondAtoms("shared");
                reload = false;
            }
            else if ((!track1.GetComponent <Atom>().element.atomicGroup.Equals(Element.atomicType.Nonmetal) && !track2.GetComponent <Atom>().element.atomicGroup.Equals(Element.atomicType.Nonmetal)))
            {
                BondAtoms("metallic");
                reload = false;
            }
            else if ((track1.GetComponent <Atom>().element.atomicGroup.Equals(Element.atomicType.Noble_Gas)) || (track2.GetComponent <Atom>().element.atomicGroup.Equals(Element.atomicType.Noble_Gas)))
            {
                Debug.Log("No bonding for you!");
            }
        }
    }