Пример #1
0
 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;
 }
Пример #2
0
 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;
 }
Пример #3
0
        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);
        }
Пример #4
0
 public void SetSpeedMovementByHealthState(IHealthState healthState)
 {
     _speedMovement = healthState.MovementSpeed;
 }
Пример #5
0
 public void SetHealthState(IHealthState healthState)
 {
     HealthState = healthState;
     UpdateSprite();
 }
Пример #6
0
 public void SetHealthState(IHealthState state) => Health = state;
Пример #7
0
        public void SetHealth(HealthStatesEnum healthState)
        {
            IHealthState selectedHealthState = _healthInvoker.GetHealthState((int)healthState);

            _healthReservePoints = (selectedHealthState.HealthPoints);
        }