コード例 #1
0
    private void GenerateEvent()
    {
        //ClickerEvent click = new ClickerEvent(); ChoiceEvent choice = new ChoiceEvent();
        float probability = Random.Range(0f, 1f);

        if (probability <= clickChoiceRatio)
        {
            clickChoiceRatio -= ratioChanger;
            if (GameController.instance.roomOverseer.GetAllSceneObjects().Count > 0)
            {
                ePanel.SetPanel((ClickerEvent)GetEvent <ClickerEvent>());
            }
            else
            {
                ePanel.SetPanel((ChoiceEvent)GetEvent <ChoiceEvent>());
            }
        }
        else if (probability > clickChoiceRatio)
        {
            clickChoiceRatio += ratioChanger;
            ePanel.SetPanel((ChoiceEvent)GetEvent <ChoiceEvent>());
        }
        clickChoiceRatio = Mathf.Clamp01(clickChoiceRatio);
    }