Пример #1
0
    void OnTriggerExit2D(Collider2D other)
    {
        // taxi has passenger and drive over building
        Debug.Log("Exit " + other.name);
        if (_targetTagName == "building" && _peopleId != string.Empty && _pickupState == PickupState.Pick)
        {
            if (_peopleId == _objectConfig.ID.ToString())
            {
                Debug.Log("pickup state: kick");
                // kick passenger
                _pickupState = PickupState.Kick;
            }
            //StartCoroutine (countsetMessageBox(_pickupState));
        }
        if (other.tag == "people" && _pickupState == PickupState.Empty)
        {
            Debug.Log("pickup state: Don't pick");
            other.gameObject.GetComponent <ObjectConfig> ().Anim();
            StartCoroutine(countsetMessageBox(_pickupState));
        }

        //Out
        if (_objectConfig == other.GetComponent <ObjectConfig>())
        {
            _objectConfig = null;
        }

        step = OnTriggeris.Exit;
    }
Пример #2
0
 void OnTriggerStay2D(Collider2D other)
 {
     //Stay
     if ((_objectConfig == null && _pickupState == PickupState.Empty && other.tag == "people") ||
         (_objectConfig == null && _pickupState == PickupState.Pick && other.tag == "building"))
     {
         _targetTagName = other.tag;
         _objectConfig  = other.GetComponent <ObjectConfig> ();
     }
     step = OnTriggeris.Stay;
 }
Пример #3
0
    void OnTriggerEnter2D(Collider2D other)
    {
        //In

        forpickup = counttime;
        if ((_objectConfig == null && _pickupState == PickupState.Empty && other.tag == "people") ||
            (_objectConfig == null && _pickupState == PickupState.Pick && other.tag == "building"))
        {
            _targetTagName = other.tag;
            _objectConfig  = other.GetComponent <ObjectConfig> ();
        }

        step = OnTriggeris.Enter;
    }