コード例 #1
0
    public void RockProcess(InfoData dat)
    {
        if (dat.count > 0)
        {
            if (GlobalSettings.isUnlimitedResource)
            {
                inventory.magma.count = GlobalSettings.unlimitedResourceMagma;
            }
            else
            {
                dat.count--;

                int magmaValue = 1;

                inventory.magma.count += magmaValue;
            }

            criteria.InvokeUpdate(dat);
        }

        rockSelector.RefreshRock(dat);

        RefreshFireDisplay();

        PlayFurnaceSound();

        //machine animation
        if (furnaceAnimator && !string.IsNullOrEmpty(furnaceTakeAction))
        {
            furnaceAnimator.Play(furnaceTakeAction);
        }

        mFurnaceActionLastTime = Time.time;
        if (mFurnaceActionRout == null)
        {
            mFurnaceActionRout = StartCoroutine(DoFurnaceAction());
        }

        if (rockSelector.rockCount == 0)
        {
            StartCoroutine(DoChangeInterface());
        }
    }
コード例 #2
0
    IEnumerator DoRockSelect()
    {
        var rockCount = inventory.rocksCount;

        if (rockCount > 0)
        {
            rockSelect.Refresh(true, null);

            yield return(rockSelectSequence.Enter());

            rockSelect.Select();

            mRockSelect = null;
            while (!mRockSelect)
            {
                yield return(null);
            }

            yield return(rockSelectSequence.Exit());

            //fail-safe if no metaOutput
            if (!mRockSelect.metaOutput)
            {
                Debug.LogWarning("Rock does not have a meta output: " + mRockSelect.name);
                StartCoroutine(DoRockSelect());
                yield break;
            }

            //generate rock
            if (mRockSelect.count > 0)
            {
                if (!GlobalSettings.isUnlimitedResource)
                {
                    mRockSelect.count--;
                }
                criteria.InvokeUpdate(mRockSelect);
            }

            if (GlobalSettings.isUnlimitedResource)
            {
                mRockSelect.metaOutput.count = GlobalSettings.unlimitedResourceRock;
            }
            else
            {
                mRockSelect.metaOutput.count++;
            }

            mRockResultList.Clear();
            mRockResultList.Add(mRockSelect.metaOutput);
            //

            //animation

            //rock enter
            rockSpriteShape.spriteShape = mRockSelect.spriteShape;

            rockAnimator.gameObject.SetActive(true);

            yield return(rockAnimator.PlayWait(rockTakeEnter));

            //meta morph enter
            metaMorphAnimator.gameObject.SetActive(true);

            yield return(metaMorphAnimator.PlayWait(metaMorphTakeEnter));

            //rock result play
            M8.SoundPlaylist.instance.Play(soundMorph, false);

            rockResultSpriteShape.spriteShape = mRockSelect.metaOutput.spriteShape;

            rockResultAnimator.gameObject.SetActive(true);

            yield return(rockResultAnimator.PlayWait(rockResultTakeEnter));

            //

            rockAnimator.gameObject.SetActive(false);

            //meta morph leave
            yield return(metaMorphAnimator.PlayWait(metaMorphTakeExit));

            metaMorphAnimator.gameObject.SetActive(false);

            criteria.InvokeUpdate(mRockSelect.metaOutput);

            StartCoroutine(DoRockResult());
        }
        else
        {
            //notify that rocks are needed.
            if (noRocksGO)
            {
                noRocksGO.SetActive(true);
            }

            //exitButton.Select();
        }
    }
コード例 #3
0
    IEnumerator DoCompactCementation()
    {
        //setup output
        RockSedimentaryData        rockOutput = null;
        List <RockSedimentaryData> rockList   = null;

        switch (mCurMode)
        {
        case SourceMode.Rock:
            var grainType = (GrainSize)(mErosionCount - 1);
            rockList = mClasticOutput[grainType];
            break;

        case SourceMode.Organic:
            var source = mSourceSelects[0];
            rockList = mOrganicOutput[source];
            break;
        }

        mSourceSelects.Clear();

        if (rockList != null)
        {
            rockOutput = rockList[Random.Range(0, rockList.Count)];

            if (GlobalSettings.isUnlimitedResource)
            {
                rockOutput.count = GlobalSettings.unlimitedResourceRock;
            }
            else
            {
                rockOutput.count += inventory.sedimentaryRockCount;
            }
        }
        //

        //setup display
        if (rockOutput)
        {
            if (sedimentaryRockSprite)
            {
                sedimentaryRockSprite.spriteShape = rockOutput.spriteShape;
            }
        }

        M8.SoundPlaylist.instance.Play(soundRain, false);

        //play animation
        if (compactCementAnimator)
        {
            compactCementAnimator.gameObject.SetActive(true);

            if (!string.IsNullOrEmpty(compactCementTakePlay))
            {
                yield return(compactCementAnimator.PlayWait(compactCementTakePlay));
            }
        }

        //clear out previous mode
        switch (mCurMode)
        {
        case SourceMode.Rock:
            erosionSpriteLayer.gameObject.SetActive(false);
            break;

        case SourceMode.Organic:
            //clear out rock layer display
            for (int i = 0; i < sourceSpawners.Length; i++)
            {
                sourceSpawners[i].Reset();
            }
            break;
        }

        mRockResultList.Clear();
        mRockResultList.Add(rockOutput);

        criteria.InvokeUpdate(rockOutput);

        yield return(new WaitForSeconds(compactCementDelay));

        StartCoroutine(DoRockResult());
    }