Beispiel #1
0
    void Glass(RaycastHit _hit)
    {
        GlassMat glass = _hit.transform.gameObject.GetComponent <GlassMat> ();

        if (glass.hasGlass)
        {
            /*if (!hasGlass && glass.isSide && slot1 == -1) {
             *      glass.TakeGlass ();
             *      hasGlass = true;
             *      slot1 = 0;
             * }*/
        }
        else
        {
            if (hasGlass && slot1 > 0)
            {
                if (!glass.isSide)
                {
                    glass.GiveGlass(slot1);
                    hasGlass = false;
                    slot1    = -1;
                }
                else if (glass.transform.FindChild("Seat").GetComponent <Seat>().hasSomeone)
                {
                    glass.ServeClient(slot1);
                    hasGlass = false;
                    slot1    = -1;
                }
            }
        }
    }
Beispiel #2
0
    //OnTriggerEnter Method
    void OnTriggerEnter(Collider _collider)
    {
        if (_collider.tag == "PickArea")
        {
            GlassMat glassMat = _collider.transform.parent.GetComponent <GlassMat> ();

            if (glassMat.hasGlass && !glassMat.isSide)
            {
                Glass glass = glassMat.transform.GetComponentInChildren <Glass> ();

                if (slot [0] == -1)
                {
                    slot [0] = glass.actual;
                    glassMat.TakeGlass();
                }
                else if (slot [1] == -1)
                {
                    slot [1] = glass.actual;
                    glassMat.TakeGlass();
                }
            }
        }
        else if (_collider.tag == "GiveArea")
        {
            GlassMat glassMat = _collider.transform.parent.GetComponent <GlassMat> ();

            if (!glassMat.hasGlass && glassMat.isSide)
            {
                if (slot[0] == 0)
                {
                    glassMat.GiveGlass(0);
                    slot [0] = -1;
                }
                else if (slot[1] == 0)
                {
                    glassMat.GiveGlass(0);
                    slot [1] = -1;
                }
            }
        }
        else if (_collider.tag == "Client")
        {
            clientColliders.Add(_collider);
        }
        else if (_collider.tag == "Puke")
        {
            StartCoroutine(Slip());
        }
    }