Esempio n. 1
0
 public override void ActOnPlayer(Character mainCharacter, MonoGameRenderer renderer)
 {
     if (this.TileRectangle.Contains(mainCharacter.Bounds))
     {
         StateMachine.CurrentState.NextState = StateMachine.FireMap;
         StateMachine.ChangeState();
         StateMachine.CurrentState.Execute(renderer);
     }
 }
Esempio n. 2
0
        public override void ActOnPlayer(Character mainCharacter, MonoGameRenderer renderer)
        {
            if (this.TileRectangle.Intersects(mainCharacter.Bounds))
            {
                renderer.Enemy = this;
                renderer.EnemyHero = UIInitializer.CreateEnemyHero(EntryPoint.Game.Content);
                if (renderer.PoisonMap.EnemyCounter == 1)
                {
                    renderer.EnemyHero.Level = 3;
                    renderer.EnemyHero.Health = renderer.MainHero.MaxHealth;
                    renderer.EnemyHero.Mana = renderer.MainHero.MaxMana;
                }
                else if (renderer.PoisonMap.EnemyCounter == 2)
                {
                    renderer.EnemyHero.Level = 2;
                    renderer.EnemyHero.Health = (int)(renderer.MainHero.MaxHealth * 0.75);
                    renderer.EnemyHero.Mana = (int)(renderer.MainHero.MaxMana * 0.75);
                }
                else if (renderer.PoisonMap.EnemyCounter == 3)
                {
                    renderer.EnemyHero.Level = 1;
                    renderer.EnemyHero.Health = (int)(renderer.MainHero.MaxHealth * 0.60);
                    renderer.EnemyHero.Mana = (int)(renderer.MainHero.MaxMana * 0.60);
                }

                renderer.EnemyHero.Texture = EntryPoint.Game.Content.Load<Texture2D>("BigGreenMage");
                renderer.EnemyHero.MagicSchool = SpellType.Poison;
                renderer.EnemyHero.PlayerSpells = renderer.PoisonSpells;
                renderer.EnemyHero.Update(renderer);

                if (!this.IsDefeated)
                {
                    StateMachine.BattleState.IsInitialized = false;
                    StateMachine.PreviousState = StateMachine.PoisonMap;
                    StateMachine.CurrentState.NextState = StateMachine.BattleState;
                    StateMachine.BattleState.NextState = StateMachine.EndTurnState;
                    StateMachine.EndTurnState.NextState = StateMachine.EnemyTurnState;
                    StateMachine.EnemyTurnState.NextState = StateMachine.BattleState;
                    StateMachine.ChangeState();
                    StateMachine.CurrentState.Execute(renderer);
                }
            }
        }
Esempio n. 3
0
        public override void ActOnPlayer(Character mainCharacter, MonoGameRenderer renderer)
        {
            bool isMainCharacterXInRectangleWhenPressingLeft = mainCharacter.Bounds.Left + mainCharacter.Velocity.X <= TileRectangle.Right &&
                      mainCharacter.Bounds.Left + mainCharacter.Velocity.X >= TileRectangle.Left;

            bool isMainCharacterXInRectangleWhenPressingRight = mainCharacter.Bounds.Right + mainCharacter.Velocity.X >= TileRectangle.Left &&
                 mainCharacter.Bounds.Right + mainCharacter.Velocity.X <= TileRectangle.Right;

            bool isMainCharacterYInRectangleWhenPressingDown = mainCharacter.Bounds.Bottom + mainCharacter.Velocity.Y >= TileRectangle.Top &&
                 mainCharacter.Bounds.Bottom + mainCharacter.Velocity.Y <= TileRectangle.Bottom;

            bool isMainCharacterYInRectangleWhenPressingUp = mainCharacter.Bounds.Top + mainCharacter.Velocity.Y <= TileRectangle.Bottom &&
                 mainCharacter.Bounds.Top + mainCharacter.Velocity.Y >= TileRectangle.Top;

            if (isMainCharacterXInRectangleWhenPressingLeft)
            {
                if (isMainCharacterYInRectangleWhenPressingDown)
                {
                    Vector2 velocity = new Vector2(0, 0);
                    mainCharacter.Velocity = velocity;
                }
                else if (isMainCharacterYInRectangleWhenPressingUp)
                {
                    Vector2 velocity = new Vector2(0, 0);
                    mainCharacter.Velocity = velocity;
                }
            }

            if (isMainCharacterXInRectangleWhenPressingRight)
            {
                if (isMainCharacterYInRectangleWhenPressingDown)
                {
                    Vector2 velocity = new Vector2(0, 0);
                    mainCharacter.Velocity = velocity;
                }
                else if (isMainCharacterYInRectangleWhenPressingUp)
                {
                    Vector2 velocity = new Vector2(0, 0);
                    mainCharacter.Velocity = velocity;
                }
            }
        }
Esempio n. 4
0
 public static Character CreateMainCharacter(ContentManager content)
 {
     Texture2D mainCharacterTexture = content.Load<Texture2D>("BlueMage");
     Character mainCharacter = new Character(mainCharacterTexture, 4, 4, new Vector2(200, 200));
     return mainCharacter;
 }
Esempio n. 5
0
 public override void ActOnPlayer(Character mainCharacter, View.Renderers.MonoGameRenderer renderer)
 {
 }
Esempio n. 6
0
 public virtual void ActOnPlayer(Character mainCharacter, MonoGameRenderer renderer)
 {
 }