コード例 #1
0
ファイル: Ranger.cs プロジェクト: Raynd/XNA_RPG
 public Ranger(Game game, int xLoc, int yLoc, int playerIndex)
     : base(game, xLoc, yLoc)
 {
     walk = new Texture2D[2];
     attack = new Texture2D[2];
     map = (BattleMap)game.Services.GetService(typeof(BattleMap));
     gameStateManager = (GameStateManager)game.Services.GetService(typeof(GameStateManager));
     this.Move(xLoc, yLoc);
     PlayerIndex = playerIndex;
     HasMoved = true;
     HasAttacked = true;
     MoveDistance = 3;
     HealthPoints = 15;
     CurrentHealth = HealthPoints;
     Strength = 10;
     PDefense = 7;
     Dexterity = 13;
     AttackRange = 3;
     Alive = true;
     CharType = "mercenary";
     Cost = 100;
     Attacked = 0;
     championCommander = GetChampionCommander((List<Character>)game.Services.GetService(typeof(List<Character>)), this);
     Level = 1;
     Experience = 0;
 }
コード例 #2
0
ファイル: SpiritPriest.cs プロジェクト: Raynd/XNA_RPG
 public SpiritPriest(Game game, int xLoc, int yLoc, int playerIndex)
     : base(game, xLoc, yLoc)
 {
     walk = new Texture2D[2];
     attack = new Texture2D[2];
     heal = new Texture2D[3];
     map = (BattleMap)game.Services.GetService(typeof(BattleMap));
     gameStateManager = (GameStateManager)game.Services.GetService(typeof(GameStateManager));
     /*Initialize();
     LoadContent();*/
     this.Move(xLoc, yLoc);
     PlayerIndex = playerIndex;
     HasMoved = true;
     HasAttacked = true;
     MoveDistance = 2;
     HealthPoints = 15;
     CurrentHealth = HealthPoints;
     Strength = 6;
     PDefense = 8;
     MDefense = 14;
     Dexterity = 8;
     Intelligence = 14;
     AttackRange = 3;
     Alive = true;
     CharType = "mercenary";
     Cost = 150;
     Attacked = 0;
     championCommander = GetChampionCommander((List<Character>)game.Services.GetService(typeof(List<Character>)), this);
     Level = 1;
     Experience = 0;
 }
コード例 #3
0
ファイル: ChampionOne.cs プロジェクト: Raynd/XNA_RPG
        public ChampionOne(Game1 game, int xLoc, int yLoc, int playerIndex)
            : base(game, xLoc, yLoc)
        {
            map = (BattleMap)game.Services.GetService(typeof(BattleMap));
            gameStateManager = (GameStateManager)game.Services.GetService(typeof(GameStateManager));
            screenManager = (ScreenManager)game.Services.GetService(typeof(ScreenManager));
            this.game = game;
            walk = new Texture2D[2];
            attack = new Texture2D[5];
            PlayerIndex = playerIndex;

            Initialize();
            LoadContent();

            this.Move(xLoc, yLoc);
            PlayerIndex = playerIndex;
            HasMoved = false;
            HasAttacked = false;
            Alive = true;
            CharType = "champion";
            MoveDistance = 4;
            HealthPoints = 50;
            Strength = 20;
            PDefense = 15;
            MDefense = 15;
            Dexterity = 10;
            AttackRange = 1;
            CurrentHealth = HealthPoints;
            Gold = 500;
            Level = 2;
            Experience = 0;
        }
コード例 #4
0
ファイル: BattleScreen.cs プロジェクト: Raynd/XNA_RPG
 /// <summary>
 /// Constructor.
 /// </summary>
 public BattleScreen(Game game, Character attacking, Character attacked)
 {
     TransitionOnTime = TimeSpan.FromSeconds(0.5);
     TransitionOffTime = TimeSpan.FromSeconds(0.5);
     attackingCharacter = attacking;
     attackedCharacter = attacked;
     gameStateManager = (GameStateManager)game.Services.GetService(typeof(GameStateManager));
     charList = (List<Character>)game.Services.GetService(typeof(List<Character>));
 }
