Ejemplo n.º 1
0
        private void nineSpliceTile(nineSplice n, int xPos, int yPos, Chunk tempChunk)
        {
            bool nMatch0 = false;
            bool nMatch1 = false;
            bool nMatch2 = false;
            bool nMatch3 = false;
            bool nMatch4 = false;
            bool nMatch5 = false;
            bool nMatch6 = false;
            bool nMatch7 = false;
            bool nMatch8 = false;

            if (n.Active_0)
            {
                if (isInChunk(xPos - 1, yPos - 1))
                {
                    if (n.tile_0.type == tempChunk.backgroundTiles[xPos - 1, yPos - 1].type)
                    {
                        nMatch0 = true;
                    }
                }
            }
            else
            {
                nMatch0 = true;
            }

            if (n.Active_1)
            {
                if (isInChunk(xPos, yPos - 1))
                {
                    if (n.tile_1.type == tempChunk.backgroundTiles[xPos, yPos - 1].type)
                    {
                        nMatch1 = true;
                    }
                }
            }
            else
            {
                nMatch1 = true;
            }

            if (n.Active_2)
            {
                if (isInChunk(xPos + 1, yPos - 1))
                {
                    if (n.tile_2.type == tempChunk.backgroundTiles[xPos + 1, yPos - 1].type)
                    {
                        nMatch2 = true;
                    }
                }
            }
            else
            {
                nMatch2 = true;
            }

            if (n.Active_3)
            {
                if (isInChunk(xPos - 1, yPos))
                {
                    if (n.tile_3.type == tempChunk.backgroundTiles[xPos - 1, yPos].type)
                    {
                        nMatch3 = true;
                    }
                }
            }
            else
            {
                nMatch3 = true;
            }

            if (n.Active_4)
            {
                if (isInChunk(xPos, yPos))
                {
                    if (n.tile_4.type == tempChunk.backgroundTiles[xPos, yPos].type)
                    {
                        nMatch4 = true;
                    }
                }
            }
            else
            {
                nMatch4 = true;
            }

            if (n.Active_5)
            {
                if (isInChunk(xPos + 1, yPos))
                {
                    if (n.tile_5.type == tempChunk.backgroundTiles[xPos + 1, yPos].type)
                    {
                        nMatch5 = true;
                    }
                }
            }
            else
            {
                nMatch5 = true;
            }

            if (n.Active_6)
            {
                if (isInChunk(xPos - 1, yPos + 1))
                {
                    if (n.tile_6.type == tempChunk.backgroundTiles[xPos - 1, yPos + 1].type)
                    {
                        nMatch6 = true;
                    }
                }
            }
            else
            {
                nMatch6 = true;
            }

            if (n.Active_7)
            {
                if (isInChunk(xPos, yPos + 1))
                {
                    if (n.tile_7.type == tempChunk.backgroundTiles[xPos, yPos + 1].type)
                    {
                        nMatch7 = true;
                    }
                }
            }
            else
            {
                nMatch7 = true;
            }

            if (n.Active_8)
            {
                if (isInChunk(xPos + 1, yPos + 1))
                {
                    if (n.tile_8.type == tempChunk.backgroundTiles[xPos + 1, yPos + 1].type)
                    {
                        nMatch8 = true;
                    }
                }
            }
            else
            {
                nMatch8 = true;
            }

            if (nMatch0 && nMatch1 && nMatch2 && nMatch3 && nMatch4 && nMatch5 && nMatch6 && nMatch7 && nMatch8 && isInChunk(xPos, yPos))
            {
                tempChunk.backgroundTiles[xPos, yPos] = n.CenterTile;
            }
        }
