Пример #1
0
    /// <summary>
    /// Trigger Enter
    /// </summary>
    /// <param name="other">Other.</param>
    private void OnTriggerStay(Collider other)
    {
        if (other.CompareTag("Box") && _rm.GetRobotState() == RobotState.SEARCH)
        {
            BoxManager otherManager = other.GetComponent <BoxManager>();

            if (otherManager.GetState() == BoxState.PICKED)
            {
                return;
            }

            if (!_prohibitedBoxes.Contains(other.gameObject.GetInstanceID()) && _ra.Think(other.gameObject))
            {
                _rm.SetBoxTarget(other.gameObject);
                _rm.SetState(RobotState.GO);
            }
            else
            {
                _prohibitedBoxes.Add(other.gameObject.GetInstanceID());
            }
        }
    }