コード例 #5
0
ファイル: OpponentAI.cs プロジェクト: Raynd/XNA_RPG
 public OpponentAI(Game game)
     : base(game)
 {
     playerManager = (PlayerManager)game.Services.GetService(typeof(PlayerManager));
     map = (BattleMap)game.Services.GetService(typeof(BattleMap));
     charList = (List<Character>)game.Services.GetService(typeof(List<Character>));
     screenManager = (ScreenManager)game.Services.GetService(typeof(ScreenManager));
     gameStateManager = (GameStateManager)game.Services.GetService(typeof(GameStateManager));
     this.game = game;
 }
コード例 #6
0
ファイル: Cursor.cs プロジェクト: Raynd/XNA_RPG
 public Cursor(Game game)
     : base(game)
 {
     pos = new Vector2(20, 0);
     this.game = game;
     Initialize();
     LoadContent();
     map = (BattleMap)game.Services.GetService(typeof(BattleMap));
     currentTile = SelectTile(0, 0);
     screenManager = (ScreenManager)game.Services.GetService(typeof(ScreenManager));
     gameStateManager = (GameStateManager)game.Services.GetService(typeof(GameStateManager));
     playerManager = (PlayerManager)game.Services.GetService(typeof(PlayerManager));
 }
コード例 #7
0
ファイル: PopupScreen.cs プロジェクト: Raynd/XNA_RPG
        public PopupScreen(Game game, Character character)
        {
            cursor = (Cursor)game.Services.GetService(typeof(Cursor));
            playerManager = (PlayerManager)game.Services.GetService(typeof(PlayerManager));
            screenManager = (ScreenManager)game.Services.GetService(typeof(ScreenManager));
            map = (BattleMap)game.Services.GetService(typeof(BattleMap));
            gameStateManager = (GameStateManager)game.Services.GetService(typeof(GameStateManager));

            selectedChar = character;
            selectScreen = new SelectScreen(game, character);
            screenManager.AddScreen(selectScreen, null);

            const string usageText = "A: Move" + "\nX: Attack" + "\nStart: End Turn" + "\nB: Cancel";
            this.message = message + usageText;
            if (selectedChar == null)
            {
                this.message = "Start: End Turn" + "\nB: Cancel";
            }
            else if (selectedChar.CharType == "champion")
            {
                this.message += "\nY: Buy Mercenary";
            }
            IsPopup = true;

            TransitionOnTime = TimeSpan.FromSeconds(0.2);
            TransitionOffTime = TimeSpan.FromSeconds(0.2);

                menuMove = new InputAction(
                    new Buttons[] { Buttons.A },
                    new Keys[] { Keys.A },
                    true);
                menuAttack = new InputAction(
                    new Buttons[] { Buttons.X, },
                    new Keys[] { Keys.X },
                    true);
                menuCancel = new InputAction(
                    new Buttons[] { Buttons.B, },
                    new Keys[] { Keys.B },
                    true);
                menuEndTurn = new InputAction(
                    new Buttons[] { Buttons.Start, },
                    new Keys[] { Keys.Enter },
                    true);
                menuBuy = new InputAction(
                    new Buttons[] { Buttons.Y, },
                    new Keys[] { Keys.Y },
                    true);
        }
コード例 #8
0
ファイル: MainMenuScreen.cs プロジェクト: Raynd/XNA_RPG
        /// <summary>
        public MainMenuScreen(Game1 game)
            : base("Main Menu")
        {
            // Create our menu entries.
            MenuEntry playGameMenuEntry = new MenuEntry("Play Game");
            MenuEntry exitMenuEntry = new MenuEntry("Exit");
            this.game = game;

            // Hook up menu event handlers.
            playGameMenuEntry.Selected += PlayGameMenuEntrySelected;
            exitMenuEntry.Selected += OnCancel;

            // Add entries to the menu.
            MenuEntries.Add(playGameMenuEntry);
            MenuEntries.Add(exitMenuEntry);

            gameStateManager = (GameStateManager)game.Services.GetService(typeof(GameStateManager));
        }
