Exemple #1
0
Fichier : Sun.cs Projet : Frib/LD24
 public Sun(Island island, Vector2 orbit)
     : base(island, new Vector2(4096, 4096), new Vector3(orbit.X, 5120, orbit.Y))
 {
     this.island = island;
     textureFront = RM.GetTexture("sun");
     offset = new Vector3(-orbit.X * 5, 0, -orbit.Y * 5);
 }
Exemple #2
0
        public Entity(Island i, Vector2 size, Vector3 pos)
        {
            this.island = i;
            billboardVertices = new VertexPositionNormalTexture[6];
            reverseBillboardVertices = new VertexPositionNormalTexture[6];
            Vector3 e = new Vector3(-size.X / 2, size.Y, 0);
            Vector3 f = new Vector3(size.X / 2, size.Y, 0);
            Vector3 g = new Vector3(size.X / 2, 0, 0);
            Vector3 h = new Vector3(-size.X / 2, 0, 0);

            this.size = new Vector3(size.X, size.Y, size.X);

            Vector3 frontNormal = new Vector3(0.0f, 0.0f, 1.0f);
            billboardVertices[0] = new VertexPositionNormalTexture(h, frontNormal, new Vector2(0, 1));
            billboardVertices[1] = new VertexPositionNormalTexture(e, frontNormal, new Vector2(0, 0));
            billboardVertices[2] = new VertexPositionNormalTexture(f, frontNormal, new Vector2(1, 0));
            billboardVertices[3] = new VertexPositionNormalTexture(h, frontNormal, new Vector2(0, 1));
            billboardVertices[4] = new VertexPositionNormalTexture(f, frontNormal, new Vector2(1, 0));
            billboardVertices[5] = new VertexPositionNormalTexture(g, frontNormal, new Vector2(1, 1));
            this.Position = pos;

            Vector3 backNormal = new Vector3(0.0f, 0.0f, -1.0f);
            reverseBillboardVertices[0] = new VertexPositionNormalTexture(h, backNormal, new Vector2(0, 1));
            reverseBillboardVertices[1] = new VertexPositionNormalTexture(e, backNormal, new Vector2(0, 0));
            reverseBillboardVertices[2] = new VertexPositionNormalTexture(f, backNormal, new Vector2(1, 0));
            reverseBillboardVertices[3] = new VertexPositionNormalTexture(h, backNormal, new Vector2(0, 1));
            reverseBillboardVertices[4] = new VertexPositionNormalTexture(f, backNormal, new Vector2(1, 0));
            reverseBillboardVertices[5] = new VertexPositionNormalTexture(g, backNormal, new Vector2(1, 1));
        }
Exemple #3
0
 public SplashEffect(Island island, Vector3 position)
     : base(island, new Vector2(8, 8), new Vector3(position.X, island.waterheight + 2f, position.Z))
 {
     // TODO: Complete member initialization
     this.island = island;
     this.position = new Vector3(position.X, island.waterheight, position.Z);
     textureFront = RM.GetTexture("splash1");
 }
Exemple #4
0
        public Flower(Island i, Vector3 vector3)
            : base(i, Vector2.Zero, vector3)
        {
            this.Position = vector3;
            trunk = new VertexPositionNormalTexture[6];
            core = new VertexPositionNormalTexture[6];
            leaves = new VertexPositionNormalTexture[6];
            Vector3 frontNormal = new Vector3(0.0f, 0.0f, 1.0f);

            Vector3 e = new Vector3(-trunkwidth, trunkheight, 0);
            Vector3 f = new Vector3(trunkwidth, trunkheight, 0);
            Vector3 g = new Vector3(trunkwidth, 0, 0);
            Vector3 h = new Vector3(-trunkwidth, 0, 0);

            trunk[0] = new VertexPositionNormalTexture(h, frontNormal, new Vector2(0, 1));
            trunk[1] = new VertexPositionNormalTexture(e, frontNormal, new Vector2(0, 0));
            trunk[2] = new VertexPositionNormalTexture(f, frontNormal, new Vector2(1, 0));
            trunk[3] = new VertexPositionNormalTexture(h, frontNormal, new Vector2(0, 1));
            trunk[4] = new VertexPositionNormalTexture(f, frontNormal, new Vector2(1, 0));
            trunk[5] = new VertexPositionNormalTexture(g, frontNormal, new Vector2(1, 1));

            e = new Vector3(-leafwidth, trunkheight + leafheight ,0);
            f = new Vector3(leafwidth, trunkheight + leafheight,0);
            g = new Vector3(leafwidth, trunkheight - leafheight, 0);
            h = new Vector3(-leafwidth, trunkheight - leafheight,0);

            leaves[0] = new VertexPositionNormalTexture(h, frontNormal, new Vector2(0, 1));
            leaves[1] = new VertexPositionNormalTexture(e, frontNormal, new Vector2(0, 0));
            leaves[2] = new VertexPositionNormalTexture(f, frontNormal, new Vector2(1, 0));
            leaves[3] = new VertexPositionNormalTexture(h, frontNormal, new Vector2(0, 1));
            leaves[4] = new VertexPositionNormalTexture(f, frontNormal, new Vector2(1, 0));
            leaves[5] = new VertexPositionNormalTexture(g, frontNormal, new Vector2(1, 1));

            e = new Vector3(-leafwidth, trunkheight + leafheight + 0.1f, 0);
            f = new Vector3(leafwidth, trunkheight + leafheight + 0.1f, 0);
            g = new Vector3(leafwidth, (trunkheight - leafheight) + 0.1f, 0);
            h = new Vector3(-leafwidth, (trunkheight - leafheight) + 0.1f, 0);

            core[0] = new VertexPositionNormalTexture(h, frontNormal, new Vector2(0, 1));
            core[1] = new VertexPositionNormalTexture(e, frontNormal, new Vector2(0, 0));
            core[2] = new VertexPositionNormalTexture(f, frontNormal, new Vector2(1, 0));
            core[3] = new VertexPositionNormalTexture(h, frontNormal, new Vector2(0, 1));
            core[4] = new VertexPositionNormalTexture(f, frontNormal, new Vector2(1, 0));
            core[5] = new VertexPositionNormalTexture(g, frontNormal, new Vector2(1, 1));

            tstem = RM.GetTexture("flowerstem");
            tcore = RM.GetTexture("flowercore");
            tleaves = RM.GetTexture("flowerleaves");

            cCore = GenColor(Color.Yellow);
            cLeaves = GenColor(Color.White);

            ColorFlower();
        }
