private void UpdateRaycastHit(List <Touch> touchList)
 {
     if (0 < touchList.Count)
     {
         Vector3      position = new Vector3(touchList[0].position.x, touchList[0].position.y, 0f);
         Ray          ray      = this.farmCamera.ScreenPointToRay(position);
         RaycastHit[] raycasts = Physics.RaycastAll(ray);
         InputControll.TouchObjectInfo touchObject = this.GetTouchObject(raycasts);
         if (this.rayHitObjectType == InputControll.TouchObjectType.NONE && touchObject.type != InputControll.TouchObjectType.NONE)
         {
             this.rayHitObjectType     = touchObject.type;
             this.rayHitColliderObject = touchObject.transform.gameObject;
         }
     }
 }
    private InputControll.TouchObjectInfo GetTouchObject(RaycastHit[] raycasts)
    {
        InputControll.TouchObjectInfo result = new InputControll.TouchObjectInfo
        {
            type      = InputControll.TouchObjectType.NONE,
            transform = null
        };
        FarmRoot  instance          = FarmRoot.Instance;
        FarmField field             = instance.Field;
        Vector3   b                 = new Vector3(-0.5f, 0f, -0.5f);
        bool      isInvalidCharaTap = false;

        if (instance.SettingObject.settingMode == FarmObjectSetting.SettingMode.BUILD || instance.farmMode == FarmRoot.FarmControlMode.EDIT)
        {
            isInvalidCharaTap = true;
        }
        int i = 0;

        while (i < raycasts.Length)
        {
            string tag = raycasts[i].transform.tag;
            if (tag != null)
            {
                InputControll.TouchObjectType type;
                if (!(tag == "Farm.Facility"))
                {
                    if (!(tag == "Farm.Chara"))
                    {
                        if (!(tag == "Farm.Other"))
                        {
                            if (!(tag == "Farm.Field"))
                            {
                                goto IL_107;
                            }
                            field.Grid.UpdateSelectGrid(raycasts[i].point);
                            goto IL_1C8;
                        }
                        else
                        {
                            type = InputControll.TouchObjectType.OTHER;
                        }
                    }
                    else
                    {
                        type = InputControll.TouchObjectType.CHARA;
                    }
                }
                else
                {
                    type = InputControll.TouchObjectType.FACILITY;
                }
                if (null == result.transform)
                {
                    result.Set(type, raycasts[i].transform, isInvalidCharaTap);
                }
                else
                {
                    Vector3 vector = result.transform.position;
                    vector = ((result.type == InputControll.TouchObjectType.CHARA) ? (vector - b) : vector);
                    Vector3 vector2 = raycasts[i].transform.position;
                    vector2 = ((result.type == InputControll.TouchObjectType.CHARA) ? (vector2 - b) : vector2);
                    if (this.GetCameraDistanceXZ(vector) > this.GetCameraDistanceXZ(vector2))
                    {
                        result.Set(type, raycasts[i].transform, isInvalidCharaTap);
                    }
                }
            }
IL_1C8:
            i++;
            continue;
IL_107:
            goto IL_1C8;
        }
        return(result);
    }