Inheritance: MonoBehaviour
Exemplo n.º 1
0
 /*!
  * Méthode qui permet d'initialiser l'instance de la classe sous forme d'un singleton.
  */
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     else if (instance != this)
     {
         Destroy(gameObject);
         instance = this;
     }
 }
Exemplo n.º 2
0
        public async Task CreateQuest(CommandContext ctx, [Description("Récompense en xp")] int _experience, [Description("La quête suivi d'une virgule suivi de la récompense")] params string[] _quest)
        {
            var testString = string.Empty;

            foreach (var str in _quest)
            {
                testString += str;
                testString += " ";
            }
            var strlist     = testString.Split(",", StringSplitOptions.RemoveEmptyEntries);
            var nameQuest   = strlist[0];
            var rewardQuest = strlist[1];

            using var db = new LiteDatabase(@"Sanchez.db");


            var questCollection = db.GetCollection <Quete>("Quetes");


            var embed = new DiscordEmbedBuilder
            {
                Title = "Nouvelle quête !",
                Color = DiscordColor.Chartreuse,
            };

            embed.AddField("Nom", nameQuest);
            embed.AddField("Expérience", _experience.ToString());
            embed.AddField("Récompense", rewardQuest);

            var questMessage = await ctx.Channel.SendMessageAsync(embed : embed).ConfigureAwait(false);

            var newQuest    = new Quete(nameQuest, rewardQuest, _experience, questMessage.Id);
            var okHandEmoji = DiscordEmoji.FromName(ctx.Client, ":ok_hand:");

            await questMessage.CreateReactionAsync(okHandEmoji).ConfigureAwait(false);

            questCollection.Upsert(newQuest);
        }