コード例 #1
0
 public PlayerBattleStats(Solidity solidity, int maxEnergy, int energyRegen, WeaponInfo[] weapons) : base(solidity)
 {
     _energy         = new BoundedInt(maxEnergy, 0, maxEnergy);
     EnergyRegen     = energyRegen;
     Weapons         = weapons;
     CurrentWeaponId = 0;
 }
コード例 #2
0
        public void CtorTest()
        {
            BoundedInt value = new BoundedInt(0, 99);

            value.Value = 50;

            Assert.AreEqual(50, value);
        }
コード例 #3
0
        public void ValueInRange_Value_CastsImplicitlyToInt()
        {
            var boundedInt = new BoundedInt(1, 3, 2);

            int value = boundedInt;

            value.ShouldBe(2);
        }
コード例 #4
0
        public void ValueInRange_Value_ReturnsValue(int value)
        {
            var boundedInt = new BoundedInt(1, 3, 2);

            boundedInt.Value = value;

            boundedInt.Value.ShouldBe(value);
        }
コード例 #5
0
        public void OutOfRangeValue_Value_ReturnsDefault(int value)
        {
            var boundedInt = new BoundedInt(10, 20, 15);

            boundedInt.Value = value;

            boundedInt.Value.ShouldBe(15);
        }
コード例 #6
0
ファイル: Character.cs プロジェクト: CDMcGwire/TurnBasedRPG
 public Character(Character other)
 {
     characterName    = other.Name;
     health           = other.Health;
     poise            = other.Poise;
     speed            = other.Speed;
     defenses         = other.Defenses;
     combatSprite     = other.combatSprite;
     combatController = other.combatController;
     actions          = new List <ActionData>(other.actions);
 }
コード例 #7
0
        public static List <BoundedInt> GenerateIndices <T>(List <List <T> > x)
        {
            var result = new List <BoundedInt>();
            var bi     = new BoundedInt();

            bi.Value = 0;
            for (var i = 0; i < x.Count; i++)
            {
                bi.UpperLimit = x[i].Count - 1;
                result.Add(new BoundedInt(bi));
            }

            return(result);
        }
コード例 #8
0
    // Create a RepFR open-stim word list from a list of repetitions and counts,
    // and a list of candidate words.
    public static StimWordList Generate(
        RepCounts rep_cnts,
        List <string> input_words,
        bool do_stim,
        double top_percent_spaced = 0.2)
    {
        var shuffled = Shuffle(input_words);

        var repeats = new List <RepWordList>();
        var singles = new RepWordList();

        var shuf = new BoundedInt(shuffled.Count,
                                  "Words required exceeded input word list size.");

        foreach (var rc in rep_cnts)
        {
            if (rc.rep == 1)
            {
                for (int i = 0; i < rc.count; i++)
                {
                    singles.Add(shuffled[shuf.i++]);
                }
            }
            else if (rc.rep > 1 && rc.count > 0)
            {
                var rep_words = new RepWordList(rc.rep);
                for (int i = 0; i < rc.count; i++)
                {
                    rep_words.Add(shuffled[shuf.i++]);
                }
                repeats.Add(rep_words);
            }
        }

        return(Generate(repeats, singles, do_stim, top_percent_spaced));
    }
コード例 #9
0
        public void ValueTooBig()
        {
            BoundedInt value = new BoundedInt(0, 99);

            value.Value = 100;
        }
コード例 #10
0
        public void ValueTooSmall()
        {
            BoundedInt value = new BoundedInt(0, 99);

            value.Value = -1;
        }
コード例 #11
0
        public void InitialValueTest()
        {
            BoundedInt value = new BoundedInt(50, 99);

            Assert.AreEqual(50, value);
        }
コード例 #12
0
ファイル: Solidity.cs プロジェクト: GhostQuestTeam/GhostQuest
 private void _changeHealth(int healthDelta)
 {
     CurrentHealth += healthDelta;
     CurrentHealth  = BoundedInt.Clamp(CurrentHealth, (int)MaxHealth);
 }
コード例 #13
0
ファイル: BoundedInt.cs プロジェクト: CDMcGwire/TurnBasedRPG
 public BoundedInt(BoundedInt other)
     : this(other.min, other.max, other.current)
 {
 }