コード例 #9
0
ファイル: MercenaryCamp.cs プロジェクト: Raynd/XNA_RPG
        public MercenaryCamp(Game1 game, int xLoc, int yLoc)
            : base(game, xLoc, yLoc)
        {
            map = (BattleMap)game.Services.GetService(typeof(BattleMap));
            gameStateManager = (GameStateManager)game.Services.GetService(typeof(GameStateManager));
            map.GetSquare(yLoc, xLoc).setCurrentChar(this);

            Initialize();
            LoadContent();

            position.X = xLoc * 60;
            position.Y = yLoc * 60 + 20;
            Alive = true;
            HasAttacked = false;
            HasMoved = false;
            CharType = "camp";
            HealthPoints = 100;
        }
コード例 #10
0
ファイル: BuyScreen.cs プロジェクト: Raynd/XNA_RPG
        public BuyScreen(Game game, Character character)
            : base("Hire a Mercenary")
        {
            cursor = (Cursor)game.Services.GetService(typeof(Cursor));
            playerManager = (PlayerManager)game.Services.GetService(typeof(PlayerManager));
            map = (BattleMap)game.Services.GetService(typeof(BattleMap));
            charList = (List<Character>)game.Services.GetService(typeof(List<Character>));
            screenManager = (ScreenManager)game.Services.GetService(typeof(ScreenManager));
            champion = character;
            this.game = game;

            MenuEntry buyKnight = new MenuEntry("Hire Knight, Cost: 100");
            MenuEntry buyRanger = new MenuEntry("Hire Ranger, Cost: 100");
            MenuEntry buyBarbarian = new MenuEntry("Hire Barbarian, Cost: 100");
            MenuEntry buyMage = new MenuEntry("Hire Mage, Cost: 150");
            MenuEntry buyPriest = new MenuEntry("Hire Spirit Priest, Cost: 150");
            MenuEntry cancel = new MenuEntry("Cancel");
            gameStateManager = (GameStateManager)game.Services.GetService(typeof(GameStateManager));

            gameStateManager.State = GameState.buying;
            // Hook up menu event handlers.
            buyKnight.Selected += buyKnightSelected;
            buyRanger.Selected += buyRangerSelected;
            buyBarbarian.Selected += buyBarbarianSelected;
            buyMage.Selected += buyMageSelected;
            buyPriest.Selected += buyPriestSelected;
            cancel.Selected += cancelSelected;

            // Add entries to the menu.
            MenuEntries.Add(buyKnight);
            MenuEntries.Add(buyRanger);
            MenuEntries.Add(buyBarbarian);
            MenuEntries.Add(buyMage);
            MenuEntries.Add(buyPriest);
            MenuEntries.Add(cancel);

            /*if (aiFlag == true)
            {
                BuyRandom();
            }*/
        }
コード例 #11
0
ファイル: Game1.cs プロジェクト: Raynd/XNA_RPG
        public Game1()
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";

            Services.AddService(typeof(List<Character>), charList);
            gameStateManager = new GameStateManager();
            gameStateManager.State = GameState.mainMenu;
            Services.AddService(typeof(GameStateManager), gameStateManager);

            screenManager = new ScreenManager(this);
            Components.Add(screenManager);
            Services.AddService(typeof(ScreenManager), screenManager);

            screenManager.AddScreen(new OptionsScreen(this), null);

            playerManager = new PlayerManager(this);
            Services.AddService(typeof(PlayerManager), playerManager);

            AddInitialScreens();

            graphics.PreferredBackBufferWidth = 1280;
            graphics.PreferredBackBufferHeight = 720;
        }