public Mario(Vector2 location, int lives) : base(location) { sprite = SpriteMachine.Instance.CreateSprite(SpriteMachine.SpriteTag.SmallMarioIdleRight); HealthState = new SmallMarioState(this); MovementState = new RightFacingMarioState(this); Physics = new Physics(location, true); this.lives = lives; }
public Mario(Vector2 location) : base(location) { sprite = SpriteMachine.Instance.CreateSprite(SpriteMachine.SpriteTag.SmallMarioIdleRight); HealthState = new SmallMarioState(this); MovementState = new RightFacingMarioState(this); Physics = new Physics(location, true); speedMultiplier = 1.0f; }
public void GetHealthState_Test() { HealthInvoker healthInvoker = new HealthInvoker(); var pointsSuperStrong = 39; IHealthState health = healthInvoker.GetHealthState(pointsSuperStrong); health.HealthStateName.Should().BeEquivalentTo(HealthStatesEnum.SuperStrong); var pointsSuperStrong1 = 25; health = healthInvoker.GetHealthState(pointsSuperStrong1); health.HealthStateName.Should().BeEquivalentTo(HealthStatesEnum.SuperStrong); var pointsStrong = 22; health = healthInvoker.GetHealthState(pointsStrong); health.HealthStateName.Should().BeEquivalentTo(HealthStatesEnum.Strong); var pointsNormal = 17; health = healthInvoker.GetHealthState(pointsNormal); health.HealthStateName.Should().BeEquivalentTo(HealthStatesEnum.Normal); var pointsWeak = 11; health = healthInvoker.GetHealthState(pointsWeak); health.HealthStateName.Should().BeEquivalentTo(HealthStatesEnum.Weak); var pointsIll = 4; health = healthInvoker.GetHealthState(pointsIll); health.HealthStateName.Should().BeEquivalentTo(HealthStatesEnum.Injured); var pointsDead = 0; health = healthInvoker.GetHealthState(pointsDead); health.HealthStateName.Should().BeEquivalentTo(HealthStatesEnum.Dead); }
public void SetSpeedMovementByHealthState(IHealthState healthState) { _speedMovement = healthState.MovementSpeed; }
public void SetHealthState(IHealthState healthState) { HealthState = healthState; UpdateSprite(); }
public void SetHealthState(IHealthState state) => Health = state;
public void SetHealth(HealthStatesEnum healthState) { IHealthState selectedHealthState = _healthInvoker.GetHealthState((int)healthState); _healthReservePoints = (selectedHealthState.HealthPoints); }