Пример #1
0
        public Vector3 ToWorldPos(MyVector3Int myV3Int, int longX, int longY)
        {
            var bottomV3Int = myV3Int.ToVector3Int();
            var leftV3Int   = new Vector3Int(0, longY - 1, 0) + bottomV3Int;
            var rightV3Int  = new Vector3Int(longX - 1, 0, 0) + bottomV3Int;
            var topV3Int    = new Vector3Int(rightV3Int.x, leftV3Int.y, 0);

            var posX = (tileMap.CellToWorld(leftV3Int).x + tileMap.CellToWorld(rightV3Int).x) / 2.0f;
            var posY = (tileMap.CellToWorld(bottomV3Int).z + (tileMap.CellToWorld(topV3Int + new Vector3Int(1, 1, 0)).z)) / 2.0f;

            return(new Vector3(posX, 0, posY));
        }
Пример #2
0
        public bool HasTile(MyVector3Int myVector3Int)
        {
            for (int i = 0; i < TargetData.MenuDataLst.Count; i++)
            {
                foreach (var lst in GetTileTargetLst(i))
                {
                    var tileData = lst.TileDataLst.Find(x => (x.MyV3Int.x == myVector3Int.x) && (x.MyV3Int.y == myVector3Int.y) && (x.MyV3Int.z == myVector3Int.z));

                    if (null != tileData)
                    {
                        return(true);
                    }
                }
            }
            return(false);
        }
Пример #3
0
        public Vector3 GetPos(MyVector3Int myV3Int)
        {
            var v3Int = myV3Int.ToVector3Int();

            return(GetPos(v3Int));
        }
Пример #4
0
 public static Vector3Int ToVector3Int(this MyVector3Int v3Int)
 {
     return(new Vector3Int(v3Int.x, v3Int.y, 0));
 }