示例#1
0
        public static void SetSize(IStatsCollection statsCollection, int quantity)
        {
            ITrait trait = statsCollection.GetStat(sizeTraitId);

            if (trait != null)
            {
                trait.Quantity = quantity;
            }
        }
示例#2
0
        public static void SetAttackStrength(IStatsCollection statsCollection, int quantity)
        {
            ITrait trait = statsCollection.GetStat(attackStrengthTraitId);

            if (trait != null)
            {
                trait.Quantity = quantity;
            }
        }
示例#3
0
        public static int GetDefenseStrength(IStatsCollection statsCollection)
        {
            ITrait trait = statsCollection.GetStat(defenseStrengthTraitId);

            if (trait == null)
            {
                return(defaultDefenseStrength);
            }
            return(Mathf.Clamp(trait.Quantity, minDefenseStrength, maxDefenseStrength));
        }
示例#4
0
        public static int GetMoveRadius(IStatsCollection statsCollection)
        {
            ITrait trait = statsCollection.GetStat(moveRadiusTraitId);

            if (trait == null)
            {
                return(0);
            }
            return(trait.Quantity);
        }
示例#5
0
        static float GetSpeed(IStatsCollection statsCollection)
        {
            ITrait trait = statsCollection.GetStat(speedTraitId);

            if (trait == null)
            {
                return(defaultSpeed);
            }
            return(Mathf.Clamp(trait.Quantity * 1.0f, minSpeed, maxSpeed));
        }
示例#6
0
        public static int GetSize(IStatsCollection statsCollection)
        {
            ITrait trait = statsCollection.GetStat(sizeTraitId);

            if (trait == null)
            {
                return(0);
            }
            return(trait.Quantity);
        }
        public SensorStateStatsProcessor(
            ILogger logger,
            IClientsCollection clientsCollection,
            IStatsCollection statsCollection,
            ISensorsHistoryTable sensorsHistory,
            IClientsHistoryTable clientsHistory)
        {
            if (logger == null) throw new ArgumentNullException(nameof(logger));
            if (clientsCollection == null) throw new ArgumentNullException(nameof(clientsCollection));
            if (statsCollection == null) throw new ArgumentNullException(nameof(statsCollection));
            if (sensorsHistory == null) throw new ArgumentNullException(nameof(sensorsHistory));
            if (clientsHistory == null) throw new ArgumentNullException(nameof(clientsHistory));

            _logger = logger;
            _clientsCollection = clientsCollection;
            _statsCollection = statsCollection;
            _sensorsHistory = sensorsHistory;
            _clientsHistory = clientsHistory;
        }
示例#8
0
        public static int GetRandomAttackStrength(IStatsCollection statsCollection)
        {
            float attackStrength = GetAttackStrength(statsCollection);

            return(Mathf.RoundToInt(Random.Range(minAttackStrength, attackStrength)));
        }
示例#9
0
 static float GetSpeedPercentage(IStatsCollection statsCollection)
 {
     return(Mathf.InverseLerp(minSpeed, maxSpeed, GetSpeed(statsCollection)));
 }
示例#10
0
 public static float GetMoveSpeed(IStatsCollection statsCollection)
 {
     return(Mathf.Lerp(minMoveSpeed, maxMoveSpeed, GetSpeedPercentage(statsCollection)));
 }
示例#11
0
        public static int GetRandomDefenseStrength(IStatsCollection statsCollection)
        {
            float defenseStrength = GetDefenseStrength(statsCollection);

            return(Mathf.RoundToInt(Random.Range(minDefenseStrength, defenseStrength)));
        }