Esempio n. 1
0
 public void CharacterCannotBeAddedToArenaWhenFloorNotBuilt()
 {
     var a = new Arena();
     var c = new Character();
     c.SetName("YoMomma");
     a.AddCharacterToArena(c);
 }
Esempio n. 2
0
 public void CannotEquipEquipmentIfCharacterDoesNotHaveEnoughFreeSlots()
 {
     var c = new Character();
     var e = new TestHelpers.TestWeapon();
     e.AddSlotType(new Hand());
     e.AddSlotType(new Hand());
     e.AddSlotType(new Hand());
     Assert.IsFalse(c.CanEquipEquipment(e));
 }
Esempio n. 3
0
        public void CharacterCanBeAddedToArena()
        {
            var a = new Arena();
            a.BuildArenaFloor(5);
            var c = new Character();
            c.SetName("YoMomma");
            a.AddCharacterToArena(c);

            Assert.IsTrue(a.Characters.Exists(i => i.Name == "YoMomma"));
        }
Esempio n. 4
0
 public void CharacterCanPerformAttackActionWhenWithinRange()
 {
     var c = new Character();
     c.SetCharacterLocation(0, 0);
     var o = new Character();
     o.SetCharacterLocation(1, 1);
     var e = new TestHelpers.TestWeapon();
     c.EquipEquipment(e);
     var s = new TestHelpers.TestAttack();
     Assert.IsTrue(s.CanBePerformed(c, o));
 }
Esempio n. 5
0
 public void CharacterCannotPerformAttackWhenOutOfRange()
 {
     var c = new Character();
     c.SetCharacterLocation(0, 0);
     var o = new Character();
     o.SetCharacterLocation(10, 10);
     var e = new TestHelpers.TestWeapon();
     c.EquipEquipment(e);
     var s = new TestHelpers.TestAttack();
     Assert.IsFalse(s.CanBePerformed(c, o));
 }
Esempio n. 6
0
 public void initialize(GameLogic.CharacterInstance characterInstance, GameLogic.Character character)
 {
     this.CharacterInstance = characterInstance;
     this.Character         = character;
     if ((characterInstance == null) && (character == null))
     {
         this.UpgradeButton.gameObject.SetActive(false);
         this.ProgressBar.gameObject.SetActive(true);
         this.ProgressBar.setNormalizedValue(0f);
         this.HeroButton.interactable = false;
         this.Bg.material             = this.m_greyscaleMaterial;
         this.Icon.sprite             = PlayerView.Binder.SpriteResources.getSprite("Menu", "avatar_hero001");
         this.Icon.material           = this.m_greyscaleMaterial;
         this.LevelIcon.material      = this.m_greyscaleMaterial;
         this.LevelText.text          = string.Empty;
     }
     else if (characterInstance != null)
     {
         this.UpgradeButton.gameObject.SetActive(true);
         this.ProgressBar.gameObject.SetActive(false);
         this.HeroButton.interactable = true;
         this.Bg.material             = null;
         this.Icon.sprite             = PlayerView.Binder.SpriteResources.getSprite("Menu", characterInstance.Character.AvatarSpriteId);
         this.Icon.material           = null;
         this.LevelIcon.material      = null;
         this.LevelText.text          = characterInstance.Rank.ToString();
     }
     else
     {
         this.UpgradeButton.gameObject.SetActive(false);
         this.ProgressBar.gameObject.SetActive(true);
         this.HeroButton.interactable = true;
         this.Bg.material             = this.m_greyscaleMaterial;
         this.Icon.sprite             = PlayerView.Binder.SpriteResources.getSprite("Menu", character.AvatarSpriteId);
         this.Icon.material           = this.m_greyscaleMaterial;
         this.LevelIcon.material      = this.m_greyscaleMaterial;
         this.LevelText.text          = string.Empty;
     }
 }
Esempio n. 7
0
 public void EquipEquipmentUpdatesCharacterEquipmentSlotsToUsed()
 {
     var c = new Character();
     var e = new TestHelpers.TestWeapon();
     e.AddSlotType(new Hand());
     c.EquipEquipment(e);
     Assert.IsTrue(c.Slots.Exists(x => !x.SlotFree && x.SlotEquipmentName == e.Name));
 }
Esempio n. 8
0
 public void EquipEquipmentAddsEquipmentToCharactersEquipment()
 {
     var c = new Character();
     var e = new TestHelpers.TestWeapon();
     c.EquipEquipment(e);
     Assert.IsTrue(c.CharacterEquipment.Exists(x => x == e));
 }
Esempio n. 9
0
 public void CharacterLocationCanBeSet()
 {
     var c = new Character();
     c.SetCharacterLocation(1, 2);
     Assert.IsTrue(c.CharacterLocation.XCoord == 1 && c.CharacterLocation.YCoord == 2);
 }
Esempio n. 10
0
 public void CanEquipEquipmentIfCharacterHasFreeSlots()
 {
     var c = new Character();
     var e = new TestHelpers.TestWeapon();
     Assert.IsTrue(c.CanEquipEquipment(e));
 }
Esempio n. 11
0
 public void UnEquipEquipmentRemovesEquipmentFromCharactersEquipment()
 {
     var c = new Character();
     var e = new TestHelpers.TestWeapon();
     c.EquipEquipment(e);
     c.UnEquipEquipment(e);
     Assert.IsFalse(c.CharacterEquipment.Exists(x => x == e));
 }
Esempio n. 12
0
 public void UnEquipEquipmentFreesCharactersEquipmentSlots()
 {
     var c = new Character();
     var e = new TestHelpers.TestWeapon();
     c.EquipEquipment(e);
     c.UnEquipEquipment(e);
     Assert.IsFalse(c.Slots.Exists(x => !x.SlotFree || x.SlotEquipmentName == e.Name));
 }
Esempio n. 13
0
 public void PlayerHasAvailableActionsFromEquippedEquipment()
 {
     var c = new Character();
     var e = new TestHelpers.TestWeapon();
     c.EquipEquipment(e);
     var e2 = new TestHelpers.TestWeapon2();
     c.EquipEquipment(e2);
     Assert.IsTrue(c.AvailableActions.Exists(i => i.Name == "Test Attack") && c.AvailableActions.Exists(i => i.Name == "Test Attack2"));
 }
Esempio n. 14
0
 public void PlayerAvailableActionsAreDistinct()
 {
     var c = new Character();
     var e = new TestHelpers.TestWeapon();
     c.EquipEquipment(e);
     c.EquipEquipment(e);
     Assert.IsTrue(c.AvailableActions.FindAll(i => i.Name == "Test Attack").Count == 1);
 }
Esempio n. 15
0
 public void EquipEquipmentWhenCharacterDoesNotHaveEnoughFreeSlotsThrowsException()
 {
     var c = new Character();
     var e = new TestHelpers.TestWeapon();
     e.AddSlotType(new Hand());
     e.AddSlotType(new Hand());
     e.AddSlotType(new Hand());
     c.EquipEquipment(e);
 }