コード例 #1
0
            public InvertedF_2400MHz(double thickness = 0.0, bool debug = false)
                : base("Antenna-2400MHz-Inverted-F")
            {
                Vector3D feedPoint = new Vector3D(L3 + L4 + L7 + L8 + W2 / 2, 0, 0);
                m_thickness = thickness;

                // Antenna
                Metal copper = new Metal("antenna-inverted-f");
                copper.FillColor = new Material.Color(235, 148, 7, 255);
                copper.EdgeColor = new Material.Color(235, 148, 7, 255);

                uint priority = 100;
                uint normDir = 2;

                double[,] points = new double[,] { 
                    { L3+L4+L7, L3+L4+L7, L3, L3, L3+L4+L5, L3+L4+L5, L3+L4, L3+L4, L3+L4+L7-0.1, L3+L4+L7+L8, L3+L4+L7+L8, L3+L4+L7+L8+W2, L3+L4+L7+L8+W2, L3+L4+L7, L3+L4+L7, L1-L2, L1-L2, L1, L1, 0, 0, L3+L4, L3+L4, L3+L4+L5+0.2, L3+L4+L5+0.2, L3+L4+L7-L6-0.2, L3+L4+L7-L6-0.2 },
                    { 0, H2+H3, H2+H3, H1+W1-H4, H1+W1-H4, H2+H3+H5+H6, H2+H3+H5+H6, H2+H3+H5, H2+H3+H5, H2+H3 + 0.2, 0, 0, H2+H3+Math.Sqrt(2)/2*W2 + W2/4, H2+H3+H5+Math.Sqrt(2)*W2 -0.08, H1-H8, H1-H8, H1, H1, H1+W1, H1+W1, H2, H2, 0, 0, H2, H2, 0 }
                };

                m_antenna = new LinearPolygon(null, copper, priority, normDir, 0.0, points, thickness);
                m_antenna.Move(-feedPoint); // move feedpoint to origin w/o transformations
                this.Add(m_antenna);

                if (debug)
                {
                    // Ground plane placeholders (priority = 0)
                    double groundPlaneWidth = 5.0;

                    Metal groundPlane = new Metal("ground-plane");
                    groundPlane.FillColor = new Material.Color(235, 148, 7, 255);
                    groundPlane.EdgeColor = new Material.Color(235, 148, 7, 255);

                    //Box groundPlaneLeft = new Box(null, groundPlane, 0, new Vector3D(-W2 / 2 - L8, -groundPlaneWidth, 0), new Vector3D(L3 + L4 + L7, 0, thickness));
                    Box groundPlaneLeft = new Box(null, groundPlane, 0, new Vector3D(0, -groundPlaneWidth, 0), new Vector3D(L3 + L4 + L7, 0, thickness));
                    Box groundPlaneRight = new Box(null, groundPlane, 0, new Vector3D(L3 + L4 + L7 + L8 + W2 + L8, -groundPlaneWidth, 0), new Vector3D(L1, 0, thickness));
                    groundPlaneLeft.Move(-feedPoint);
                    groundPlaneRight.Move(-feedPoint);
                    this.Add(groundPlaneLeft);
                    this.Add(groundPlaneRight);

                    /*
                    double pcbWidth = 0.56; // FIXME
                    Box groundPlaneBottom = new Box(null, groundPlane, 0, new Vector3D(0, -groundPlaneWidth, 0-pcbWidth), new Vector3D(L1, 0, thickness-pcbWidth));
                    groundPlaneBottom.Move(-feedPoint);
                    this.Add(groundPlaneBottom);

                    // Keep-off region
                    Dielectric keepOff = new Dielectric("keep-off");
                    keepOff.FillColor = new Material.Color(255, 0, 0, 32);
                    keepOff.EdgeColor = new Material.Color(255, 0, 0, 32);
                    Box keepOffArea = new Box(null, keepOff, 0, new Vector3D(-1, 0, 0), new Vector3D(L1 + 1, H1 + W1 + 1, thickness));
                    keepOffArea.Move(-feedPoint);
                    this.Add(keepOffArea);
                    */
                }
            }
コード例 #2
0
ファイル: GetSmeltEx.cs プロジェクト: Robobeurre/NRaas
 public override void AddInteractions(InteractionObjectPair iop, Sim actor, Metal target, List<InteractionObjectPair> results)
 {
     results.Add(new InteractionObjectPair(new Definition(), target));
     uint stackNumber = actor.Inventory.GetStackNumber(target);
     if (stackNumber != 0x0)
     {
         List<IGameObject> stackObjects = actor.Inventory.GetStackObjects(stackNumber, true);
         results.Add(new InteractionObjectPair(new Definition(stackObjects), target));
     }
 }
コード例 #3
0
ファイル: MetalEx.cs プロジェクト: Robobeurre/NRaas
 public static void SmeltMetal(Metal ths, SimDescription actor)
 {
     ths.mHasBeenSmelt = true;
     ths.UpdateMetalVisual();
     float kSmeltMultiplier = Metal.kSmeltMultiplier;
     if ((actor != null) && actor.TraitManager.HasElement(TraitNames.GathererTrait))
     {
         kSmeltMultiplier += TraitTuning.GathererTraitIngotQualityModifier;
     }
     ths.mStoredCost = (int)(ths.Cost * kSmeltMultiplier);
 }
コード例 #4
0
        public HitableList GetSceneWorld()
        {
            var world = new HitableList
            {
                new Sphere(new Vector3(0, -1000, 0), 1000f, new Lambertian(new CheckerTexture(new ConstantTexture(Colors.AntiqueWhite), new ConstantTexture(Colors.DarkBlue))))
            };

            Func <float> randFloat = VectorHelpers.RandomFloat;

            for (int i = -5; i < 5; i++)
            {
                for (int j = -5; j < 5; j++)
                {
                    Vector3 center = new Vector3(i + 0.9f * randFloat(), 0.2f, j + 0.9f * randFloat());

                    float    materialChoice = randFloat();
                    Material m;
                    if (materialChoice < 0.75)
                    {
                        m = new Lambertian(new ConstantTexture(new Vector3(randFloat() * randFloat(), randFloat() * randFloat(), randFloat() * randFloat())));
                    }
                    else if (materialChoice < 0.95)
                    {
                        m = new Metal(new Vector3(0.5f * (1 + randFloat()), 0.5f * (1 + randFloat()), 0.5f * (1 + randFloat())), 0.5f * randFloat());
                    }
                    else
                    {
                        m = new Dielectric(1.5f);
                    }
                    var s = new Sphere(center, 0.2f, m);
                    world.Add(s);
                }
            }

            world.Add(new Sphere(new Vector3(0, 1, 0), 1.0f, new Dielectric(1.5f)));
            world.Add(new Sphere(new Vector3(-4, 1, 0), 1.0f, new Lambertian(new ConstantTexture(new Vector3(0.4f, 0.2f, 0.1f)))));
            world.Add(new Sphere(new Vector3(4, 1, 0), 1.0f, new Metal(new Vector3(0.7f, 0.6f, 0.5f), 0)));

            return(world);
        }
コード例 #5
0
        public World CreateBookWorld()
        {
            var hitables = new List <IHitable>();

            hitables.Add(new Sphere(new Vector3(0f, -1000f, 0f), 1000f, new Lambertian(new Vector3(0.5f, 0.5f, 0.5f))));
            var rand = new Random();

            for (var a = -11; a < 11; a++)
            {
                for (var b = -11; b < 11; b++)
                {
                    var chooseMat = (float)rand.NextDouble();
                    var center    = new Vector3(a + 0.9f * (float)rand.NextDouble(), 0.2f, b + 0.9f * (float)rand.NextDouble());
                    if ((center - new Vector3(4f, 0.2f, 0f)).Length() > 0.9f)
                    {
                        IMaterial material;
                        if (chooseMat < 0.8f) //diffuse
                        {
                            material = new Lambertian(new Vector3((float)(rand.NextDouble() * rand.NextDouble()), (float)(rand.NextDouble() * rand.NextDouble()), (float)(rand.NextDouble() * rand.NextDouble())));
                        }
                        else if (chooseMat < 0.95) //metal
                        {
                            material = new Metal(new Vector3(0.5f * (float)(1f + rand.NextDouble()), 0.5f * (float)(1 + rand.NextDouble()), 0.5f * (float)(1 + rand.NextDouble())), 0.5f * (float)(1 + rand.NextDouble()));
                        }
                        else //glass
                        {
                            material = new Dielectric(1.5f);
                        }

                        hitables.Add(new Sphere(center, 0.2f, material));
                    }
                }
            }
            hitables.Add(new Sphere(new Vector3(0f, 1f, 0f), 1.0f, new Dielectric(1.5f)));
            hitables.Add(new Sphere(new Vector3(-4.0f, 1, 0), 1.0f, new Lambertian(new Vector3(0.4f, 0.2f, 0.1f))));
            hitables.Add(new Sphere(new Vector3(4f, 1f, 0f), 1.0f, new Metal(new Vector3(0.7f, 0.6f, 0.5f), 0.0f)));
            var world = new World(hitables);

            return(world);
        }
