예제 #1
0
        public void GainMastery(TransformationDefinition definition, float gain)
        {
            PlayerTransformation playerTransformation = AcquiredTransformations[definition];
            float maxMastery = playerTransformation.Definition.GetMaxMastery(this);

            if (playerTransformation.CurrentMastery >= maxMastery)
            {
                return;
            }

            if (playerTransformation.CurrentMastery + gain > maxMastery)
            {
                gain = maxMastery - playerTransformation.CurrentMastery;
            }

            if (Trait != null)
            {
                Trait.OnPlayerMasteryGained(this, ref gain, playerTransformation.CurrentMastery);
            }

            playerTransformation.CurrentMastery += gain;
            definition.OnPlayerMasteryGain(this, gain, playerTransformation.CurrentMastery);
        }
예제 #2
0
        public void ChangeMastery(TransformationDefinition definition, float change)
        {
            PlayerTransformation playerTransformation = AcquiredTransformations[definition];
            float maxMastery = playerTransformation.Definition.GetMaxMastery(this);

            if (playerTransformation.CurrentMastery >= maxMastery)
            {
                return;
            }

            if (playerTransformation.CurrentMastery + change > maxMastery)
            {
                change = maxMastery - playerTransformation.CurrentMastery;
            }

            if (Trait != null)
            {
                Trait.OnPlayerMasteryGained(this, ref change, playerTransformation.CurrentMastery);
            }

            playerTransformation.ChangeMastery(this, change);
            definition.OnPlayerMasteryChanged(this, change, playerTransformation.CurrentMastery);
        }