private void btnAddBot_Click(object sender, RoutedEventArgs e) { try { //TODO: Implement: // ConverterMatterToFuel // ConverterMatterToEnergy //_itemOptions.CameraColorRGBNeuronDensity = 160 * 3; #region DNA List<ShipPartDNA> parts = new List<ShipPartDNA>(); parts.Add(new ShipPartDNA() { PartType = EnergyTank.PARTTYPE, Orientation = Quaternion.Identity, Position = new Point3D(0, 0, 1.43121944558768), Scale = new Vector3D(2.7969681248785, 2.7969681248785, 0.754175785992705) }); parts.Add(new ShipPartDNA() { PartType = FuelTank.PARTTYPE, Orientation = Quaternion.Identity, Position = new Point3D(0.617709955450103, 0, -1.17934947097654), Scale = new Vector3D(1.27861383329322, 1.27861383329322, 1.2242161981366) }); parts.Add(new ShipPartDNA() { PartType = FuelTank.PARTTYPE, Orientation = Quaternion.Identity, Position = new Point3D(-2.16134944924876E-05, -0.60985890545398, -1.17934947097654), Scale = new Vector3D(1.27861383329322, 1.27861383329322, 1.2242161981366) }); parts.Add(new ShipPartDNA() { PartType = FuelTank.PARTTYPE, Orientation = Quaternion.Identity, Position = new Point3D(0.00387496389974934, 0.618396858731443, -1.17934947097654), Scale = new Vector3D(1.27861383329322, 1.27861383329322, 1.2242161981366) }); parts.Add(new ShipPartDNA() { PartType = FuelTank.PARTTYPE, Orientation = Quaternion.Identity, Position = new Point3D(-0.624666220599071, 0.00100528924605325, -1.17934947097654), Scale = new Vector3D(1.27861383329322, 1.27861383329322, 1.2242161981366) }); parts.Add(new ShipPartDNA() { PartType = CargoBay.PARTTYPE, Orientation = Quaternion.Identity, Position = new Point3D(0, 0, 0), Scale = new Vector3D(1, 1, 1) }); parts.Add(new ShipPartDNA() { PartType = Brain.PARTTYPE, Orientation = Quaternion.Identity, Position = new Point3D(-0.850947345148112, -0.0019217800299223, -0.1657062616585), Scale = new Vector3D(0.730753808122994, 0.730753808122994, 0.730753808122994) }); parts.Add(new ShipPartDNA() { PartType = Brain.PARTTYPE, Orientation = Quaternion.Identity, Position = new Point3D(-0.00589599969475301, 0.850929089078933, -0.1657062616585), Scale = new Vector3D(0.730753808122994, 0.730753808122994, 0.730753808122994) }); parts.Add(new ShipPartDNA() { PartType = Brain.PARTTYPE, Orientation = Quaternion.Identity, Position = new Point3D(-0.00522521361558187, -0.850933472485232, -0.165706261658499), Scale = new Vector3D(0.730753808122994, 0.730753808122994, 0.730753808122994) }); parts.Add(new ShipPartDNA() { PartType = Brain.PARTTYPE, Orientation = Quaternion.Identity, Position = new Point3D(0.850949515219971, 0, -0.165706261658499), Scale = new Vector3D(0.730753808122994, 0.730753808122994, 0.730753808122994) }); parts.Add(new ShipPartDNA() { PartType = ConverterMatterToFuel.PARTTYPE, Orientation = Quaternion.Identity, Position = new Point3D(0.232899395582397, -0.238935114546265, 0.773100284172734), Scale = new Vector3D(0.903613735551713, 0.903613735551713, 0.903613735551713) }); parts.Add(new ShipPartDNA() { PartType = ConverterMatterToEnergy.PARTTYPE, Orientation = Quaternion.Identity, Position = new Point3D(-0.22797553388197, 0.226717979419686, 0.775967026847012), Scale = new Vector3D(0.903613735551713, 0.903613735551713, 0.903613735551713) }); parts.Add(new ShipPartDNA() { PartType = SensorSpin.PARTTYPE, Orientation = Quaternion.Identity, Position = new Point3D(0.262933776282848, 0.240405245709603, 0.755961022082205), Scale = new Vector3D(1, 1, 1) }); parts.Add(new ShipPartDNA() { PartType = EnergyTank.PARTTYPE, Orientation = Quaternion.Identity, Position = new Point3D(-0.250217552102507, -0.280865739393283, 0.743561713316594), Scale = new Vector3D(0.399083346950047, 0.399083346950047, 0.236501125779081) }); // This is just a placeholder for a future sensor (need to put something here so mass is balanced) parts.Add(new ShipPartDNA() { PartType = CameraColorRGB.PARTTYPE, Orientation = Quaternion.Identity, Position = new Point3D(-0.00208559296997747, 0, 2.00222812584528), Scale = new Vector3D(1, 1, 1) }); parts.Add(new ThrusterDNA() { PartType = Thruster.PARTTYPE, Orientation = Quaternion.Identity, Position = new Point3D(-0.00137913748707474, 0, -1.20661030017992), Scale = new Vector3D(1.29260597488229, 1.29260597488229, 1.29260597488229), ThrusterType = ThrusterType.One }); parts.Add(new ThrusterDNA() { PartType = Thruster.PARTTYPE, Orientation = new Quaternion(-0.623025498564933, -0.775855164007238, -0.0622612340741654, 0.0775340657568128), Position = new Point3D(0.189965645143804, -0.859019870524953, 0.883258802478369), Scale = new Vector3D(0.522840753255495, 0.522840753255495, 0.522840753255495), ThrusterType = ThrusterType.One }); parts.Add(new ThrusterDNA() { PartType = Thruster.PARTTYPE, Orientation = new Quaternion(0.948585651195026, -0.300495041099996, 0.0947956598959211, 0.0300295768554372), Position = new Point3D(-0.719304806310003, 0.506559650891123, 0.883258802478371), Scale = new Vector3D(0.522840753255495, 0.522840753255495, 0.522840753255495), ThrusterType = ThrusterType.One }); parts.Add(new ThrusterDNA() { PartType = Thruster.PARTTYPE, Orientation = new Quaternion(0.304146575685315, -0.947421167104513, 0.0303944881633535, 0.0946792887093452), Position = new Point3D(0.715381156965589, 0.512085817563994, 0.883258802478369), Scale = new Vector3D(0.522840753255495, 0.522840753255495, 0.522840753255495), ThrusterType = ThrusterType.One }); ShipDNA dna = ShipDNA.Create(parts); dna.ShipLineage = Guid.NewGuid().ToString(); #endregion ShipCoreArgs core = new GameItems.ShipCoreArgs() { Map = _map, Material_Ship = _material_Bot, World = _world, }; ShipExtraArgs extra = new ShipExtraArgs() { Options = _editorOptions, ItemOptions = _itemOptions, Material_Projectile = _material_Projectile, Radiation = _radiation, CameraPool = _cameraPool, }; //Swimbot bot = await Swimbot.GetNewSwimbotAsync(dna, _world, _material_Bot, _map, extra); Swimbot bot = new Swimbot(BotConstructor.ConstructBot(dna, core, extra)); bot.PhysicsBody.ApplyForceAndTorque += new EventHandler<BodyApplyForceAndTorqueArgs>(Bot_ApplyForceAndTorque); bot.PhysicsBody.Rotation = Math3D.GetRandomRotation(); bot.PhysicsBody.Position = Math3D.GetRandomVector_Spherical(BOUNDRYSIZEHALF * .5d).ToPoint(); //bot.PhysicsBody.Position = new Point3D(0, 0, BOUNDRYSIZEHALF * -.75d); if (bot.Energy != null) { bot.Energy.QuantityCurrent = bot.Energy.QuantityMax * .5d; } if (bot.Fuel != null) { bot.Fuel.QuantityCurrent = bot.Fuel.QuantityMax * .5d; } bot.RecalculateMass(); _map.AddItem(bot); _bots.Add(bot); } catch (Exception ex) { MessageBox.Show(ex.ToString(), this.Title, MessageBoxButton.OK, MessageBoxImage.Error); } }
private void AddBot_Click(object sender, RoutedEventArgs e) { try { //TODO: Implement: // ConverterMatterToFuel // ConverterMatterToEnergy //_itemOptions.CameraColorRGBNeuronDensity = 160 * 3; #region DNA List <ShipPartDNA> parts = new List <ShipPartDNA>(); parts.Add(new ShipPartDNA() { PartType = EnergyTank.PARTTYPE, Orientation = Quaternion.Identity, Position = new Point3D(0, 0, 1.43121944558768), Scale = new Vector3D(2.7969681248785, 2.7969681248785, 0.754175785992705) }); parts.Add(new ShipPartDNA() { PartType = FuelTank.PARTTYPE, Orientation = Quaternion.Identity, Position = new Point3D(0.617709955450103, 0, -1.17934947097654), Scale = new Vector3D(1.27861383329322, 1.27861383329322, 1.2242161981366) }); parts.Add(new ShipPartDNA() { PartType = FuelTank.PARTTYPE, Orientation = Quaternion.Identity, Position = new Point3D(-2.16134944924876E-05, -0.60985890545398, -1.17934947097654), Scale = new Vector3D(1.27861383329322, 1.27861383329322, 1.2242161981366) }); parts.Add(new ShipPartDNA() { PartType = FuelTank.PARTTYPE, Orientation = Quaternion.Identity, Position = new Point3D(0.00387496389974934, 0.618396858731443, -1.17934947097654), Scale = new Vector3D(1.27861383329322, 1.27861383329322, 1.2242161981366) }); parts.Add(new ShipPartDNA() { PartType = FuelTank.PARTTYPE, Orientation = Quaternion.Identity, Position = new Point3D(-0.624666220599071, 0.00100528924605325, -1.17934947097654), Scale = new Vector3D(1.27861383329322, 1.27861383329322, 1.2242161981366) }); parts.Add(new ShipPartDNA() { PartType = CargoBay.PARTTYPE, Orientation = Quaternion.Identity, Position = new Point3D(0, 0, 0), Scale = new Vector3D(1, 1, 1) }); parts.Add(new ShipPartDNA() { PartType = Brain.PARTTYPE, Orientation = Quaternion.Identity, Position = new Point3D(-0.850947345148112, -0.0019217800299223, -0.1657062616585), Scale = new Vector3D(0.730753808122994, 0.730753808122994, 0.730753808122994) }); parts.Add(new ShipPartDNA() { PartType = Brain.PARTTYPE, Orientation = Quaternion.Identity, Position = new Point3D(-0.00589599969475301, 0.850929089078933, -0.1657062616585), Scale = new Vector3D(0.730753808122994, 0.730753808122994, 0.730753808122994) }); parts.Add(new ShipPartDNA() { PartType = Brain.PARTTYPE, Orientation = Quaternion.Identity, Position = new Point3D(-0.00522521361558187, -0.850933472485232, -0.165706261658499), Scale = new Vector3D(0.730753808122994, 0.730753808122994, 0.730753808122994) }); parts.Add(new ShipPartDNA() { PartType = Brain.PARTTYPE, Orientation = Quaternion.Identity, Position = new Point3D(0.850949515219971, 0, -0.165706261658499), Scale = new Vector3D(0.730753808122994, 0.730753808122994, 0.730753808122994) }); parts.Add(new ShipPartDNA() { PartType = ConverterMatterToFuel.PARTTYPE, Orientation = Quaternion.Identity, Position = new Point3D(0.232899395582397, -0.238935114546265, 0.773100284172734), Scale = new Vector3D(0.903613735551713, 0.903613735551713, 0.903613735551713) }); parts.Add(new ShipPartDNA() { PartType = ConverterMatterToEnergy.PARTTYPE, Orientation = Quaternion.Identity, Position = new Point3D(-0.22797553388197, 0.226717979419686, 0.775967026847012), Scale = new Vector3D(0.903613735551713, 0.903613735551713, 0.903613735551713) }); parts.Add(new ShipPartDNA() { PartType = SensorSpin.PARTTYPE, Orientation = Quaternion.Identity, Position = new Point3D(0.262933776282848, 0.240405245709603, 0.755961022082205), Scale = new Vector3D(1, 1, 1) }); parts.Add(new ShipPartDNA() { PartType = EnergyTank.PARTTYPE, Orientation = Quaternion.Identity, Position = new Point3D(-0.250217552102507, -0.280865739393283, 0.743561713316594), Scale = new Vector3D(0.399083346950047, 0.399083346950047, 0.236501125779081) }); // This is just a placeholder for a future sensor (need to put something here so mass is balanced) parts.Add(new ShipPartDNA() { PartType = CameraColorRGB.PARTTYPE, Orientation = Quaternion.Identity, Position = new Point3D(-0.00208559296997747, 0, 2.00222812584528), Scale = new Vector3D(1, 1, 1) }); parts.Add(new ThrusterDNA() { PartType = Thruster.PARTTYPE, Orientation = Quaternion.Identity, Position = new Point3D(-0.00137913748707474, 0, -1.20661030017992), Scale = new Vector3D(1.29260597488229, 1.29260597488229, 1.29260597488229), ThrusterType = ThrusterType.One }); parts.Add(new ThrusterDNA() { PartType = Thruster.PARTTYPE, Orientation = new Quaternion(-0.623025498564933, -0.775855164007238, -0.0622612340741654, 0.0775340657568128), Position = new Point3D(0.189965645143804, -0.859019870524953, 0.883258802478369), Scale = new Vector3D(0.522840753255495, 0.522840753255495, 0.522840753255495), ThrusterType = ThrusterType.One }); parts.Add(new ThrusterDNA() { PartType = Thruster.PARTTYPE, Orientation = new Quaternion(0.948585651195026, -0.300495041099996, 0.0947956598959211, 0.0300295768554372), Position = new Point3D(-0.719304806310003, 0.506559650891123, 0.883258802478371), Scale = new Vector3D(0.522840753255495, 0.522840753255495, 0.522840753255495), ThrusterType = ThrusterType.One }); parts.Add(new ThrusterDNA() { PartType = Thruster.PARTTYPE, Orientation = new Quaternion(0.304146575685315, -0.947421167104513, 0.0303944881633535, 0.0946792887093452), Position = new Point3D(0.715381156965589, 0.512085817563994, 0.883258802478369), Scale = new Vector3D(0.522840753255495, 0.522840753255495, 0.522840753255495), ThrusterType = ThrusterType.One }); ShipDNA dna = ShipDNA.Create(parts); dna.ShipLineage = Guid.NewGuid().ToString(); #endregion ShipCoreArgs core = new GameItems.ShipCoreArgs() { Map = _map, Material_Ship = _material_Bot, World = _world, }; ShipExtraArgs extra = new ShipExtraArgs() { Options = _editorOptions, ItemOptions = _itemOptions, Material_Projectile = _material_Projectile, Radiation = _radiation, CameraPool = _cameraPool, }; //Swimbot bot = await Swimbot.GetNewSwimbotAsync(dna, _world, _material_Bot, _map, extra); Swimbot bot = new Swimbot(BotConstructor.ConstructBot(dna, core, extra)); bot.PhysicsBody.ApplyForceAndTorque += new EventHandler <BodyApplyForceAndTorqueArgs>(Bot_ApplyForceAndTorque); bot.PhysicsBody.Rotation = Math3D.GetRandomRotation(); bot.PhysicsBody.Position = Math3D.GetRandomVector_Spherical(BOUNDRYSIZEHALF * .5d).ToPoint(); //bot.PhysicsBody.Position = new Point3D(0, 0, BOUNDRYSIZEHALF * -.75d); if (bot.Energy != null) { bot.Energy.QuantityCurrent = bot.Energy.QuantityMax * .5d; } if (bot.Fuel != null) { bot.Fuel.QuantityCurrent = bot.Fuel.QuantityMax * .5d; } bot.RecalculateMass(); _map.AddItem(bot); _bots.Add(bot); } catch (Exception ex) { MessageBox.Show(ex.ToString(), this.Title, MessageBoxButton.OK, MessageBoxImage.Error); } }