Exemplo n.º 1
0
        /// <summary>
        /// Insère un character
        /// </summary>
        /// <returns>VO_Character</returns>
        public static VO_Character CreateCharacter()
        {
            //Création de l'objet
            int    i     = 1;
            string title = string.Empty;

            while (true)
            {
                if (GameCore.Instance.Game.Characters.Find(p => p.Title == string.Format(GlobalConstants.CHARACTERS_NEW_ITEM, i)) != null)
                {
                    i++;
                    continue;
                }
                else
                {
                    title = string.Format(GlobalConstants.CHARACTERS_NEW_ITEM, i);
                    break;
                }
            }

            VO_Character character = new VO_Character(Guid.NewGuid())
            {
                Title       = title,
                Speed       = GlobalConstants.CHARACTERS_NORMAL_SPEED,
                DialogColor = FormsTools.GetVOColorFromGDIColor(Color.Black),
                Animations  = new List <VO_Animation>()
            };

            //Insertion de l'objet
            GameCore.Instance.Game.Characters.Add(character);

            //Animations
            VO_Animation standing = CreateCharAnimation(character.Id);

            standing.Title = GlobalConstants.CHARACTERS_STANDING;
            VO_Animation walking = CreateCharAnimation(character.Id);

            walking.Title = GlobalConstants.CHARACTERS_WALKING;
            VO_Animation talking = CreateCharAnimation(character.Id);

            talking.Title          = GlobalConstants.CHARACTERS_TALKING;
            character.TalkingAnim  = talking.Id;
            character.StandingAnim = standing.Id;
            character.WalkingAnim  = walking.Id;

            return(character);
        }
Exemplo n.º 2
0
 /// <summary>
 /// Bouton qui affiche la ColorDialog pour le choix de couleur de dialogue.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnChoose_Click(object sender, EventArgs e)
 {
     ColorDialog.ShowDialog();
     CurrentCharacter.DialogColor = FormsTools.GetVOColorFromGDIColor(ColorDialog.Color);
 }