예제 #1
0
 void IsChanged()
 {
     if (MouseButtonInteraction() || CameraMove.IsPlay() || TreeAnimator.IsPlaying())
     {
         isChanged = true;
     }
 }
예제 #2
0
    /// <summary>
    /// 相机视点自适应
    /// </summary>
    private void CameraAdaptive()
    {
        if (!TreeAnimator.IsPlaying())
        {
            isAdaptived = false; return;
        }
        if (isAdaptived)
        {
            return;
        }

        /*
         * 获取当前对象的视窗包围盒
         * 后续将根据该包围盒的位置自适应
         */
        Bounds bounds = ViewportBounds();

        if (IsSuitable(bounds))
        {
            return;
        }

        /*
         * 相机位置与FOV自适应
         */
        PositionAdaptive(bounds);
        FOVAdaptive(bounds);

        isAdaptived = true;

        StartCoroutine(CameraMovingCoroutine());

        //GameObject.Find("Animator").GetComponent<AnimatorObject>().playing += CameraMoving;
    }
예제 #3
0
        void OnRenderImage(RenderTexture source, RenderTexture destination)
        {
            outlineShaderMaterial.SetTexture("_OutlineSource", renderTexture);

            if (addLinesBetweenColors)
            {
                Graphics.Blit(source, extraRenderTexture, outlineShaderMaterial, 0);
                outlineShaderMaterial.SetTexture("_OutlineSource", extraRenderTexture);
            }
            Graphics.Blit(source, destination, outlineShaderMaterial, 1);

            /*
             * 仅当相机属性发生改变
             * 并且已经停止交互
             * 再重新生成可读取像素颜色的纹理
             */
            if (isChanged && !MouseButtonInteraction() && !CameraMove.IsPlay() && !TreeAnimator.IsPlaying())
            {
                RenderTex2Tex2D();      //将渲染纹理转换成可读取像素颜色的纹理

                foreach (OutlineControl control in controls)
                {
                    control.RecordColor();
                }

                isChanged = false;
            }
        }
예제 #4
0
    public void NextDay()
    {
        foreach (var treeModel in TreeModels)
        {
            if (LScene.GetInstance().HaveAnimator)
            {
                if (treeModel.ComputeGrowthCycle() < 1)
                {
                    treeModel.NextDay(true);
                }
                else
                {
                    treeModel.NextDay(false);
                }

                ////出苗后
                if (treeModel.ComputeGrowthCycle() >= 1 && !treeModel.IsStopDevelopment)
                {
                    TreeAnimator animator = new TreeAnimator();
                    animator.PlayAnimation(treeModel.PairedBranchIndexes, treeModel.PairedOrganIndexes, LScene.GetInstance().AnimationCount);
                }
            }
            else
            {
                treeModel.NextDay(true);
            }
        }
    }
예제 #5
0
    private IEnumerator CoroutineDestroyTexWithoutAnimation(Texture tex)
    {
        yield return(null);

        yield return(new WaitUntil(() => { return !TreeAnimator.IsPlaying(); }));

        GameObject.Destroy(tex);
    }
    void Start()
    {
        _branch = Branch.LoadPreset(Vector3.up, preset);
        _branch.Build();
        _animator = new TreeAnimator(_branch, speed, true);

        GetComponent <MeshFilter>().sharedMesh = _animator.mesh;
    }
예제 #7
0
 private void Update()
 {
     /*
      * 当仍处于动画中时
      * 禁止按钮可交互
      * 防止数据出现
      */
     if (TreeAnimator.IsPlaying() || CameraMove.IsPlay())
     {
         button.interactable = false;
     }
     else
     {
         button.interactable = true;
     }
 }
예제 #8
0
 public bool IsPlaying()
 {
     return(TreeAnimator.IsPlaying() || CameraMove.IsPlay());
 }