Ejemplo n.º 2
0
        private List <nineSplice> createNineSpliceTemplates()
        {
            List <nineSplice> temp = new List <nineSplice>();

            worldTile waterTile = new worldTile();

            waterTile.graphics.tAtlas = wData.tAtlas;
            waterTile.graphics.TexID  = (int)WorldTexID.water0;
            waterTile.type            = "water";
            waterTile.isCollideable   = true;
            waterTile.isContainer     = false;

            worldTile grassTile = new worldTile();

            grassTile.graphics.tAtlas = wData.tAtlas;
            grassTile.graphics.TexID  = (int)WorldTexID.grass0;
            grassTile.type            = "grass";
            grassTile.isCollideable   = false;
            grassTile.isContainer     = false;

            worldTile sandTile = new worldTile();

            sandTile.graphics.tAtlas = wData.tAtlas;
            sandTile.graphics.TexID  = (int)WorldTexID.sand0;
            sandTile.type            = "sand";
            sandTile.isCollideable   = false;
            sandTile.isContainer     = false;

            nineSplice n0 = new nineSplice();

            n0.Active_1 = true;
            n0.tile_1   = waterTile;

            n0.Active_4 = true;
            n0.tile_4   = grassTile;

            n0.CenterTile = grassTile;
            n0.CenterTile.graphics.TexID = (int)WorldTexID.oceanToGrassTopMid;

            temp.Add(n0);

            nineSplice n1 = new nineSplice();

            n1.Active_1 = true;
            n1.tile_1   = waterTile;

            n1.Active_4 = true;
            n1.tile_4   = sandTile;

            n1.CenterTile = sandTile;
            n1.CenterTile.graphics.TexID = (int)WorldTexID.beachTopMid;

            temp.Add(n1);

            nineSplice n5 = new nineSplice();

            n5.Active_3 = true;
            n5.tile_3   = waterTile;

            n5.Active_4 = true;
            n5.tile_4   = sandTile;

            n5.CenterTile = sandTile;
            n5.CenterTile.graphics.TexID = (int)WorldTexID.beachMidLeft;

            temp.Add(n5);

            nineSplice n7 = new nineSplice();

            n7.Active_5 = true;
            n7.tile_5   = waterTile;

            n7.Active_4 = true;
            n7.tile_4   = sandTile;

            n7.CenterTile = sandTile;
            n7.CenterTile.graphics.TexID = (int)WorldTexID.beachMidRight;

            temp.Add(n7);

            nineSplice n8 = new nineSplice();

            n8.Active_4 = true;
            n8.tile_4   = sandTile;

            n8.Active_7 = true;
            n8.tile_7   = waterTile;

            n8.CenterTile = sandTile;
            n8.CenterTile.graphics.TexID = (int)WorldTexID.beachBottomMid;

            temp.Add(n8);

            nineSplice n2 = new nineSplice();

            n2.Active_1 = true;
            n2.tile_1   = waterTile;

            n2.Active_3 = true;
            n2.tile_3   = waterTile;

            n2.Active_4 = true;
            n2.tile_4   = sandTile;

            n2.CenterTile = sandTile;
            n2.CenterTile.graphics.TexID = (int)WorldTexID.beachTopLeft;

            temp.Add(n2);

            nineSplice n3 = new nineSplice();

            n3.Active_1 = true;
            n3.tile_1   = waterTile;

            n3.Active_4 = true;
            n3.tile_4   = sandTile;

            n3.Active_5 = true;
            n3.tile_5   = waterTile;

            n3.CenterTile = sandTile;
            n3.CenterTile.graphics.TexID = (int)WorldTexID.beachTopRight;

            temp.Add(n3);

            nineSplice n9 = new nineSplice();

            n9.Active_3 = true;
            n9.tile_3   = waterTile;

            n9.Active_4 = true;
            n9.tile_4   = sandTile;

            n9.Active_7 = true;
            n9.tile_7   = waterTile;

            n9.CenterTile = sandTile;
            n9.CenterTile.graphics.TexID = (int)WorldTexID.beachBottomLeft;

            temp.Add(n9);

            nineSplice n10 = new nineSplice();

            n10.Active_5 = true;
            n10.tile_5   = waterTile;

            n10.Active_4 = true;
            n10.tile_4   = sandTile;

            n10.Active_7 = true;
            n10.tile_7   = waterTile;

            n10.CenterTile = sandTile;
            n10.CenterTile.graphics.TexID = (int)WorldTexID.beachBottomRight;

            temp.Add(n10);

            nineSplice n4 = new nineSplice();

            n4.Active_0 = true;
            n4.tile_0   = waterTile;

            n4.Active_1 = true;
            n4.tile_1   = sandTile;

            n4.Active_3 = true;
            n4.tile_3   = sandTile;

            n4.Active_4 = true;
            n4.tile_4   = sandTile;

            n4.CenterTile = sandTile;
            n4.CenterTile.graphics.TexID = (int)WorldTexID.beachInteriorBottomRight;

            temp.Add(n4);

            nineSplice n6 = new nineSplice();

            n6.Active_1 = true;
            n6.tile_1   = sandTile;

            n6.Active_5 = true;
            n6.tile_5   = sandTile;

            n6.Active_4 = true;
            n6.tile_4   = sandTile;

            n6.Active_2 = true;
            n6.tile_2   = waterTile;

            n6.CenterTile = sandTile;
            n6.CenterTile.graphics.TexID = (int)WorldTexID.beachInteriorBottomLeft;

            temp.Add(n6);

            nineSplice n11 = new nineSplice();

            n11.Active_5 = true;
            n11.tile_5   = sandTile;

            n11.Active_7 = true;
            n11.tile_7   = sandTile;

            n11.Active_4 = true;
            n11.tile_4   = sandTile;

            n11.Active_8 = true;
            n11.tile_8   = waterTile;

            n11.CenterTile = sandTile;
            n11.CenterTile.graphics.TexID = (int)WorldTexID.beachInteriorTopLeft;

            temp.Add(n11);

            nineSplice n12 = new nineSplice();

            n12.Active_3 = true;
            n12.tile_3   = sandTile;

            n12.Active_7 = true;
            n12.tile_7   = sandTile;

            n12.Active_4 = true;
            n12.tile_4   = sandTile;

            n12.Active_6 = true;
            n12.tile_6   = waterTile;

            n12.CenterTile = sandTile;
            n12.CenterTile.graphics.TexID = (int)WorldTexID.beachInteriorTopRight;

            temp.Add(n12);

            nineSplice n13 = new nineSplice();

            n13.Active_4 = true;
            n13.tile_4   = grassTile;

            n13.Active_7 = true;
            n13.tile_7   = sandTile;

            n13.CenterTile = grassTile;
            n13.CenterTile.graphics.TexID = (int)WorldTexID.grassToSandTopMid;

            temp.Add(n13);

            nineSplice n14 = new nineSplice();

            n14.Active_4 = true;
            n14.tile_4   = grassTile;

            n14.Active_5 = true;
            n14.tile_5   = sandTile;

            n14.CenterTile = grassTile;
            n14.CenterTile.graphics.TexID = (int)WorldTexID.grassToSandMidLeft;

            temp.Add(n14);

            nineSplice n15 = new nineSplice();

            n15.Active_4 = true;
            n15.tile_4   = grassTile;

            n15.Active_3 = true;
            n15.tile_3   = sandTile;

            n15.CenterTile = grassTile;
            n15.CenterTile.graphics.TexID = (int)WorldTexID.grassToSandMidRight;

            temp.Add(n15);

            nineSplice n16 = new nineSplice();

            n16.Active_4 = true;
            n16.tile_4   = grassTile;

            n16.Active_1 = true;
            n16.tile_1   = sandTile;

            n16.CenterTile = grassTile;
            n16.CenterTile.graphics.TexID = (int)WorldTexID.grassToSandBottomMid;

            temp.Add(n16);

            nineSplice n17 = new nineSplice();

            n17.Active_4 = true;
            n17.tile_4   = grassTile;

            n17.Active_5 = true;
            n17.tile_5   = grassTile;

            n17.Active_7 = true;
            n17.tile_7   = grassTile;

            n17.Active_8 = true;
            n17.tile_8   = sandTile;

            n17.CenterTile = grassTile;
            n17.CenterTile.graphics.TexID = (int)WorldTexID.grassToSandTopLeft;

            temp.Add(n17);

            nineSplice n18 = new nineSplice();

            n18.Active_4 = true;
            n18.tile_4   = grassTile;

            n18.Active_3 = true;
            n18.tile_3   = grassTile;

            n18.Active_7 = true;
            n18.tile_7   = grassTile;

            n18.Active_6 = true;
            n18.tile_6   = sandTile;

            n18.CenterTile = grassTile;
            n18.CenterTile.graphics.TexID = (int)WorldTexID.grassToSandTopRight;

            temp.Add(n18);

            nineSplice n19 = new nineSplice();

            n19.Active_4 = true;
            n19.tile_4   = grassTile;

            n19.Active_1 = true;
            n19.tile_1   = grassTile;

            n19.Active_5 = true;
            n19.tile_5   = grassTile;

            n19.Active_2 = true;
            n19.tile_2   = sandTile;

            n19.CenterTile = grassTile;
            n19.CenterTile.graphics.TexID = (int)WorldTexID.grassToSandBottomLeft;

            temp.Add(n19);

            nineSplice n20 = new nineSplice();

            n20.Active_4 = true;
            n20.tile_4   = grassTile;

            n20.Active_1 = true;
            n20.tile_1   = grassTile;

            n20.Active_3 = true;
            n20.tile_3   = grassTile;

            n20.Active_0 = true;
            n20.tile_0   = sandTile;

            n20.CenterTile = grassTile;
            n20.CenterTile.graphics.TexID = (int)WorldTexID.grassToSandBottomRight;

            temp.Add(n20);

            nineSplice n21 = new nineSplice();

            n21.Active_4 = true;
            n21.tile_4   = grassTile;

            n21.Active_5 = true;
            n21.tile_5   = grassTile;

            n21.Active_7 = true;
            n21.tile_7   = grassTile;

            n21.Active_1 = true;
            n21.tile_1   = sandTile;

            n21.Active_3 = true;
            n21.tile_3   = sandTile;

            n21.CenterTile = grassTile;
            n21.CenterTile.graphics.TexID = (int)WorldTexID.beachToGrassTopLeft;

            temp.Add(n21);

            nineSplice n22 = new nineSplice();

            n22.Active_4 = true;
            n22.tile_4   = grassTile;

            n22.Active_3 = true;
            n22.tile_3   = grassTile;

            n22.Active_7 = true;
            n22.tile_7   = grassTile;

            n22.Active_1 = true;
            n22.tile_1   = sandTile;

            n22.Active_5 = true;
            n22.tile_5   = sandTile;

            n22.CenterTile = grassTile;
            n22.CenterTile.graphics.TexID = (int)WorldTexID.beachToGrassTopRight;

            temp.Add(n22);

            nineSplice n23 = new nineSplice();

            n23.Active_4 = true;
            n23.tile_4   = grassTile;

            n23.Active_1 = true;
            n23.tile_1   = grassTile;

            n23.Active_5 = true;
            n23.tile_5   = grassTile;

            n23.Active_3 = true;
            n23.tile_3   = sandTile;

            n23.Active_7 = true;
            n23.tile_7   = sandTile;

            n23.CenterTile = grassTile;
            n23.CenterTile.graphics.TexID = (int)WorldTexID.beachToGrassBottomLeft;

            temp.Add(n23);

            nineSplice n24 = new nineSplice();

            n24.Active_4 = true;
            n24.tile_4   = grassTile;

            n24.Active_1 = true;
            n24.tile_1   = grassTile;

            n24.Active_3 = true;
            n24.tile_3   = grassTile;

            n24.Active_5 = true;
            n24.tile_5   = sandTile;

            n24.Active_7 = true;
            n24.tile_7   = sandTile;

            n24.CenterTile = grassTile;
            n24.CenterTile.graphics.TexID = (int)WorldTexID.beachToGrassBottomRight;

            temp.Add(n24);

            return(temp);
        }