コード例 #1
0
 /// <summary>
 /// Constructor for PREventEffect which takes a string
 /// </summary>
 /// <param name="toParse"></param>
 public PREventEffect(String toParse)
 {
     String[] effectElemnts = toParse.Split(':');
     if (int.TryParse(effectElemnts[2], out minimum) && int.TryParse(effectElemnts[3], out maximum))
     {
         resource = new PrimaryResource(minimum, effectElemnts[1]);
     }
     result = effectElemnts[4];
 }
コード例 #2
0
ファイル: TPCModel.cs プロジェクト: arpond/longRoadHome
        public void PCModel_ModififyPrimaryResource()
        {
            var pc  = pcm.GetPC();
            var pr1 = new PrimaryResource(10, PlayerCharacter.HEALTH);
            var pr2 = new PrimaryResource(20, PlayerCharacter.HEALTH);
            var pr3 = new PrimaryResource(-30, PlayerCharacter.HEALTH);
            var pr4 = new PrimaryResource(-100, PlayerCharacter.HEALTH);

            pcm.ModifyPrimaryResource(pr1, pr1.GetAmount());
            Assert.AreEqual(90, pc.GetResource(PlayerCharacter.HEALTH), "Health should be incremented by 10");

            pcm.ModifyPrimaryResource(pr2, pr2.GetAmount());
            Assert.AreEqual(100, pc.GetResource(PlayerCharacter.HEALTH), "Health should be capped at 100");

            pcm.ModifyPrimaryResource(pr3, pr3.GetAmount());
            Assert.AreEqual(70, pc.GetResource(PlayerCharacter.HEALTH), "Health should be reduced by 30");

            pcm.ModifyPrimaryResource(pr4, pr4.GetAmount());
            Assert.AreEqual(0, pc.GetResource(PlayerCharacter.HEALTH), "Health should be capped at 0");
        }
コード例 #3
0
 public PREventEffect()
 {
     minimum  = 0;
     maximum  = 0;
     resource = new PrimaryResource(minimum, PlayerCharacter.PlayerCharacter.HEALTH);
 }