コード例 #6
0
        protected override void WriteDataXML(XElement ele, ElderScrollsPlugin master)
        {
            XElement subEle;

            ele.TryPathTo("Stone", true, out subEle);
            Stone.WriteXML(subEle, master);

            ele.TryPathTo("Dirt", true, out subEle);
            Dirt.WriteXML(subEle, master);

            ele.TryPathTo("Grass", true, out subEle);
            Grass.WriteXML(subEle, master);

            ele.TryPathTo("Glass", true, out subEle);
            Glass.WriteXML(subEle, master);

            ele.TryPathTo("Metal", true, out subEle);
            Metal.WriteXML(subEle, master);

            ele.TryPathTo("Wood", true, out subEle);
            Wood.WriteXML(subEle, master);

            ele.TryPathTo("Organic", true, out subEle);
            Organic.WriteXML(subEle, master);

            ele.TryPathTo("Cloth", true, out subEle);
            Cloth.WriteXML(subEle, master);

            ele.TryPathTo("Water", true, out subEle);
            Water.WriteXML(subEle, master);

            ele.TryPathTo("HollowMetal", true, out subEle);
            HollowMetal.WriteXML(subEle, master);

            ele.TryPathTo("OrganicBug", true, out subEle);
            OrganicBug.WriteXML(subEle, master);

            ele.TryPathTo("OrganicGlow", true, out subEle);
            OrganicGlow.WriteXML(subEle, master);
        }
コード例 #7
0
        static void Main(string[] args)
        {
            var beastMusic = new Metal();

            beastMusic.Destroy(50);
            // Console.WriteLine(beastMusic.Sing());

            var horrorFilm = new Horror();

            horrorFilm.scaryAsShit(7);

            var beefyStuff = new Beef();

            beefyStuff.Good(Cut.Ribeye);

            var strongCoffee = new Espresso();

            strongCoffee.Perky();

            Console.WriteLine();
            Console.ReadLine();
        }
コード例 #8
0
        public void AddMetalType(MetalTypeModel model)
        {
            using (ObjectContext context = new ObjectContext(_connectionString))
            {
                var type = new Metal
                {
                    Name = model.MetalName
                };
                var types = context.CreateObjectSet <Metal>();
                types.AddObject(type);

                var baseValues = context.CreateObjectSet <MetalQualityBaseValue>();
                var baseValue  = new MetalQualityBaseValue
                {
                    MetalId               = type.MetalId,
                    LateralShearRate      = model.LateralShearRate,
                    LoadingSpeed          = model.LoadingSpeed,
                    LongitudinalShearRate = model.LongitudinalShearRate,
                    ShearStrainRate       = model.ShearStrainRate,
                    SpallStrength         = model.SpallStrength
                };
                baseValues.AddObject(baseValue);


                var coeficients = context.CreateObjectSet <MetalCoefficientWeighting>();
                var coeficient  = new MetalCoefficientWeighting
                {
                    MetalId               = type.MetalId,
                    LateralShearRate      = model.LateralShearRateC,
                    LoadingSpeed          = model.LoadingSpeedC,
                    LongitudinalShearRate = model.LongitudinalShearRateC,
                    ShearStrainRate       = model.ShearStrainRateC,
                    SpallStrength         = model.SpallStrengthC
                };
                coeficients.AddObject(coeficient);

                context.SaveChanges();
            }
        }
コード例 #9
0
    private void CornellBox()
    {
        Vector3D lookFrom    = new Vector3D(278, 278, -800);
        Vector3D lookAt      = new Vector3D(278, 278, 0);
        float    diskToFocus = 10;
        float    aperture    = 0;
        float    vfov        = 40;

        camera = new Camera(lookFrom, lookAt, new Vector3D(0, 1, 0), vfov,
                            (float)width / (float)height, aperture, diskToFocus, 0, 1);

        List <Hitable> list = new List <Hitable>();

        Material red      = new Lambertian(new ConstantTexture(new Vector3D(0.65f, 0.05f, 0.05f)));
        Material white    = new Lambertian(new ConstantTexture(new Vector3D(0.73f, 0.73f, 0.73f)));
        Material green    = new Lambertian(new ConstantTexture(new Vector3D(0.12f, 0.45f, 0.15f)));
        Material light    = new DiffuseLight(new ConstantTexture(new Vector3D(15, 15, 15)));
        Material aluminum = new Metal(new Vector3D(0.8f, 0.85f, 0.88f), 0);
        Material glass    = new Dielectric(1.5f);

        list.Add(new FlipNormals(new XZRect(213, 343, 227, 332, 554, light)));
        list.Add(new FlipNormals(new YZRect(0, 555, 0, 555, 555, green)));
        list.Add(new YZRect(0, 555, 0, 555, 0, red));
        list.Add(new FlipNormals(new XZRect(0, 555, 0, 555, 555, white)));
        list.Add(new XZRect(0, 555, 0, 555, 0, white));
        list.Add(new FlipNormals(new XYRect(0, 555, 0, 555, 555, white)));

        //list.Add(new Translate(new RotateY(new Box(new Vector3D(0, 0, 0),
        //  new Vector3D(165, 165, 165), white), -18), new Vector3D(130, 0, 65)));
        list.Add(new Translate(new RotateY(new Box(new Vector3D(0, 0, 0),
                                                   new Vector3D(165, 330, 165), white), 15), new Vector3D(265, 0, 295)));

        // list.Add(new Translate(new RotateY(new Box(new Vector3D(0, 0, 0),
        //    new Vector3D(165, 330, 165), aluminum), 15), new Vector3D(265, 0, 295)));
        list.Add(new Sphere(new Vector3D(190, 90, 190), 90, glass));
        BVHNode b = new BVHNode(list, list.Count, 0, 1);

        world.list.Add(b);
    }
コード例 #10
0
        public void TestStructureWithoutDielectricIsInvalid()
        {
            var topMetal = new Metal(Length.FromNanometers(10));

            topMetal.SetWorkFunction(Energy.FromElectronVolts(4.9));

            var semiconductor = new Semiconductor();

            semiconductor.BandGap                       = Energy.FromElectronVolts(1.125);
            semiconductor.ElectronAffinity              = Energy.FromElectronVolts(4.05);
            semiconductor.DielectricConstant            = 11.7;
            semiconductor.IntrinsicCarrierConcentration = Concentration.FromPerCubicCentimeter(1.41E10);
            semiconductor.DopingType                    = DopingType.N;
            semiconductor.DopantConcentration           = Concentration.FromPerCubicCentimeter(1E18);

            var structure = new Structure();

            structure.AddLayer(semiconductor);
            structure.AddLayer(topMetal);

            Assert.That(!structure.IsValid);
        }
