示例#1
0
 void Start()
 {
     _healAmountPerSec    = GameConfigRepository.LoadStaminaHealAmount();
     _consumeAmountPerTap = GameConfigRepository.LoadStaminaConsumeAmount();
     _currentAmount       = InGameParameters.PlayerStaminaMax;
     _isPause             = false;
 }
示例#2
0
    void Start()
    {
        Debug.Assert(_dropdownMovementFunction != null);
        Debug.Assert(_dropdownStaminaHealAmount != null);
        Debug.Assert(_dropdownStaminaConsumeAmount != null);

        _movementFunctionOptions = new MovementFunctionOption[] {
            new MovementFunctionOption(
                PlayerMovementMathFunctions.Type.LinerEquation01,
                "1次方程式01"
                ),
            new MovementFunctionOption(
                PlayerMovementMathFunctions.Type.QuarticEquation01,
                "2次方程式01"
                ),
        };
        _staminaHealAmountOptions = Enumerable.Range((int)InGameParameters.StaminaHealAmountMin, (int)(InGameParameters.StaminaHealAmountMax - InGameParameters.StaminaHealAmountMin + 1))
                                    .Select((x) => (float)x)
                                    .ToArray();
        _staminaConsumeAmountOptions = Enumerable.Range((int)InGameParameters.StaminaConsumeAmountMin, (int)(InGameParameters.StaminaConsumeAmountMax - InGameParameters.StaminaConsumeAmountMin + 1))
                                       .Select((x) => (float)x)
                                       .ToArray();

        List <string> labels = _movementFunctionOptions.Select(x => x.Label).ToList();
        int           index  = System.Array.FindIndex(_movementFunctionOptions, x => x.Type == GameConfigRepository.LoadMovementEquationType());

        _dropdownMovementFunction.ClearOptions();
        _dropdownMovementFunction.AddOptions(labels);
        _dropdownMovementFunction.value = (index != -1) ? index : 0;


        labels = _staminaHealAmountOptions.Select(x => x.ToString("")).ToList();
        index  = System.Array.FindIndex(_staminaHealAmountOptions, x => x == GameConfigRepository.LoadStaminaHealAmount());
        _dropdownStaminaHealAmount.ClearOptions();
        _dropdownStaminaHealAmount.AddOptions(labels);
        _dropdownStaminaHealAmount.value = (index != -1) ? index : 0;


        labels = _staminaConsumeAmountOptions.Select(x => x.ToString("")).ToList();
        index  = System.Array.FindIndex(_staminaConsumeAmountOptions, x => x == GameConfigRepository.LoadStaminaConsumeAmount());
        _dropdownStaminaConsumeAmount.ClearOptions();
        _dropdownStaminaConsumeAmount.AddOptions(labels);
        _dropdownStaminaConsumeAmount.value = (index != -1) ? index : 0;
    }