public IEnumerator ScaleCheckMain()
    {
        for (; ;)
        {
            yield return(new WaitForSeconds(1f));

            if (transform.localScale.x == fjGrow.checkSize && State == GrowState.WORKING)
            {
                GetComponentInParent <SkinnedMeshRenderer>().enabled = true;
                //fjGrow.GrowShrinkSpeed = time_Value; 테스트
                fjGrow.GrowShrinkSpeed = tmpTime;
                fjGrow.StartGrowing();
                State = GrowState.MIDDLE;
            }

            if (transform.localScale.x >= 0.5f && State == GrowState.MIDDLE)
            {
                for (int i = 0; i < 5; i++)
                {
                    StartCoroutine(Bending(tailBones[i]));
                }
                State = GrowState.END;
            }

            if (transform.localScale.x >= 1f && State == GrowState.END)
            {
                GetComponent <FTail_Animator>().enabled = true;

                yield break;
            }
        }
    }
    private void StartSetting() // 기본 세팅 및 최소 크기로 줄여둠.
    {
        if (mainOrLeaf == true)
        {
            tailBones = new GameObject[5];
            //vector3 = new Vector3(1, 0, 0);
            //_maxBendingSize = 10;
            TailBoneSet();
            TailMaxRotSet(vector3, _maxBendingSize);
        }

        State = GrowState.WORKING;
        //Debug.Log("ss");
    }
Exemplo n.º 3
0
    IEnumerator StemStep(float st)
    {
        WaitForSeconds waitForSeconds = new WaitForSeconds(wait);

        while (stempSet.GetFloat("_StemGrow") < st)
        {
            stempSet.SetFloat("_StemGrow", stempSet.GetFloat("_StemGrow") + temp);
            cropCamera.transform.localPosition =
                new Vector3(cropCamera.transform.localPosition.x, stempSet.GetFloat("_StemGrow") * grow_speed + 0.3f, cropCamera.transform.localPosition.z);


            if (stempSet.GetFloat("_StemGrow") > st)
            {
                stempSet.SetFloat("_StemGrow", st);
            }


            yield return(waitForSeconds);
        }


        if (stempSet.GetFloat("_StemGrow") == stem_middleValue)
        {
            growstate = GrowState.Step2;
        }
        else if (stempSet.GetFloat("_StemGrow") == 1f)
        {
            growstate = GrowState.Step3;
        }



        PanelGrowAdd();
        mainCamera.SetActive(true);
        cropCamera.SetActive(false);

        foreach (var cv in canvas)
        {
            cv.gameObject.SetActive(true);
        }
    }
Exemplo n.º 4
0
    private void Start()
    {
        TargetedBy = new List <RabbitController>();

        onGrow += FoodSource.OnGrow;
        onGrow += Spread.OnGrow;

        Grabbable.onGrab += OnGrab;
        Grabbable.onDrop += OnDrop;

        _growTime = Data.RandomGrowTime;
        _rotTime  = _growTime + Data.RandomRotTime;

        onRot  += Animations.OnRot;
        onRot  += OnRot;
        onGrow += Animations.OnGrow;

        _lifetime = 0.0f;
        State     = GrowState.Growing;

        ResumeGrowing();
    }
    public IEnumerator ScaleCheckLeaf()
    {
        for (; ;)
        {
            yield return(new WaitForSeconds(1f));

            if (transform.localScale.x == fjGrow.checkSize && State == GrowState.WORKING)
            {
                GetComponentInParent <SkinnedMeshRenderer>().enabled = true;
                //fjGrow.GrowShrinkSpeed = time_Value; 테스트
                fjGrow.GrowShrinkSpeed = tmpTime;
                fjGrow.StartGrowing();
                State = GrowState.END;
            }

            if (transform.localScale.x >= 1f && State == GrowState.END)
            {
                GetComponent <FTail_Animator>().enabled = true;
                yield break;
            }
        }
    }
Exemplo n.º 6
0
    private void Update()
    {
        if (!_growing)
        {
            return;
        }

        _lifetime += Time.deltaTime;

        float growPercent = _lifetime / _rotTime;

        float ripePercent = 0.0f;

        if (State == GrowState.Ripe)
        {
            ripePercent = (_lifetime - _growTime) / (_rotTime - _growTime);
        }

        switch (State)
        {
        case GrowState.Growing when _lifetime >= _growTime:
            State = GrowState.Ripe;
            onGrowEnd?.Invoke(this, EventArgs.Empty);
            return;

        case GrowState.Ripe when _lifetime >= _rotTime:
            State = GrowState.Rotten;
            onRot?.Invoke(this, EventArgs.Empty);
            return;
        }

        onGrow?.Invoke(this, new GrowData
        {
            GrowPercent = growPercent,
            RipePercent = ripePercent,
            State       = State
        });
    }
Exemplo n.º 7
0
    IEnumerator CropStep()
    {
        WaitForSeconds waitForSeconds = new WaitForSeconds(crop_wait);

        float grow_value = -0.35f;

        while (grow_value < 1f)
        {
            grow_value += crop_temp;

            foreach (var crop in crops_renderer)
            {
                crop.material.SetFloat("_CropGrow", grow_value);
            }

            yield return(waitForSeconds);
        }


        if (grow_value > 1f)
        {
            growstate = GrowState.Complete;
        }



        PanelHarvastAdd();
        mainCamera.SetActive(true);
        cropCamera.SetActive(false);


        foreach (var cv in canvas)
        {
            cv.gameObject.SetActive(true);
        }
    }
Exemplo n.º 8
0
 private void GetStateInformation()
 {
     curentState   = _states.Peek();
     sprite.sprite = curentState.sprite;
     sprite.color  = curentState.color;
 }