コード例 #1
0
 /// <summary>
 /// Setup for <see cref="KillScore"/>. <see cref="KillScore"/> Scales with <see cref="Character.MaxHealth"/> and <see cref="DifficultyModifier"/>
 /// </summary>
 private void SetKillScore()
 {
     KillScore = new DifficultyAware(
         MaxHealth / 10,
         DifficultyModifier,
         (x) => x.BaseValue * x.DifficultyModifier
         );
 }
コード例 #2
0
    protected override void Start()
    {
        // Creating Difficulty aware DefensiveActionChance. Chance grows exponentially with DifficultyModifier, but never goes over 50%
        DefensiveActionChance = new DifficultyAware(
            10,                                    // 10% base chance to block
            ((Enemy)Character).DifficultyModifier, // DifficultyModifier
            x => Mathf.Clamp(x.BaseValue * Mathf.Pow(x.DifficultyModifier, 2), 10, 50)
            );

        AttackDelay = new DifficultyAware(
            1f,                                     // Seconds,
            ((Enemy)Character).DifficultyModifier,
            x => x.BaseValue / x.DifficultyModifier // Attack delay will get smaller as the difficulty rises.
            );

        base.Start();
        GameController.Instance.Player.Combat.OnAttackStart += OnPlayerAttacking;

        AddRandomWeaponToInventory();
        AddRandomConsumableItemsToInventory();
    }