コード例 #1
0
        public void PlayerEnteringTrap_RecudesHealthByOne()
        {
            Trap            trap           = new Trap();
            ICharacterMover characterMover = Substitute.For <ICharacterMover>();

            trap.HandleCharacterEntered(characterMover);
            Debug.Log("health: " + characterMover.Health);
            Assert.AreEqual(-1, characterMover.Health);
        }
コード例 #2
0
        public void TestCharacterEntered()
        {
            Trap trap = new Trap();

            ICharacterMover characterMover = Substitute.For <ICharacterMover>();

            trap.HandleCharacterEntered(characterMover);

            Assert.AreEqual(-1, characterMover.Health);
        }
コード例 #3
0
    public void EnttiyEntering_TargetedTrap_ChangesHealth(EntityType entityType, TrapTargetType trapTargetType, int expectedHealthChange)
    {
        //Arrange
        var trap   = new Trap();
        var player = Substitute.For <IEntity>();

        player.entityType.Returns(entityType);
        var startingHealth = player.health;

        //Act
        trap.HandleCharacterEntered(player, trapTargetType);

        //Assert
        Assert.AreEqual(expectedHealthChange, player.health - startingHealth);
    }
コード例 #4
0
    private void OnTriggerEnter(Collider other)
    {
        var characterMover = other.GetComponent <IEntity>();

        _trap.HandleCharacterEntered(characterMover, trapTargetType);
    }
コード例 #5
0
    private void OnTriggerEnter(Collider other)
    {
        var characterMover = other.GetComponent <ICharacterMover>();

        trap.HandleCharacterEntered(characterMover);
    }