Exemple #5
0
        public Bird CreateBird(Island i, Vector3 pos)
        {
            int beak = G.r.Next(5);

            Bird b = new Bird(i, pos);
            b.BeakType = beak;
            b.SetTexturesSide(sHead, sTorso, sTail, sLeg, sBeaks[beak], sWing);
            b.SetTexturesFront(fHead, fTorso, fLeg, fBeaks[beak], fWing);
            b.SetTexturesBack(bHead, bTorso, bLeg, bWing, bTail);
            Color baseColor = GenColor(Color.White);
            b.SetColors(GenColor(baseColor), GenColor(baseColor), baseColor, GenColor(baseColor));
            b.FinalizeBird();
            return b;
        }
Exemple #6
0
        public Tree(Island i, Vector3 vector3)
            : base(i, Vector2.Zero, vector3)
        {
            trunkheight += (float)G.r.NextDouble() * 4f;
            trunkwidth += (float)G.r.NextDouble() * 1f;
            leafwidth += (float)G.r.NextDouble() * 3f;
            leafheight += (float)G.r.NextDouble() * 3f;

            this.Position = vector3;
            trunk = new VertexPositionNormalTexture[6];
            leaves = new VertexPositionNormalTexture[6];
            Vector3 frontNormal = new Vector3(0.0f, 0.0f, 1.0f);

            Vector3 e = new Vector3(-trunkwidth, trunkheight, 0);
            Vector3 f = new Vector3(trunkwidth, trunkheight, 0);
            Vector3 g = new Vector3(trunkwidth, 0, 0);
            Vector3 h = new Vector3(-trunkwidth, 0, 0);

            rect = new RectangleF(new Vector2(Position.X - trunkwidth, Position.Z - trunkwidth), new Vector2(Position.X + trunkwidth, Position.Z + trunkwidth));

            trunk[0] = new VertexPositionNormalTexture(h, frontNormal, new Vector2(0, 1));
            trunk[1] = new VertexPositionNormalTexture(e, frontNormal, new Vector2(0, 0));
            trunk[2] = new VertexPositionNormalTexture(f, frontNormal, new Vector2(1, 0));
            trunk[3] = new VertexPositionNormalTexture(h, frontNormal, new Vector2(0, 1));
            trunk[4] = new VertexPositionNormalTexture(f, frontNormal, new Vector2(1, 0));
            trunk[5] = new VertexPositionNormalTexture(g, frontNormal, new Vector2(1, 1));

            e = new Vector3(-leafwidth, trunkheight + leafheight, 0.02f);
            f = new Vector3(leafwidth, trunkheight + leafheight, 0.02f);
            g = new Vector3(leafwidth, trunkheight - leafheight, 0.02f);
            h = new Vector3(-leafwidth, trunkheight - leafheight, 0.02f);

            leaves[0] = new VertexPositionNormalTexture(h, frontNormal, new Vector2(0, 1));
            leaves[1] = new VertexPositionNormalTexture(e, frontNormal, new Vector2(0, 0));
            leaves[2] = new VertexPositionNormalTexture(f, frontNormal, new Vector2(1, 0));
            leaves[3] = new VertexPositionNormalTexture(h, frontNormal, new Vector2(0, 1));
            leaves[4] = new VertexPositionNormalTexture(f, frontNormal, new Vector2(1, 0));
            leaves[5] = new VertexPositionNormalTexture(g, frontNormal, new Vector2(1, 1));

            size = new Vector3(rect.Width/2, 0, rect.Height/2);
        }
Exemple #7
0
 public GameScreen(G g)
 {
     camera = new Camera();
     island = new Island();
     CanTakePhoto = true;
 }
Exemple #8
0
 public Player(Island i, Vector2 size, Vector3 pos)
     : base(i,size, pos)
 {
     eyes = new Vector3(0, size.Y * 0.8125f, 0);
     textureFront = RM.GetTexture("player");
 }
Exemple #9
0
 public Bird(Island i, Vector3 pos)
     : base(i, new Vector2(1.5f + (float)G.r.NextDouble() * 6), pos)
 {
     animation = Animations.walking;
 }