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); }
public void TestCharacterEntered() { Trap trap = new Trap(); ICharacterMover characterMover = Substitute.For <ICharacterMover>(); trap.HandleCharacterEntered(characterMover); Assert.AreEqual(-1, characterMover.Health); }
public void InitializeCharacter(CharacterSettings settings) { this.settings = settings; isPlayer = !settings.IsAi; isAlive = true; //create input for player or AI nav input = !isPlayer ? new AIInputNav(settings, transform, this) as ICharacterInput : new PlayerInput(transform); //create mover characterMover = !isPlayer ? new AIMover(input, gameObject, settings) as ICharacterMover : new PlayerMover(input, transform, settings); //create character combat characterCombat = new CharacterCombat(input, settings.Health, gameObject, this); charAnim = gameObject.GetComponentInChildren <CharacterAnimationController>(); }
public void HandleCharacterEntered(ICharacterMover characterMover) { characterMover.Health--; }
// Use this for initialization void Start() { joyStick = GameObject.FindGameObjectWithTag("JoyStick").GetComponent <JoyStick>(); mover = (ICharacterMover)chaMover; }