Exemplo n.º 1
0
    public void Start(Joycon joycon)
    {
        this.joycon = joycon;
        this.bottle.Init();
        this.cork.Init();

        this.rumbleAmp         = this.minRumbleAmp;
        this.rumbleTimer       = this.rumbleTime;
        this.randomRumbleTimer = MainGameManager.GetRandomFloat(0.0f, this.maxInterval);
    }
Exemplo n.º 2
0
    void UpdateRumble()
    {
        // 振動生成
        this.randomRumbleTimer -= Time.deltaTime;
        if (this.randomRumbleTimer < 0f)
        {
            this.randomRumbleTimer = MainGameManager.GetRandomFloat(0.0f, Mathf.Lerp(this.maxInterval, this.mostMinInterval, this.power / this.powerLimit));

            // 通常の振動時間にwaitingMultipleAmpをかけて、通常より短い時間
            this.rumbleTimer = this.rumbleTime * this.waitingMultipleAmp;
        }

        // 振動
        this.rumbleTimer -= Time.deltaTime;
        if (this.rumbleTimer <= 0f)
        {
            this.rumbleTimer = 0f;
        }

        this.joycon.SetRumble(160f, 320f, Mathf.Lerp(this.minRumbleAmp, this.rumbleAmp, this.rumbleTimer / this.rumbleTime), 15);
    }