Beispiel #1
0
        public static void GenerateNewUserOwnership(int id)
        {
            for (int i = 0; i < 3; i++)
            {
                using (var db = new MinionWarsEntities())
                {
                    Minion minion = MinionGenotype.generateRandomMinion();

                    MinionOwnership mo = new MinionOwnership();
                    mo.owner_id    = id;
                    mo.group_count = 10;
                    mo.minion_id   = minion.id;
                    mo.available   = 10;

                    db.MinionOwnership.Add(mo);
                    db.SaveChanges();
                }
            }
        }
Beispiel #2
0
        public static HiveNode generateRandomHive(DbGeography loc)
        {
            using (var db = new MinionWarsEntities())
            {
                if (!CheckIfHiveExists(loc))
                {
                    HiveNode newHive = new HiveNode();
                    newHive.location = loc;
                    Minion randomMinion = MinionGenotype.generateRandomMinion();
                    newHive.minion_id = randomMinion.id;

                    db.HiveNode.Add(newHive);
                    db.SaveChanges();

                    return(newHive);
                }
                else
                {
                    return(null);
                }
            }
        }