コード例 #11
0
        static void Main(string[] args)
        {
            Mueble sillaMaderaRoble     = new Madera("silla de madera", 3, (float)2.6, 38, 32, 29, eColor.Rojo, eTipoDeMadera.Roble);
            Mueble sillaMaderaRoble2    = new Madera("Silla de madera", 7, (float)2.6, 38, 32, 29, eColor.Rojo, eTipoDeMadera.Roble);
            Mueble mesaMaderaAbedul     = new Madera("Mesa de madera", 9, (float)8.7, 65, 51, 44, eColor.Negro, eTipoDeMadera.Abedul);
            Mueble escritorioMaderaPino = new Madera("Escritorio de madera", 5, (float)6.9, 46, 40, 38, eColor.Sin, eTipoDeMadera.Pino);
            Mueble sillaMetalAluminio   = new Metal("Silla de aluminio", 1, (float)4.4, 41, 34, 25, eColor.Violeta, eTipoDeMetal.Aluminio);//Deberia setear el color en Sin
            Mueble mesaMetalAcero       = new Metal("Mesa de acero", 2, (float)9.9, 66, 49, 41, eColor.Verde, eTipoDeMetal.Acero);
            Mueble mesaVidrio           = new Vidrio("Mesa de vidrio", 4, (float)7.6, 61, 47, 43);

            Fabrica.AgregarMueble = sillaMaderaRoble;
            Fabrica.AgregarMueble = sillaMaderaRoble2;
            Console.WriteLine(Fabrica.RetornarInformacionTotal());
            Fabrica.AgregarMueble = mesaMaderaAbedul;
            Fabrica.AgregarMueble = escritorioMaderaPino;
            Fabrica.AgregarMueble = sillaMetalAluminio;
            Fabrica.AgregarMueble = mesaMetalAcero;
            Fabrica.AgregarMueble = mesaVidrio;

            Console.WriteLine(sillaMetalAluminio.Facturacion());
            Console.WriteLine(sillaMaderaRoble.Facturacion());
            Console.WriteLine(mesaVidrio.Facturacion());
            Console.WriteLine(Fabrica.RetornarInformacionTotal());

            Mueble mesaVidrio2 = new Vidrio(); //Por defecto, no deberia dejar de agregar a la lista
            Mueble mesaMadera  = new Madera(); //Por defecto, no deberia dejar de agregar a la lista
            Mueble sillaMetal  = new Metal();  //Por defecto, no deberia dejar de agregar a la lista

            Fabrica.Muebles.Clear();           //Limpiamos para probar los muebles invalidos
            Console.WriteLine(mesaVidrio2);
            Console.WriteLine(mesaMadera);
            Console.WriteLine(sillaMetal);
            Fabrica.AgregarMueble = mesaVidrio2;                   //NO SE AGREGA A LA LISTA
            Fabrica.AgregarMueble = mesaMadera;                    //NO SE AGREGA A LA LISTA
            Fabrica.AgregarMueble = sillaMetal;                    //NO SE AGREGA A LA LISTA
            Console.WriteLine(Fabrica.RetornarInformacionTotal()); //No deberia retornar nada.
            Console.Read();
        }
コード例 #12
0
ファイル: JsonMedia.cs プロジェクト: rebider/JewelryONet
        public JsonMedia(Media media)
        {
            HandDiskPathForWebDisplay   = media.HandDiskPathForWebDisplay;
            HandURLForWebDisplay        = media.HandURLForWebDisplay;
            HiResDiskPathForWebDisplay  = media.HiResDiskPathForWebDisplay;
            HiResURLForWebDisplay       = media.HiResURLForWebDisplay;
            HiRes2DiskPathForWebDisplay = media.HiRes2DiskPathForWebDisplay;
            HiRes2URLForWebDisplay      = media.HiRes2URLForWebDisplay;
            IconDiskPathForWebDisplay   = media.IconDiskPathForWebDisplay;
            IconURLForWebDisplay        = media.IconURLForWebDisplay;
            MediaSet = media.MediaSet;
            MovieDiskPathForWebDisplay   = media.MovieDiskPathForWebDisplay;
            MovieURLForWebDisplay        = media.MovieURLForWebDisplay;
            PictureDiskPathForWebDisplay = media.PictureDiskPathForWebDisplay;
            PictureURLForWebDisplay      = media.PictureURLForWebDisplay;

            ReportURLForWebDisplay      = media.ReportURLForWebDisplay;
            ReportDiskPathForWebDisplay = media.ReportDiskPathForWebDisplay;

            MediaSetFullName = Metal.GetFullName(MediaSet);

            MediaSetName = media.MediaSet.ToString();
        }
コード例 #13
0
        public void AcceptCoins_01_Pos_InvalidMetal_After_Valid_Returns_Metal()
        {
            // Arrange
            IContext context      = new DefaultContext();
            var      machine      = new Machine();
            var      invalidMetal = new Metal(0, 0, 0);
            var      result       = new Result();

            // Act
            machine.Insert(Metal.Quarter, context, (r) =>
            {
                result.Push(r);
            }).Wait();

            machine.Insert(invalidMetal, context, (r) =>
            {
                result.Push(r);
            }).Wait();

            // Assert
            Assert.IsTrue(context.CoinReturn.Items.Any());
            Assert.AreEqual("$0.25", context.DisplayAmount.Current);
        }
コード例 #14
0
        public async Task <string> Get(Metal metal)
        {
            string url;
            string json;
            var    quandlApiOptions = new QuandlApiOptions();

            _configuration
            .GetSection(QuandlApiOptions.QuandlApi)
            .Bind(quandlApiOptions);

            if (metal == Metal.Gold)
            {
                url = quandlApiOptions.GoldPricesUrl;
            }
            else
            {
                url = quandlApiOptions.SilverPricesUrl;
            }

            json = await GetPrices(url);

            return(json);
        }
コード例 #15
0
        private static GEntity _readEntity(byte[] arr, ref int pos)
        {
            GEntity    Entity = null;
            int        x      = (int)ReadFloat(arr, ref pos);
            int        y      = (int)ReadFloat(arr, ref pos);
            int        type   = ReadInt32(arr, ref pos);
            int        health = ReadInt32(arr, ref pos);
            int        owner  = ReadInt32(arr, ref pos);
            Directions dir    = (Directions)ReadInt32(arr, ref pos);


            if (type == TileType.WALL)
            {
                Entity = new Wall(x, y, health);
            }
            else if (type == TileType.METAL)
            {
                Entity = new Metal(x, y);
            }
            else
            {
                if (type == EntityType.TURRET)
                {
                    Entity = new Turret(owner, x, y, health);
                }
                if (type == EntityType.MINE)
                {
                    Entity = new Mine(owner, x, y, health > 0);
                }
                if (type == EntityType.DISPENSER)
                {
                    Entity = new Dispenser(owner, x, y, health);
                }
            }

            return(Entity);
        }
