示例#1
0
    public void Update()
    {
        if (flag.CheckBit(TimerState.Exception))
        {
            flag.FoldBit(TimerState.Finish);
        }

        if (!flag.CheckBit(TimerState.Start))
        {
            return;
        }
        if (flag.CheckBit(TimerState.Pause))
        {
            return;
        }

        //1フレームにかかった時間を加算
        CountSeconds += Time.deltaTime;
        if (CountSeconds >= 1.0f)
        {
            CountSeconds = 0.0f;
            //カウントダウン処理
            if (--seconds < 0)
            {
                seconds = minute > 0 ? 59 : 0;
                minute  = Mathf.Max(minute - 1, 0);
            }

            //タイマー終了
            if (minute == 0 && seconds == 0)
            {
                flag.FoldBit(TimerState.Start);
                flag.AddBit(TimerState.Finish);
            }

            if (!flag.CheckBit(TimerState.Finish))
            {
                return;
            }

            //タイマーをループさせる場合
            if (flag.CheckBit(TimerState.Loop))
            {
                seconds = initSeconds;
                minute  = initMinute;
                flag.AddBit(TimerState.Start);
            }
        }
    }
    public void AddSatisfy()
    {
        delay.Update();
        if (!delay.IsFinish())
        {
            return;
        }

        //天かすの数によって満足度が溜まりにくくなる
        var koromoFac = GameObject.Find("KoromoManager").GetComponent <SpawnFactory>();

        if (satisfyValue < MaxSatisfyValue)
        {
            GameDirector.totalSatisfyValue += AddSatisfyValue - koromoFac.GetCurrentNum();
        }

        satisfyValue = Mathf.Clamp(satisfyValue + AddSatisfyValue, MinSatisfyValue, MaxSatisfyValue);

        //満足度が最高のとき
        if (satisfyValue == MaxSatisfyValue)
        {
            if (!IsFull())
            {
                SoundMan.Instance.PlaySE("happy");
            }
            state.AddBit(State.Full);
        }
    }
示例#3
0
    // Start is called before the first frame update
    void Start()
    {
        state.FoldALLBit();
        state.AddBit(State.Normal);

        face = CharaFaceState.Normal;

        //このオブジェクトのSprteRender取得
        spriteRenderer = gameObject.GetComponent <SpriteRenderer>();

        var obj = GameObject.Find("Themometer_main");

        themoCtrl = obj.GetComponent <ThemometerController>();

        obj      = GameObject.Find("ThemoRangeGauge");
        themoMan = obj.GetComponent <ThemoManager>();

        obj         = GameObject.Find("CustomerManager");
        customerFac = obj.GetComponent <SpawnFactory>();

        animator = GetComponent <Animator>();
        animator.SetBool("Grab", false);
        animator.SetBool("Walk", false);


        //揚げ時間
        friedTimer = new Timer(BurnFriedTime);
        friedTimer.Start();


        //リアクション
        reactionState = ReactionState.None;
        reactionTimer = new Timer(6);
        reactionDisp  = new Vector3(0.5f, 0.5f, PosZ - 0.01f);;
        reactionTimer.EnabledLoop();
        reactionTimer.Start();

        GameDirector.totalCustomerNum++;
    }