Exemple #1
0
 public virtual bool MatchPattern(Grid3D grid, int x, int y, params Type[] types)
 {
     return(isType(grid, x, y - 1, types) == top &&
            isType(grid, x - 1, y, types) == left &&
            isType(grid, x + 1, y, types) == right &&
            isType(grid, x, y + 1, types) == bottom);
 }
Exemple #2
0
 public override bool MatchPattern(Grid3D grid, int x, int y, params Type[] types)
 {
     return(isType(grid, x - 1, y - 1, types) == tl &&
            isType(grid, x - 1, y + 1, types) == tr &&
            isType(grid, x + 1, y - 1, types) == bl &&
            isType(grid, x + 1, y + 1, types) == br);
 }
Exemple #3
0
        public virtual void SetPosition(Grid3D parent, int x, int y)
        {
            this.ParentGrid = parent;
            float   scale = parent.GetGridSize();
            Vector3 pos   = new Vector3(scale * x, 0, scale * y);

            this.Translation = pos;
            this.X           = x;
            this.Y           = y;
        }
Exemple #4
0
 protected bool isType(Grid3D grid, int x, int y, Type[] types)
 {
     if (x < 0 || y < 0 || x >= grid.Width || y >= grid.Height)
     {
         return(false);
     }
     foreach (Type t in types)
     {
         if (t.IsInstanceOfType(grid.Grid[x, y]))
         {
             return(true);
         }
     }
     return(false);
 }
Exemple #5
0
        public override void SetPosition(Grid3D parent, int x, int y)
        {
            bool         x_odd  = (x % 2) == 0;
            bool         y_odd  = (y % 2) == 0;
            MeshInstance bright = this.GetNode <MeshInstance>(new NodePath("MeshBright"));
            MeshInstance dark   = this.GetNode <MeshInstance>(new NodePath("MeshDark"));

            if (x_odd == y_odd)
            {
                bright.Visible = false;
                dark.Visible   = true;
            }
            else
            {
                bright.Visible = true;
                dark.Visible   = false;
            }
            base.SetPosition(parent, x, y);
        }
Exemple #6
0
        public override void GridReady(Grid3D parent, int x, int y)
        {
            int i = 0;

            for (i = 0; i < tilemaps.Length; i++)
            {
                if (tilemaps[i].MatchPattern(parent, x, y, typeof(Hill)))
                {
                    break;
                }
            }
            if (i == tilemaps.Length)
            {
                return;
            }
            surface.Visible = false;
            wall.Visible    = false;
            corner1.Visible = false;
            corner2.Visible = false;

            rotator.RotationDegrees   = new Vector3(0, rotations[i], 0);
            visibleObjects[i].Visible = true;
        }
Exemple #7
0
 public override void SetPosition(Grid3D parent, int x, int y)
 {
     base.SetPosition(parent, x, y);
 }
Exemple #8
0
 public virtual void GridReady(Grid3D parent, int x, int y)
 {
 }