コード例 #16
0
        /// <summary>
        ///     Se llama una sola vez, al principio cuando se ejecuta el ejemplo.
        ///     Escribir aquí todo el código de inicialización: cargar modelos, texturas, estructuras de optimización, todo
        ///     procesamiento que podemos pre calcular para nuestro juego.
        ///     Borrar el codigo ejemplo no utilizado.
        /// </summary>
        public override void Init()
        {
            //Device de DirectX para crear primitivas.
            var d3dDevice = D3DDevice.Instance.Device;

            timestamp = DateTime.Now;

            //Utilizando esta propiedad puedo activar el update/render a intervalos constantes.
            FixedTickEnable = true;
            //Se puede configurar el tiempo en estas propiedades TimeBetweenUpdates y TimeBetweenRenders, por defecto esta puedo en 1F / FPS_60 es a lo minimo que deberia correr el TP.
            //De no estar a gusto como se ejecuta el metodo Tick (el que maneja el GameLoop) el mismo es virtual con lo cual pueden sobrescribirlo.

            //Esconder cursor
            focusWindows  = d3dDevice.CreationParameters.FocusWindow;
            mousePosition = focusWindows.PointToScreen(new Point(focusWindows.Width / 2, focusWindows.Height / 2));
            //Cursor.Hide();

            Sounds.SoundsManager.Instance().sound    = DirectSound.DsDevice;
            Sounds.SoundsManager.Instance().mediaDir = MediaDir;

            //Burbujas
            D3DDevice.Instance.ParticlesEnabled = true;
            D3DDevice.Instance.EnableParticles();
            Particulas.Init(MediaDir, 20);

            //Oceano
            Oceano.Init(TGCVector3.Up * nivelDelAgua * 0.8f, 100, 100, ShadersDir);

            //Settear jugador y camara
            FPSCamara = new FPSCamara(Camera, Input);

            Player = Player.Instance();
            Player.SetInput(Input);
            Player.Init(FPSCamara);



            //Inicializar camara
            var cameraPosition = new TGCVector3(0, 100, -250);
            var lookAt         = new TGCVector3(0, nivelDelAgua, 0);

            Camera.SetCamera(cameraPosition, lookAt);

            sonidoUnderwater = new TgcStaticSound();
            sonidoUnderwater.loadSound(MediaDir + "Sounds\\mar.wav", DirectSound.DsDevice);

            effect         = TGCShaders.Instance.LoadEffect(ShadersDir + "e_fog.fx");
            efectoInterior = TGCShaders.Instance.LoadEffect(ShadersDir + "interior.fx");


            //Iniciar HUD
            Hud.Init(MediaDir);
            Hud.ChangeStatus(Hud.Status.MainMenu);

            //Cargar enviroment
            oceano = new Fondo(MediaDir, ShadersDir);
            oceano.Init();
            oceano.Camera = Camera;

            heightmap = new TgcSimpleTerrain();
            heightmap.loadHeightmap(MediaDir + marBnwDir, marScaleXZ, marScaleY, new TGCVector3(0, marOffsetY, 0));
            heightmap.loadTexture(MediaDir + marTexDir);

            //Cargar entidades
            var loader = new TgcSceneLoader();
            var scene  = loader.loadSceneFromFile(MediaDir + "yellow_fish-TgcScene.xml");
            var mesh   = scene.Meshes[0];

            peces   = new List <Fish>();
            corales = new List <Coral>();
            metales = new List <Metal>();
            piedras = new List <Metal>();

            int i = 0;

            while (i < 20)
            {
                Fish   fish;
                string meshName = i.ToString();
                fish = new Fish(mesh.clone(meshName));
                fish = (Fish)setearMeshParaLista(fish, i);
                peces.Add(fish);

                fish.Effect(effect);
                fish.Technique("RenderScene");
                i++;
            }

            scene = loader.loadSceneFromFile(MediaDir + "shark-TgcScene.xml");
            mesh  = scene.Meshes[0];

            shark = new Shark(mesh);
            shark.Init();
            sharkSound = new Tgc3dSound(MediaDir + "Sounds\\shark.wav", shark.GetMesh().Position, DirectSound.DsDevice);
            shark.setearSonido(sharkSound);
            shark.setearAlturaMaxima(nivelDelAgua - 19f);

            efectoDesaparecer = TGCShaders.Instance.LoadEffect(ShadersDir + "perlin.fx");

            shark.setearEfectoPerlin(efectoDesaparecer);
            perlinTexture = TgcTexture.createTexture(D3DDevice.Instance.Device, MediaDir + "Textures\\perlin.png");
            shark.setearPerlin(perlinTexture);

            scene = loader.loadSceneFromFile(MediaDir + "coral-TgcScene.xml");
            mesh  = scene.Meshes[0];


            i = 0;
            while (i < 25)
            {
                Coral  coral;
                string meshName = i.ToString();
                coral = new Coral(mesh.createMeshInstance(meshName));
                coral = (Coral)setearMeshParaLista(coral, i * 4, -17);
                corales.Add(coral);

                coral.Effect(effect);
                coral.Technique("RenderScene");
                i++;
            }

            scene = loader.loadSceneFromFile(MediaDir + "Oro-TgcScene.xml");
            mesh  = scene.Meshes[0];
            i     = 0;
            while (i < 15)
            {
                Metal  oro;
                string meshName = i.ToString();
                oro      = new Metal(mesh.createMeshInstance(meshName));
                oro      = (Metal)setearMeshParaLista(oro, i * 8, -17);
                oro.Tipo = ElementoRecolectable.oro;
                metales.Add(oro);

                oro.Effect(effect);
                oro.Technique("RenderSceneLight");
                i++;
            }

            scene = loader.loadSceneFromFile(MediaDir + "Hierro-TgcScene.xml");
            mesh  = scene.Meshes[0];
            i     = 0;
            while (i < 15)
            {
                Metal  hierro;
                string meshName = i.ToString() + i.ToString();
                hierro      = new Metal(mesh.createMeshInstance(meshName));
                hierro      = (Metal)setearMeshParaLista(hierro, (i + 10) * 8, -17);
                hierro.Tipo = ElementoRecolectable.hierro;
                metales.Add(hierro);

                hierro.Effect(effect);
                hierro.Technique("RenderScene");
                i++;
            }

            scene = loader.loadSceneFromFile(MediaDir + "Roca-TgcScene.xml");
            mesh  = scene.Meshes[0];
            i     = 0;
            while (i < 15)
            {
                Metal  roca;
                string meshName = i.ToString() + i.ToString() + i.ToString();
                roca      = new Metal(mesh.createMeshInstance(meshName));
                roca      = (Metal)setearMeshParaLista(roca, (i + 10) * 8, -17);
                roca.Tipo = ElementoRecolectable.madera;
                roca.escalar(new TGCVector3(0.3f, 0.3f, 0.3f));
                piedras.Add(roca);

                roca.Effect(effect);
                roca.Technique("RenderScene");
                i++;
            }

            scene = loader.loadSceneFromFile(MediaDir + "ship-TgcScene.xml");
            nave  = Nave.Instance();
            nave.Init(scene, nivelDelAgua);

            scene = loader.loadSceneFromFile(MediaDir + "EspadaDoble-TgcScene.xml");
            mesh  = scene.Meshes[0];
            arma  = new Arma(mesh);

            scene    = loader.loadSceneFromFile(MediaDir + "Mesa-TgcScene.xml");
            mesaNave = MesaNave.Instance();
            mesaNave.Init(scene);
            mesaNave.Effect(efectoInterior);
            mesaNave.Technique("RenderScene");

            scene        = loader.loadSceneFromFile(MediaDir + "SogaEnrollada-TgcScene.xml");
            mesh         = scene.Meshes[0];
            sogaInterior = SogaInterior.Instance();
            sogaInterior.Init(mesh);
            sogaInterior.Effect(efectoInterior);
            sogaInterior.Technique("RenderScene");

            scene         = loader.loadSceneFromFile(MediaDir + "silla-TgcScene.xml");
            sillaInterior = SillaInterior.Instance();
            sillaInterior.Init(scene);
            sillaInterior.Effect(efectoInterior);
            sillaInterior.Technique("RenderScene");

            scene         = loader.loadSceneFromFile(MediaDir + "Timon-TgcScene.xml");
            timonInterior = TimonInterior.Instance();
            timonInterior.Init(scene);
            timonInterior.Effect(efectoInterior);
            timonInterior.Technique("RenderScene");

            scene       = loader.loadSceneFromFile(MediaDir + "LamparaTecho-TgcScene.xml");
            lamparaNave = new LamparaNave(scene.Meshes[0]);
            lamparaNave.Effect(efectoInterior);
            lamparaNave.Technique("RenderScene");


            //Cargar shaders
            fog               = new TgcFog();
            fog.Color         = Color.FromArgb(30, 144, 255);
            fog.Density       = 1;
            fog.EndDistance   = 1000;
            fog.StartDistance = 1;
            fog.Enabled       = true;

            effect.SetValue("screen_dx", d3dDevice.PresentationParameters.BackBufferWidth);
            effect.SetValue("screen_dy", d3dDevice.PresentationParameters.BackBufferHeight);

            //Fog + Lights
            effect.SetValue("nivelAgua", nivelDelAgua);

            interiorNave = InteriorNave.Instance();
            interiorNave.Init(MediaDir);

            DirectSound.ListenerTracking = Player.Instance().mesh;

            //Mascara post process
            maskTexture = TgcTexture.createTexture(D3DDevice.Instance.Device, MediaDir + "Textures\\mascara.png");
            effect.SetValue("textura_mascara", maskTexture.D3dTexture);

            // seteamos los efectos aca porque son fijos
            oceano.Effect(effect);
            oceano.Technique("RenderScene");

            heightmap.Effect    = effect;
            heightmap.Technique = "RenderScene";

            shark.Effect(effect);
            shark.Technique("RenderScene");

            nave.Effect(effect);
            nave.Technique("RenderSceneLight");

            effect.SetValue("ambientColor", Color.FromArgb(255, 255, 255).ToArgb());
            effect.SetValue("diffuseColor", Color.FromArgb(255, 255, 255).ToArgb());
            effect.SetValue("specularColor", Color.FromArgb(255, 255, 255).ToArgb());

            efectoInterior.SetValue("ambientColor", Color.FromArgb(255, 255, 255).ToArgb());
            efectoInterior.SetValue("diffuseColor", Color.FromArgb(255, 255, 255).ToArgb());
            efectoInterior.SetValue("specularColor", Color.FromArgb(255, 255, 255).ToArgb());

            // dibujo el full screen quad
            CustomVertex.PositionTextured[] vertices =
            {
                new CustomVertex.PositionTextured(-1,  1, 1, 0, 0),
                new CustomVertex.PositionTextured(1,   1, 1, 1, 0),
                new CustomVertex.PositionTextured(-1, -1, 1, 0, 1),
                new CustomVertex.PositionTextured(1,  -1, 1, 1, 1)
            };

            // Vertex buffer de los triangulos
            fullScreenQuad = new VertexBuffer(typeof(CustomVertex.PositionTextured), 4, d3dDevice, Usage.Dynamic | Usage.WriteOnly, CustomVertex.PositionTextured.Format, Pool.Default);
            fullScreenQuad.SetData(vertices, 0, LockFlags.None);

            // dibujo render target

            depthStencil = d3dDevice.CreateDepthStencilSurface(d3dDevice.PresentationParameters.BackBufferWidth, d3dDevice.PresentationParameters.BackBufferHeight, DepthFormat.D24S8, MultiSampleType.None, 0, true);

            renderTarget = new Texture(d3dDevice, d3dDevice.PresentationParameters.BackBufferWidth, d3dDevice.PresentationParameters.BackBufferHeight, 1, Usage.RenderTarget, Format.X8R8G8B8, Pool.Default);

            // inicializo los FB que uso para el Bloom
            coralesBrillantes = new Texture(d3dDevice, d3dDevice.PresentationParameters.BackBufferWidth, d3dDevice.PresentationParameters.BackBufferHeight, 1, Usage.RenderTarget, Format.X8R8G8B8, Pool.Default);

            FBHorizontalBool = new Texture(d3dDevice, d3dDevice.PresentationParameters.BackBufferWidth, d3dDevice.PresentationParameters.BackBufferHeight, 1, Usage.RenderTarget, Format.X8R8G8B8, Pool.Default);

            FBVerticalBloom = new Texture(d3dDevice, d3dDevice.PresentationParameters.BackBufferWidth, d3dDevice.PresentationParameters.BackBufferHeight, 1, Usage.RenderTarget, Format.X8R8G8B8, Pool.Default);
        }
