コード例 #1
0
ファイル: CopResume.cs プロジェクト: Jake88/3DCopsAndRobbers
        public CopResume(CopData copData, string name, float movementSpeed, float attackSpeed, int damage, int baseSalary, Ability[] abilities = null)
        {
            CopData       = copData;
            Name          = name;
            MovementSpeed = movementSpeed;
            AttackSpeed   = attackSpeed;
            Damage        = damage;
            BaseSalary    = baseSalary;
            Abilities     = abilities != null ? abilities : new Ability[0];

            MovementSpeedString = String.Format(DECIMAL_FORMAT, MovementSpeed);
            AttackSpeedString   = String.Format(DECIMAL_FORMAT, AttackSpeed);
            DamageString        = Damage.ToString();
            BaseSalaryString    = BaseSalary.ToString();
        }
コード例 #2
0
        public CopResume GenerateCop(CopData _data)
        {
            var name = $"{_firstNames[Random.Range(0, _firstNames.Length)]} {_lastNames[Random.Range(0, _lastNames.Length)]}";

            var abilities = RefManager.AbilityFactory.GetCopAbilities(_data.AbilityFlags, _data.RandomAbilityCount);

            return(new CopResume(
                       _data,
                       name,
                       ApplyVariance(_data.InitialMovementSpeed, _movementSpeedVariance),
                       ApplyVariance(_data.InitialAttackSpeed, _attackSpeedVariance),
                       ApplyVariance(_data.InitialDamage, _damageVariance),
                       ApplyVariance(_data.InitialCost, _baseSalaryVariance),
                       abilities
                       ));
        }