コード例 #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void AddMessageBox_Click(object sender, EventArgs e)
        {
            if (GameScreen == null || string.IsNullOrEmpty(MessageTxtBox.Text))
            {
                return;
            }

            GameMessage.AddMessage(MessageTxtBox.Text);
            MessageTxtBox.Text = "";

            RebuildMessages();
        }
コード例 #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="batch"></param>
        public override void Draw(SpriteBatch batch)
        {
            base.Draw(batch);

            // No answer, waiting
            if (Start == DateTime.MinValue)
            {
                return;
            }

            Team team = GameScreen.Team;

            // Number of hour sleeping
            int hours = (int)(DateTime.Now - Start).TotalSeconds;

            // Display
            batch.DrawString(GUI.MenuFont, new Point(26, 58), Color.White, "Hours rested : " + hours);

            foreach (Hero hero in team.Heroes)
            {
                if (hero == null)
                {
                    continue;
                }

                // Hero can heal some one ?
                if (hero.CanHeal())
                {
                    // Find the weakest hero and heal him
                    Hero weakest = team.Heroes[0];
                    foreach (Hero h in team.Heroes)
                    {
                        if (h == null)
                        {
                            continue;
                        }

                        if (h.HitPoint.Ratio < weakest.HitPoint.Ratio)
                        {
                            weakest = h;
                        }
                    }

                    if (weakest.HitPoint.Ratio < 1.0f)
                    {
                        GameMessage.AddMessage(hero.Name + " casts healing on " + weakest.Name);
                        hero.Heal(weakest);
                    }
                }
            }
        }
コード例 #3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="team"></param>
        /// <returns></returns>
        public override bool Run()
        {
            GameMessage.AddMessage(GameScreen.Team.SelectedHero.Name + ": " + Message);

            return(true);
        }