コード例 #17
0
 // Removes the Metal that has 0 acid on its surface
 public void removeMetal(Metal m)
 {
     mList.Remove(m);
     n -= 1;
 }
コード例 #18
0
        protected Jewel JewelClassFactory(v_jewel_items item)
        {
            var initObj = new ItemInitializerParameterObject()
            {
                ID                   = item.id,
                ItemNumber           = item.ITEMNUMBER,
                CategoryID           = item.CATEGORY_ID,
                SubCategoryID        = item.SUBCATEGORY_ID,
                JewelryCategory      = item.jeweltype,
                JewelryCategoryID    = item.JEWELTYPE_ID,
                JewelrySubCategory   = item.jewelsubtype,
                JewelrySubCategoryID = item.JEWELSUBTYPE_ID,
                SpecialPrice         = item.SPECIAL_SELL_PRICE ?? 0,
                DealerPrice          = item.DEALER_PRICE ?? 0,
                OnSpecial            = item.ONSPECIAL ?? false,
                RegularPrice         = item.price ?? 0,
                Metal                = item.metal,
                Title                = item.jeweltitle,
                OnBargain            = item.ONBARGAIN ?? false
            };


            var initJewelExtra = new JewelryExtraInitializerParameterObject()
            {
                CS_Clarity         = item.clarity,
                CS_ClarityFreeText = item.clarity_freetxt,
                CS_Color           = item.color,
                CS_ColorFreeText   = item.color_freetxt,
                CS_Count           = item.cs_count ?? 0,
                CS_Cut             = item.cs_cut,
                CS_Description     = item.cs_desc,
                CS_Type            = item.cs_type,
                HasSideStones      = item.has_sidestones ?? false,
                SS_Clarity         = item.ss_clarity,
                SS_ClarityFreeText = "",
                SS_Color           = item.ss_color,
                SS_ColorFreeText   = "",
                SS_Count           = item.ss_count ?? 0,
                SS_Cut             = item.ss_cut,
                SS_Description     = item.ss_desc,
                SS_Type            = item.ss_type
            };

            initJewelExtra.TotalWeight = Convert.ToDouble(item.total_weight ?? 0);
            initJewelExtra.CS_Weight   = Convert.ToDouble(item.cs_weight ?? 0);
            initJewelExtra.SS_Weight   = Convert.ToDouble(item.ss_weight ?? 0);

            var jewelryExtra = new JewelryExtra(initJewelExtra, initObj);


            initObj.Weight = Convert.ToDouble(item.WEIGHT);

            double tryParseJewelWidth;

            if (double.TryParse(item.ITEM_SIZE.Trim(), out tryParseJewelWidth))
            {
                initObj.Width = tryParseJewelWidth;
            }
            else
            {
                initObj.Width = 0;
            }

            initObj.Price = DecideWhichPriceToUseAsCurrent(initObj);


            var currrentJewelMediaType = WhichMediaDoesThisJewelHas(item.HAS_YELLOW_GOLD ?? false, item.HAS_WHITE_GOLD ?? false);

            var metal = new Metal(requestedJewelMediaTypeByUser, currrentJewelMediaType, item.metal);

            var mediaFactory = new MediaFactory(initObj.ItemNumber, settingManager);

            mediaFactory.ChangeMediaSet(requestedJewelMediaTypeByUser, currrentJewelMediaType);



            var media = mediaFactory.BuildMedia();



            var jewel = new Jewel(initObj, media, metal, jewelryExtra, currrentJewelMediaType);

            return(jewel);
        }
コード例 #19
0
        protected override bool PrivateUpdate(ScenarioFrame frame)
        {
            bool success = false;

            foreach (GameObject obj in GetInventory(Sim))
            {
                Gem gem = obj as Gem;
                if ((gem != null) && (string.IsNullOrEmpty(gem.mCutName)))
                {
                    if (CutGem(gem))
                    {
                        continue;
                    }
                }
                else
                {
                    Metal metal = obj as Metal;
                    if ((metal != null) && (!metal.mHasBeenSmelt))
                    {
                        if (SmeltMetal(metal))
                        {
                            continue;
                        }
                    }
                    else
                    {
                        Rock rock = obj as Rock;
                        if ((rock != null) && (!rock.mAnalyzed))
                        {
                            if (rock.AnalyzeMe(Sim.CreatedSim))
                            {
                                continue;
                            }
                        }
                        else
                        {
                            MinorPet pet = obj as MinorPet;
                            if (pet != null)
                            {
                                if (PlacePet(pet))
                                {
                                    continue;
                                }
                            }
                        }
                    }
                }

                SimDescription sim = Sim;
                if (!sim.IsHuman)
                {
                    sim = SimTypes.HeadOfFamily(Sim.Household);
                }

                int value = Money.Sell(sim, obj);

                mFunds += value;

                AddStat("Sold", value);
                success = true;
            }

            return(success);
        }
コード例 #20
0
ファイル: PlayerPlanet.cs プロジェクト: RafiXWPT/OGameWorker
 public PlayerPlanet(int id, string name, Position position, PlanetTemperature temperature, Metal metal, Crystal crystal, Deuterium deuterium) : base(id, name, position, metal, crystal, deuterium)
 {
     Temperature = temperature;
     Type        = PlanetType.Self;
 }
コード例 #21
0
ファイル: Sample.cs プロジェクト: nnirit/sbj-controller
 /// <summary>
 /// Constructor
 /// </summary>
 public Sample()
 {
     m_id = 0;
     m_firstLayerMetal = Metal.Cr;
     m_firstLayerThickness = 2;
     m_secondLayerMetal = Metal.Au;
     m_secondLayerThickness = 40;
     m_electrodeWidth = 30;
     m_isDry = false;
     m_solvent = string.Empty;
     m_molecule = string.Empty;
     m_isRefabricated = false; ;
     m_isAfterPirnha = false; ;
     m_commentss = string.Empty;
 }
コード例 #22
0
        static void ExportAntenna_InvertedF()
        {
            double thickness       = 0.01;
            double airBox          = 5.0;
            double innerResolution = 0.5;
            double outerResolution = 5.0;

            var antenna = new CSXCAD.Antenna.InvertedF_2400MHz(thickness);

            const double pcbThickness = 1.5;
            var          lumpedPort   = new LumpedPort(90, 1, 50, new Vector3D(0.0, 0.0, -pcbThickness), new Vector3D(0.0, 0.0, 0), ENormDir.Z, true);

            antenna.Add(lumpedPort);

            double margin      = 2.0;
            double groundWidth = 5.0;
            var    p1          = new Vector3D(antenna.BoundingBox.P1.x - margin, -groundWidth - margin, -pcbThickness);
            var    p2          = new Vector3D(antenna.BoundingBox.P2.x + margin, antenna.BoundingBox.P2.y + margin, 0);

            var substrate = new Dielectric("pcb", 3.38, 1e-3 * 2 * Math.PI * 2.45e9 * 3.38 * Material.Eps0);

            substrate.EdgeColor = new Material.Color(10, 255, 10, 128);
            substrate.FillColor = new Material.Color(10, 255, 10, 128);
            var pcb = new CSXCAD.Box(null, substrate, 60, p1, p2);
            //antenna.Add(pcb);

            var topGround = new Metal("bottom-ground");

            topGround.EdgeColor = new Material.Color(235, 148, 7, 255);
            topGround.FillColor = topGround.EdgeColor;
            var topGroundPlane = new CSXCAD.Box(null, topGround, 100,
                                                new Vector3D(antenna.BoundingBox.P1.x, 0, -pcbThickness),
                                                new Vector3D(antenna.BoundingBox.P2.x, -groundWidth, -pcbThickness));

            antenna.Add(topGroundPlane);

            var bottomGround = new Metal("top-ground");

            bottomGround.EdgeColor = new Material.Color(235, 148, 7, 255);
            bottomGround.FillColor = bottomGround.EdgeColor;
            var topGroundPlaneLeft = new CSXCAD.Box(null, bottomGround, 100,
                                                    new Vector3D(antenna.BoundingBox.P1.x, 0, 0),
                                                    new Vector3D(-0.46 / 2 - 0.45, -groundWidth, 0));
            var topGroundPlaneRight = new CSXCAD.Box(null, bottomGround, 100,
                                                     new Vector3D(0.46 / 2 + 0.45, 0, 0),
                                                     new Vector3D(antenna.BoundingBox.P2.x, -groundWidth, 0));

            antenna.Add(topGroundPlaneLeft);
            antenna.Add(topGroundPlaneRight);

            Simulation fdtd = new Simulation();

            fdtd.Excitation = new GaussExcitation(2450e6, 500e6);

            RectilinearGrid grid = new RectilinearGrid();;

            grid.Add(new Vector3D(0, 0, 0));

            grid.SmoothMesh(innerResolution);
            grid.AddAirbox(airBox);
            grid.SmoothMesh(outerResolution);
            var nf2ff = new NF2FFBox("nf2ff",
                                     new Vector3D(grid.XLines.First(), grid.YLines.First(), grid.ZLines.First()),
                                     new Vector3D(grid.XLines.Last(), grid.YLines.Last(), grid.ZLines.Last()));

            antenna.Add(nf2ff);
            grid.AddPML(8);

            XDocument doc = new XDocument(
                new XDeclaration("1.0", "utf-8", "yes"),
                new XComment("Test XML file for CyPhy generated openEMS simulations"),
                new XElement("openEMS",
                             fdtd.ToXElement(),
                             new XElement("ContinuousStructure",
                                          new XAttribute("CoordSystem", 0),
                                          antenna.ToXElement(),
                                          grid.ToXElement()
                                          )
                             )
                );

            doc.Save("InvertedF.xml");
        }
