Exemple #1
0
        private static void AddBot(AddBotArgs dna, WorldVars arg)
        {
            // Bot
            ArcBotNPC bot = new ArcBotNPC(dna.Bot, dna.Level, dna.Position, arg.World, arg.Map, arg.Keep2D, arg.MaterialIDs, null, arg.EditorOptions, arg.ItemOptions, arg.Gravity, arg.DragPlane, dna.HomingPoint, dna.HomingRadius, true, true);

            if (dna.AngularVelocity != null)
            {
                bot.PhysicsBody.AngularVelocity = dna.AngularVelocity.Value;
            }

            arg.Map.AddItem(bot);

            // Attached Weapon
            if (dna.AttachedWeapon != null)
            {
                Weapon weapon = new Weapon(dna.AttachedWeapon, new Point3D(0, 0, 0), arg.World, arg.MaterialIDs.Weapon);

                bot.AttachWeapon(weapon);
            }

            // Inventory Weapons
            if (dna.InventoryWeapons != null)
            {
                foreach (var weapDNA in dna.InventoryWeapons)
                {
                    Weapon weapon = new Weapon(weapDNA, new Point3D(0, 0, 0), arg.World, arg.MaterialIDs.Weapon);

                    bot.AddToInventory(weapon);
                }
            }

            // Call delegate
            if (dna.ItemAdded != null)
            {
                dna.ItemAdded(bot);
            }
        }
        private static void AddBot(AddBotArgs dna, WorldVars arg)
        {
            // Bot
            ArcBotNPC bot = new ArcBotNPC(dna.Bot, dna.Level, dna.Position, arg.World, arg.Map, arg.Keep2D, arg.MaterialIDs, null, arg.EditorOptions, arg.ItemOptions, arg.Gravity, arg.DragPlane, dna.HomingPoint, dna.HomingRadius, true, true);

            if (dna.AngularVelocity != null)
            {
                bot.PhysicsBody.AngularVelocity = dna.AngularVelocity.Value;
            }

            arg.Map.AddItem(bot);

            // Attached Weapon
            if (dna.AttachedWeapon != null)
            {
                Weapon weapon = new Weapon(dna.AttachedWeapon, new Point3D(0, 0, 0), arg.World, arg.MaterialIDs.Weapon);

                bot.AttachWeapon(weapon);
            }

            // Inventory Weapons
            if (dna.InventoryWeapons != null)
            {
                foreach (var weapDNA in dna.InventoryWeapons)
                {
                    Weapon weapon = new Weapon(weapDNA, new Point3D(0, 0, 0), arg.World, arg.MaterialIDs.Weapon);

                    bot.AddToInventory(weapon);
                }
            }

            // Call delegate
            if (dna.ItemAdded != null)
            {
                dna.ItemAdded(bot);
            }
        }
 public void Add(AddBotArgs bot)
 {
     _addRemoves.Enqueue(new Tuple<object, bool>(bot, true));
 }
Exemple #4
0
 public void Add(AddBotArgs bot)
 {
     _addRemoves.Enqueue(new Tuple <object, bool>(bot, true));
 }