Exemple #1
0
        public Poll(Device device, float height)
        {
            _height = height;
            Texture = Texture ?? Texture.FromFile(device, "Assets/Textures/poll.png");
            TextureTop = TextureTop ?? Texture.FromFile(device, "Assets/Textures/poll_top.png");

            _topFlagLocation = new Vector3(-0.5f, 0.25f + (height / 2 - 1.5f), 0);

            _flag = Add(new Sprite(device, "flag", 1));
            _flag.Translate(_topFlagLocation);

            Add(new GameObject
            {
                new MeshRenderer
                {
                    Mesh = new TexturedCube(device, 0.5f, 0.5f, 0.5f, DefaultUV, DefaultUV, DefaultUV, DefaultUV, DefaultUV, DefaultUV),
                    Material = new TextureMaterial(TextureTop, false)
                }
            }).Translate(0, 0.25f + (height / 2 - 0.5f), 0);

            Add(new GameObject
            {
                new MeshRenderer
                {
                    Mesh = new TexturedCube(device, 0.2f, height - 0.5f, 0.2f, DefaultUV, DefaultUV, DefaultUV, DefaultUV, DefaultUV, DefaultUV),
                    Material = new TextureMaterial(Texture, false)
                }
            }).Translate(0, -0.25f, 0);

            Add(new Trigger(SlideDown, 0.5f, height, 0.5f, Vector3.Zero));
        }