コード例 #23
0
 public Resource()
 {
     m_Energie = new Energie();
     m_Metal   = new Metal();
     m_Gold    = new Gold();
 }
コード例 #24
0
ファイル: UnitTestModelo.cs プロジェクト: acoria1/LAB_2_TPS
        public void Initialize()
        {
            #region Materiales

            ceramica1 = new Ceramica(0.5);
            ceramica2 = new Ceramica(0.5);
            ceramica3 = new Ceramica(1.0);
            madera1   = new Madera(3, EMadera.Arce);
            madera2   = new Madera(3, EMadera.Arce);
            madera3   = new Madera(2, EMadera.Cedro);
            madera4   = new Madera(2, EMadera.Arce);
            vidrio1   = new Vidrio(0.6, EVidrio.Comun);
            vidrio2   = new Vidrio(0.6, EVidrio.Comun);
            vidrio3   = new Vidrio(0.6, EVidrio.Empañado);
            vidrio4   = new Vidrio(1.2, EVidrio.Comun);
            plastico1 = new Plastico(0.5);
            plastico2 = new Plastico(0.5);
            plastico3 = new Plastico(1.0);
            metal1    = new Metal(3.2, EMetal.Acero_Inoxidable);
            metal2    = new Metal(3.2, EMetal.Acero_Inoxidable);
            metal3    = new Metal(1.2, EMetal.Bronze);
            metal4    = new Metal(1.2, EMetal.Acero_Inoxidable);
            #endregion
            #region Dimensiones

            d1 = new Dimensiones(140, 45, 34);
            d2 = new Dimensiones(40, 45, 34);
            #endregion
            #region Listas de Materiales

            materiales1 = new List <Material>();
            materiales2 = new List <Material>();

            materiales1.Add(ceramica1);
            materiales1.Add(vidrio1);
            materiales1.Add(plastico1);
            materiales1.Add(metal1);
            materiales1.Add(madera1);

            materiales2.Add(ceramica3);
            materiales2.Add(vidrio4);
            materiales2.Add(plastico1);
            materiales2.Add(metal4);
            #endregion
            #region Colores

            colores1 = new EColor[] { EColor.Natural };
            colores2 = new EColor[] { EColor.Natural };
            colores3 = new EColor[] { EColor.Natural, EColor.Marron };
            colores4 = new EColor[] { EColor.Marron, EColor.Natural };
            colores5 = new EColor[] { };
            #endregion
            #region Mesas

            modeloM1 = new ModeloMesa(d1, "Mesa Redonda", materiales1, EEspacio.Exterior, colores1);
            modeloM2 = new ModeloMesa(d1, "Mesa Redonda", materiales1, EEspacio.Exterior, colores1);

            modeloM3 = new ModeloMesa(d1, "Mesa Cuadrada", materiales1, EEspacio.Exterior, colores1);
            modeloM4 = new ModeloMesa(d2, "Mesa Redonda", materiales1, EEspacio.Exterior, colores1);
            modeloM5 = new ModeloMesa(d1, "Mesa Redonda", materiales1, EEspacio.Interior, colores1);
            modeloM6 = new ModeloMesa(d1, "Mesa Redonda", materiales1, EEspacio.Exterior, colores3);
            modeloM7 = new ModeloMesa(d1, "Mesa Redonda", materiales2, EEspacio.Exterior, colores1);
            modeloM8 = null;
            #endregion
            #region Estanterias

            modeloE1 = new ModeloEstanteria(d1, "Estanteria Doble", materiales1, EEstanteria.Abierta, colores1, 0);
            modeloE2 = new ModeloEstanteria(d1, "Estanteria Doble", materiales1, EEstanteria.Abierta, colores1);
            modeloE3 = new ModeloEstanteria(d1, "Estanteria Doble", materiales1, EEstanteria.Abierta, colores1, 5);
            modeloE4 = new ModeloEstanteria(d1, "Estanteria Doble", materiales1, EEstanteria.Cerrada, colores1, 0);
            #endregion
            #region Placares

            modeloP1 = new ModeloPlacar(d1, "Placar", materiales1, colores1);
            modeloP2 = new ModeloPlacar(d1, "Placar", materiales1, colores1, 0);
            modeloP3 = new ModeloPlacar(d1, "Placar", materiales1, colores1, 2);
            #endregion
            #region Sillones
            modeloS1 = new ModeloSillon(d1, "Sillon a", materiales1, colores1, 2);
            modeloS2 = new ModeloSillon(d1, "Sillon b", materiales1, colores1, 2);
            modeloS3 = new ModeloSillon(d1, "Sillon doble", materiales1, colores1, 3);
            #endregion
            miFabrica  = new Fabrica();
            miFabrica += modeloM1;
            miFabrica += modeloM2;
            miFabrica += modeloM3;
            miFabrica += modeloM4;
            miFabrica += modeloM5;
            miFabrica += modeloM6;
            miFabrica += modeloM7;
            miFabrica += modeloM8;
            miFabrica += modeloE1;
            miFabrica += modeloE2;
            miFabrica += modeloE3;
            miFabrica += modeloE4;
            miFabrica += modeloP1;
            miFabrica += modeloP2;
            miFabrica += modeloP3;
            miFabrica += modeloS1;
            miFabrica += modeloS2;
            miFabrica += modeloS3;
        }
コード例 #25
0
ファイル: GetSmeltEx.cs プロジェクト: Robobeurre/NRaas
 public override string GetInteractionName(Sim actor, Metal target, InteractionObjectPair iop)
 {
     return base.GetInteractionName(actor, target, new InteractionObjectPair(sOldSingleton, target));
 }
