コード例 #1
0
    public bool BuildFarmObject(int facilityID)
    {
        FarmObject farmObject = this.FindFarmObjectByFacilityId(facilityID);
        FarmObject farmObject2;

        if (null == farmObject)
        {
            farmObject2 = this.LoadFarmObject(facilityID);
        }
        else
        {
            farmObject2 = this.DuplicateFarmObject(farmObject);
        }
        if (null == farmObject2)
        {
            return(false);
        }
        farmObject2.facilityID = facilityID;
        FarmObjectSetting component = base.GetComponent <FarmObjectSetting>();
        bool flag = component.SetFarmObject(farmObject2, this.GetScreenCenterPoint());

        if (flag)
        {
            GUICameraControll component2 = FarmRoot.Instance.Camera.GetComponent <GUICameraControll>();
            if (null != component2)
            {
                Vector3 baseGridPosition3D = component.farmObject.GetBaseGridPosition3D();
                base.StartCoroutine(component2.MoveCameraToLookAtPoint(baseGridPosition3D, 0f));
            }
        }
        return(true);
    }
コード例 #2
0
    private IEnumerator OpenAnimation(Action callback)
    {
        GUICameraControll farmCamera = FarmRoot.Instance.Camera.GetComponent <GUICameraControll>();
        Vector3           position   = base.transform.position;

        position.y -= FarmRoot.Instance.gameObject.transform.localPosition.y;
        yield return(base.StartCoroutine(farmCamera.MoveCameraToLookAtPoint(position, 0.2f)));

        bool isEffectEnd = false;
        EffectAnimatorObserver effect = FarmRoot.Instance.GetBuildCompleteEffect(base.transform);

        if (null != effect)
        {
            EffectAnimatorEventTime component = effect.GetComponent <EffectAnimatorEventTime>();
            component.SetEvent(0, delegate
            {
                isEffectEnd = true;
            });
            effect.Play();
        }
        while (!isEffectEnd)
        {
            yield return(null);
        }
        if (callback != null)
        {
            callback();
        }
        yield break;
    }
コード例 #3
0
    private IEnumerator WaitMovedForFarmCamera(GUICameraControll farmCamera, Vector3 position)
    {
        GUIMain.BarrierON(null);
        yield return(AppCoroutine.Start(farmCamera.MoveCameraToLookAtPoint(position, 1f), false));

        GUIMain.BarrierOFF();
        yield break;
    }
コード例 #4
0
    public void RelocationOfStoreFarmObject(FarmObject farmObject)
    {
        bool flag = this.SetFarmObjectOfEditMode(farmObject, this.GetScreenCenterPoint());

        if (flag)
        {
            GUICameraControll component = FarmRoot.Instance.Camera.GetComponent <GUICameraControll>();
            if (null != component)
            {
                Vector3 baseGridPosition3D = farmObject.GetBaseGridPosition3D();
                base.StartCoroutine(component.MoveCameraToLookAtPoint(baseGridPosition3D, 0f));
            }
        }
    }
コード例 #5
0
    public bool RelocationOfStoreFarmObjectAndDragState(FarmObject farmObject, Vector3 mousePosition)
    {
        bool flag = this.SetFarmObjectOfEditModeAndDragState(farmObject, mousePosition);

        if (flag)
        {
            GUICameraControll component = FarmRoot.Instance.Camera.GetComponent <GUICameraControll>();
            if (null != component)
            {
                Vector3 baseGridPosition3D = farmObject.GetBaseGridPosition3D();
                base.StartCoroutine(component.MoveCameraToLookAtPoint(baseGridPosition3D, 0f));
            }
        }
        return(flag);
    }
コード例 #6
0
    private Vector3 GetExtendBuildPosition(FarmObjectSetting farmObjectSetting, FarmObject prevFarmObject)
    {
        FarmObjectSetting.ExtendBuildPositionSearchResult extendBuildPositionSearchResult = farmObjectSetting.SearchExtendBuildGrid(prevFarmObject);
        FarmGrid grid               = FarmRoot.Instance.Field.Grid;
        int      gridIndex          = grid.GetGridIndex(extendBuildPositionSearchResult.grid);
        Vector3  positionGridCenter = grid.GetPositionGridCenter(gridIndex, true);

        if (!extendBuildPositionSearchResult.isOutsideMap)
        {
            GUICameraControll component = FarmRoot.Instance.Camera.GetComponent <GUICameraControll>();
            if (null != component)
            {
                base.StartCoroutine(component.MoveCameraToLookAtPoint(positionGridCenter, 0f));
            }
        }
        return(positionGridCenter);
    }