示例#1
0
文件: BattleForm.cs 项目: Tonaplo/RPG
        /// <summary>
        /// Constructor for the Battle Form. Only supports Singleplayer combat atm
        /// </summary>
        /// <param name="_listOfChars"></param>
        /// <param name="_difficulty"></param>
        public BattleForm(List<Core.Units.Character> _listOfChars, int _difficulty, RPG.Core.PlayerSettings settings)
        {
            InitializeComponent();
            this.StartPosition = FormStartPosition.CenterParent;
            this.BackgroundImage = GeneralFunctions.ResizeImage(Properties.Resources.background, labelBackgroundIGNORE.Size);
            Function.SoundManager.PlayMain(settings.SoundOn, this, settings.SoundVolume);

            numberOfPlayers = _listOfChars.Count;

            battleChars = _listOfChars;

            int sum = 0;

            foreach (var item in battleChars)
            {
                sum += item.UnitLevel;
                liveChars.Add(item.UnitName);
            }

            int average = (int)(sum / battleChars.Count);

            enemy = WorldGeneration.GenerateNPC(null, average, _difficulty, EnumMonsterType.Null, battleChars.Count);
            ai = WorldGeneration.GenerateNPCAI(enemy,  battleChars);
            enemy = ai.ModifiedNPC;

            foreach (var item in battleChars)
            {
                ucCharacterBattle ucb = new ucCharacterBattle(item, battleChars.Count);
                ucb.AttackClicked += ucb_AttackClicked;
                flpCharacters.Controls.Add(ucb);
            }

            flpNPCs.Controls.Add(new ucNPC(enemy));
        }
示例#2
0
 static void Main(string[] args)
 {
     RPG myGame = new RPG();
     myGame.Run();
 }