コード例 #26
0
            public Endo(Compound parent, string name, Vector3D pos, double rot)
                : base(parent, name, pos, rot)
            {
                // Endo medium (6x3)
                m_cols = 3;
                m_rows = 6;
                Slots = new Slot[8];

                double[,] slotPositions = new double[8, 3] {
                    { 20,  3, 1.5 }, { 23,  3, 1.5 }, { 20, 26, 1.5 }, { 23, 26, 1.5 },
                    { 20, 49, 1.5 }, { 23, 72, 1.5 }, { 20, 95, 1.5 }, { 23, 118, 1.5 }
                };
                double[] slotRotations = new double[8] { Math.PI / 2, 0, Math.PI / 2, 0, Math.PI / 2, 0, Math.PI / 2, 0 };
                uint[,] slotSizes = new uint[8, 2] {
                    { 1, 1 }, { 1, 2 }, { 1, 1 }, { 2, 2 },
                    { 1, 2 }, { 2, 2 }, { 1, 2 }, { 1, 2 }
                };

                for (uint ss = 0; ss < 8; ss++)
                {
                    Vector3D v = new Vector3D(slotPositions[ss, 0], slotPositions[ss, 1], slotPositions[ss, 2]);
                    double r = slotRotations[ss];
                    Slots[ss] = new Slot(ss, slotSizes[ss,0], slotSizes[ss,1], v, r);
                }

                m_priority = 50;
                m_baseHeight = 3;
                m_ribWidth = 3;
                m_ribHeight = 3;
                m_modWidth = 20;

                Metal m = new Metal("endo");
                m.FillColor = new Material.Color(85, 170, 255, 255);
                m.EdgeColor = new Material.Color(85, 170, 255, 255);

                // Base plane
                m_primitives.Add(new Box(this, m, m_priority,
                    new Vector3D(0, 0, -m_baseHeight / 2),
                    new Vector3D(m_cols * 20 + (m_cols - 1) * m_ribWidth, m_rows * 20 + (m_rows + 1) * m_ribWidth, m_baseHeight / 2)));

                // Module side
                foreach (int i in new int[] {0, 1, 2, 4, 6})
                {
                    m_primitives.Add(new Box(this, m, m_priority,
                        new Vector3D( 0, i*(m_modWidth + m_ribWidth), m_baseHeight / 2 ),
                        new Vector3D( m_modWidth, i*(m_modWidth+m_ribWidth) + m_ribWidth, m_baseHeight / 2 + m_ribHeight )));
                }

                foreach (int i in new int[] {0, 1, 3, 5, 6})
                {
                    m_primitives.Add(new Box(this, m, m_priority,
                        new Vector3D( m_modWidth + m_ribWidth, i*(m_modWidth + m_ribWidth), m_baseHeight / 2 ),
                        new Vector3D( m_cols * m_modWidth + (m_cols - 1) * m_ribWidth, i*(m_modWidth+m_ribWidth) + m_ribWidth, m_baseHeight / 2 + m_ribHeight )));
                }

                m_primitives.Add(new Box(this, m, m_priority,
                    new Vector3D( m_modWidth, 0, m_baseHeight / 2 ),
                    new Vector3D( m_modWidth + m_ribWidth, m_rows * m_modWidth + (m_rows+1) * m_ribWidth, m_baseHeight / 2 + m_ribHeight )));

                // Display side
                foreach (int i in new int[] { 0, 6 })
                {
                    m_primitives.Add(new Box(this, m, m_priority,
                        new Vector3D(0, i * (m_modWidth + m_ribWidth), -m_baseHeight / 2),
                        new Vector3D(m_cols * m_modWidth + (m_cols - 1) * m_ribWidth, i * (m_modWidth + m_ribWidth) + m_ribWidth, -(m_baseHeight / 2 + m_ribHeight))));
                }
            }
コード例 #27
0
    protected void OnTriggerEnter(Collider c)
    {
        if (c.gameObject.layer == k_TrashLayerIndex)
        {
            Trash trash = c.GetComponent <Trash>();
            trash.Dispose();

            Compost compost = c.gameObject.GetComponent <Compost>();
            Metal   metal   = c.gameObject.GetComponent <Metal>();
            Nuclear nuclear = c.gameObject.GetComponent <Nuclear>();

            if (compost != null)
            {
                inventory.AddCompost();
            }
            else if (metal != null)
            {
                inventory.AddMetal();
            }
            else if (nuclear != null)
            {
                inventory.AddNuclear();
            }

            Destroy(c.gameObject);
        }
        else if (c.gameObject.layer == k_CoinsLayerIndex)
        {
            if (magnetCoins.Contains(c.gameObject))
            {
                magnetCoins.Remove(c.gameObject);
            }

            if (c.GetComponent <Coin>().isPremium)
            {
                Destroy(c.gameObject);
                controller.premium += 1;
                m_Audio.PlayOneShot(premiumSound);
            }
            else
            {
                /// TODO: Need to use the right pool
                Coin.coinPools[0].Free(c.gameObject);
                controller.coins += 1;
                m_Audio.PlayOneShot(coinSound);
            }
        }
        else if (c.gameObject.layer == k_ObstacleLayerIndex)
        {
            if (m_Invincible || controller.IsCheatInvincible())
            {
                return;
            }

            controller.StopMoving();

            c.enabled = false;

            Obstacle ob = c.gameObject.GetComponent <Obstacle>();

            if (ob != null)
            {
                ob.Impacted();
            }
            else
            {
                Destroy(c.gameObject);
            }

            controller.currentLife -= 1;
            controller.character.animator.SetTrigger(s_HitHash);

            if (controller.currentLife > 0)
            {
                m_Audio.PlayOneShot(controller.character.hitSound);
                SetInvincible();
            }
            // The collision killed the player, record all data to analytics.
            else
            {
                m_Audio.PlayOneShot(controller.character.deathSound);

                m_DeathData.character     = controller.character.characterName;
                m_DeathData.themeUsed     = controller.trackManager.currentTheme.themeName;
                m_DeathData.obstacleType  = ob.GetType().ToString();
                m_DeathData.coins         = controller.coins;
                m_DeathData.premium       = controller.premium;
                m_DeathData.score         = controller.trackManager.score;
                m_DeathData.worldDistance = controller.trackManager.worldDistance;
            }
        }
        else if (c.gameObject.layer == k_PowerupLayerIndex)
        {
            Consumable consumable = c.GetComponent <Consumable>();
            if (consumable != null)
            {
                controller.UseConsumable(consumable);
            }
        }
    }
コード例 #28
0
ファイル: Program.cs プロジェクト: DeonduPreez/MetalBot
 internal static async Task Main(string[] args)
 {
     await Metal.StartAsync(args);
 }
コード例 #29
0
        internal void _setEntity(int lx, int ly)
        {
            if (!(lx >= 0 && ly >= 0 && lx < _parent.LevelWidth && ly < _parent.LevelHeight) || _parent._isBorder(lx, ly))
            {
                return;
            }
            int     x = lx * GTile.WIDTH;
            int     y = ly * GTile.HEIGHT;
            GEntity r;

            switch (_brushIndex)
            {
            case 0:
                r = new Wall(x, y);
                _parent._setTopEntity(lx, ly, r);
                break;

            case 1:
                r = new Metal(x, y);
                _parent._setTopEntity(lx, ly, r);
                break;

            case 2:
                r = new Sand(x, y);
                _parent._setTopTile(lx, ly, r);
                break;

            case 3:
                r = new Water(x, y);
                _parent._setTopTile(lx, ly, r);
                break;

            case 4:
                r = new Gravel(x, y);
                _parent._setTopTile(lx, ly, r);
                break;

            case 5:
                r = new Grass(x, y);
                _parent._setTopTile(lx, ly, r);
                break;

            case 6:
                if (_parent._isOutsideBorder(lx, ly))
                {
                    break;
                }
                r = new Flag(x, y, Teams.Red);
                _parent._setFlag((Flag)r);
                break;

            case 7:
                if (_parent._isOutsideBorder(lx, ly))
                {
                    break;
                }
                r = new Flag(x, y, Teams.Blu);
                _parent._setFlag((Flag)r);
                break;

            case 8:
                if (_parent._isOutsideBorder(lx, ly))
                {
                    break;
                }
                r = new Spawner(x, y, Teams.Red);
                _parent._setSpawner((Spawner)r);
                break;

            case 9:
                if (_parent._isOutsideBorder(lx, ly))
                {
                    break;
                }
                r = new Spawner(x, y, Teams.Blu);
                _parent._setSpawner((Spawner)r);
                break;
            }
        }
コード例 #30
0
            public Small_15x6mm_2400MHz(double thickness = 0.01)
                : base("Patch-antenna-2400MHz-15x6mm")
            {
                Vector3D feedPoint = new Vector3D(W1 + D5 + W2 / 2, D4 / 2, 0.0);

                Metal copper = new Metal("copper");
                copper.FillColor = new Material.Color(235, 148, 7, 255);
                copper.EdgeColor = new Material.Color(235, 148, 7, 255);

                uint priority = 100;
                uint normDir = 2;
                m_thickness = thickness;

                double[,] points = new double[,]
                {
                    {0, 0},
                    {W1, 0},
                    {W1, L6},
                    {W1+D5, L6},
                    {W1+D5, 0},
                    {W1+D5+W2, 0},
                    {W1+D5+W2, L6},
                    {L3-W2, L6},
                    {L3-W2, L6-L4},
                    {L3+L5+W2, L6-L4},
                    {L3+L5+W2, L6},
                    {L3+L5+L2-W2, L6},
                    {L3+L5+L2-W2, L6-L4},
                    {L3+L5+L2+L5+W2, L6-L4},
                    {L3+L5+L2+L5+W2, L6},
                    {L3+L5+L2+L5+L2-W2, L6},
                    {L3+L5+L2+L5+L2-W2, L6-L1},
                    {L3+L5+L2+L5+L2, L6-L1},
                    {L3+L5+L2+L5+L2, L6+W2},
                    {L3+L5+L2+L5, L6+W2},
                    {L3+L5+L2+L5, L6-L4+W2},
                    {L3+L5+L2, L6-L4+W2},
                    {L3+L5+L2, L6+W2},
                    {L3+L5, L6+W2},
                    {L3+L5, L6-L4+W2},
                    {L3, L6-L4+W2},
                    {L3, L6+W2},
                    {0, L6+W2}
                };

                m_antenna = new LinearPolygon(null, copper, priority, normDir, 0.0, points, thickness);
                m_antenna.Move(-feedPoint);
                this.Add(m_antenna);
            }
