コード例 #1
0
ファイル: MiniGameYoga.cs プロジェクト: galen-manuel/BearJam
    private void InitTask()
    {
        // Generate a random key for sets of controls
        Constants.ActionType[] keys    = new Constants.ActionType[] { Constants.ActionType.Buttons, Constants.ActionType.BumpersAndTriggers };
        Constants.ActionType   randKey = keys[Random.Range(0, keys.Length)];

        // BumpersAndTriggers is a special override not used in the main dictionary.
        _controlPool.AddRange(_availableControls[randKey]);

        // Set time to scale each button
        _timeToScale = _timeToComplete / _controlPool.Count;
        _minTime     = _timeToScale - ERROR_BUFFER;
        _maxTime     = _timeToScale + ERROR_BUFFER;

        var assembly = System.Reflection.Assembly.GetAssembly(typeof(UnityEditor.SceneView));
        var type     = assembly.GetType("UnityEditor.LogEntries");
        var method   = type.GetMethod("Clear");

        method.Invoke(new object(), null);

        Debug.Log("[YOGA] - Time To Scale: " + _timeToScale);
        Debug.LogFormat("[YOGA] - Low End {0} - High End {1}", _minTime, _maxTime);

        for (int i = 0; i < _controlPool.Count; i++)
        {
            GenerateNewControl();
        }

        _currentControl = _taskActions.Peek().controlType;
    }
コード例 #2
0
ファイル: MiniGame.cs プロジェクト: galen-manuel/BearJam
    public InputControlType GetRandomControl()
    {
        Constants.ActionType randKey = (Constants.ActionType)Random.Range(0, (int)Constants.ActionType.All);
        int randIndex = Random.Range(0, _availableControls[randKey].Length);

        return(_availableControls[randKey][randIndex]);
    }