コード例 #31
0
 public Planet(int id, string name, Position position, Metal metal, Crystal crystal, Deuterium deuterium) : base(id, name, position, metal, crystal, deuterium)
 {
 }
コード例 #32
0
 protected bool Equals(Metal other)
 {
     return(Radius == other.Radius && Thickness == other.Thickness && Weight == other.Weight);
 }
コード例 #33
0
        static void ExportAntenna_Small_15x6mm()
        {
            double thickness       = 0.01;
            double airBox          = 5.0;
            double innerResolution = 0.5;
            double outerResolution = 5.0;

            var antenna = new CSXCAD.Antenna.Small_15x6mm_2400MHz(thickness);

            const double pcbThickness = 1.5;
            var          lumpedPort   = new LumpedPort(90, 1, 50, new Vector3D(0.0, 0.0, -pcbThickness), new Vector3D(0.0, 0.0, 0), ENormDir.Z, true);

            antenna.Add(lumpedPort);

            double margin      = 2.0;
            double groundWidth = 5.0;
            var    p1          = new Vector3D(antenna.BoundingBox.P1.x - margin, -groundWidth - margin, -pcbThickness);
            var    p2          = new Vector3D(antenna.BoundingBox.P2.x + margin, antenna.BoundingBox.P2.y + margin, 0);

            double epsRel    = 4.88;
            var    substrate = new Dielectric("pcb", epsRel, 1e-3 * 2 * Math.PI * 2.45e9 * epsRel * Material.Eps0);

            substrate.EdgeColor = new Material.Color(10, 255, 10, 128);
            substrate.FillColor = new Material.Color(10, 255, 10, 128);
            var pcb = new CSXCAD.Box(null, substrate, 60, p1, p2);

            antenna.Add(pcb);

            var bottomGround = new Metal("bottom-ground");

            bottomGround.EdgeColor = new Material.Color(235, 148, 7, 255);
            bottomGround.FillColor = bottomGround.EdgeColor;
            var bottomGroundPlane = new CSXCAD.Box(null, bottomGround, 100,
                                                   new Vector3D(antenna.BoundingBox.P1.x - antenna.D1, antenna.D4 / 2, -pcbThickness),
                                                   new Vector3D(antenna.BoundingBox.P2.x + antenna.D3, -groundWidth, -pcbThickness - 0.01));

            antenna.Add(bottomGroundPlane);

            var topGround = new Metal("top-ground");

            topGround.EdgeColor = new Material.Color(235, 148, 7, 255);
            topGround.FillColor = topGround.EdgeColor;
            var topGroundPlane = new CSXCAD.Box(null, topGround, 100,
                                                new Vector3D(antenna.BoundingBox.P1.x - antenna.D1, -antenna.D4 / 2, 0),
                                                new Vector3D(antenna.BoundingBox.P2.x + antenna.D3, -groundWidth, 0.01));

            antenna.Add(topGroundPlane);

            var viaMetal = new Metal("via");

            viaMetal.EdgeColor = new Material.Color(235, 148, 7, 255);
            viaMetal.FillColor = viaMetal.EdgeColor;
            var via = new Cylinder(null, viaMetal, 100,
                                   new Vector3D(-(antenna.W1 / 2 + antenna.D5 + antenna.W2 / 2), 0, -pcbThickness),
                                   new Vector3D(-(antenna.W1 / 2 + antenna.D5 + antenna.W2 / 2), 0, 0),
                                   0.25);

            antenna.Add(via);

            Simulation fdtd = new Simulation();

            fdtd.Excitation = new GaussExcitation(2450e6, 500e6);

            RectilinearGrid grid = new RectilinearGrid();;

            grid.Add(new Vector3D(0, 0, 0));
            grid.Add(pcb.P1);
            grid.Add(pcb.P2);

            /*
             * foreach (var v in antenna.antennaPoly)
             * {
             *  grid.Add(new Vector3D(v.x, v.y, 0));
             * }
             */

            grid.SmoothMesh(innerResolution);
            grid.AddAirbox(airBox);
            grid.SmoothMesh(outerResolution);
            var nf2ff = new NF2FFBox("nf2ff",
                                     new Vector3D(grid.XLines.First(), grid.YLines.First(), grid.ZLines.First()),
                                     new Vector3D(grid.XLines.Last(), grid.YLines.Last(), grid.ZLines.Last()));

            antenna.Add(nf2ff);
            grid.AddPML(8);

            XDocument doc = new XDocument(
                new XDeclaration("1.0", "utf-8", "yes"),
                new XComment("Test XML file for CyPhy generated openEMS simulations"),
                new XElement("openEMS",
                             fdtd.ToXElement(),
                             new XElement("ContinuousStructure",
                                          new XAttribute("CoordSystem", 0),
                                          antenna.ToXElement(),
                                          grid.ToXElement()
                                          )
                             )
                );

            doc.Save("Small_15x6mm.xml");
        }
コード例 #34
0
 public override string GetInteractionName(Sim actor, Metal target, InteractionObjectPair iop)
 {
     return(base.GetInteractionName(actor, target, new InteractionObjectPair(sOldSingleton, target)));
 }
コード例 #35
0
        private static IMaterial CreateRandomMaterial(Random random)
        {
            IMaterial material = null;

            switch (random.Next(1, 3))
            {
            case 1:
                material = new Wood();
                switch (random.Next(1, 3))
                {
                case 1:
                    ((Wood)material).Type = WoodType.Oak;
                    break;

                case 2:
                    ((Wood)material).Type = WoodType.Birch;
                    break;

                case 3:
                    ((Wood)material).Type = WoodType.Aspen;
                    break;
                }
                break;

            case 2:
                material = new Metal();
                switch (random.Next(1, 3))
                {
                case 1:
                    ((Metal)material).Type = MetalType.Alluminium;
                    break;

                case 2:
                    ((Metal)material).Type = MetalType.Ferrum;
                    break;

                case 3:
                    ((Metal)material).Type = MetalType.Steel;
                    break;
                }
                break;

            case 3:
                material = new Textile();
                break;
            }

            switch (random.Next(1, 3))
            {
            case 1:
                material.Color = MaterialColor.Black;
                break;

            case 2:
                material.Color = MaterialColor.Red;
                break;

            case 3:
                material.Color = MaterialColor.White;
                break;
            }

            switch (random.Next(1, 3))
            {
            case 1:
                material.Sort = MaterialSort.High;
                break;

            case 2:
                material.Sort = MaterialSort.Middle;
                break;

            case 3:
                material.Sort = MaterialSort.Low;
                break;
            }

            material.Price = random.Next(1000, 3000) / 10;
            return(material);
        }
コード例 #36
0
ファイル: Sample.cs プロジェクト: nnirit/sbj-controller
 public Sample(int sampleId, Metal firstLayer, Metal secondLayer, int electrodeWidth,
               bool isDry, string solvent, string molecule, bool isRefabricated, 
               bool isAfetrPirnha, string comments)
 {
     m_id = sampleId;
     m_firstLayerMetal = firstLayer;
     m_secondLayerMetal = secondLayer;
     m_electrodeWidth = electrodeWidth;
     m_isDry = isDry;
     m_solvent = solvent;
     m_molecule = molecule;
     m_isRefabricated = isRefabricated;
     m_isAfterPirnha = isAfetrPirnha;
     m_commentss = comments;
 }
コード例 #37
0
 public BullionAccount(long id, decimal sum, decimal cource, Metal metalOfAccount) : base(id, sum)
 {
     MetalOfAccount = metalOfAccount;
     Cource         = cource;
 }
コード例 #38
0
            public override void AddInteractions(InteractionObjectPair iop, Sim actor, Metal target, List <InteractionObjectPair> results)
            {
                results.Add(new InteractionObjectPair(new Definition(), target));
                uint stackNumber = actor.Inventory.GetStackNumber(target);

                if (stackNumber != 0x0)
                {
                    List <IGameObject> stackObjects = actor.Inventory.GetStackObjects(stackNumber, true);
                    results.Add(new InteractionObjectPair(new Definition(stackObjects), target));
                }
            }