Beispiel #1
0
        public static FirestoreLevel FromLevel(Level level)
        {
            FirestoreLevel firestoreLevel = new FirestoreLevel
            {
                Id                  = level.id,
                Name                = level.name,
                AuthorId            = level.authorId,
                AuthorName          = level.authorName,
                ObjectPositions     = new FirestoreVector2Int[level.objectPositions.Count],
                PelletCount         = level.pelletCount,
                TopLeftPosition     = FirestoreVector2Int.FromVector2Int(level.topLeftPosition),
                TopRightPosition    = FirestoreVector2Int.FromVector2Int(level.topRightPosition),
                BottomLeftPosition  = FirestoreVector2Int.FromVector2Int(level.bottomLeftPosition),
                BottomRightPosition = FirestoreVector2Int.FromVector2Int(level.bottomRightPosition),
                GhostDoorPosition   = FirestoreVector2Int.FromVector2Int(level.ghostDoorPosition),
                GhostHouse          = FirestoreVector2Int.FromVector2Int(level.ghostHousePosition),
                PacManPosition      = FirestoreVector2Int.FromVector2Int(level.pacManPosition)
            };

            firestoreLevel.ObjectTypes = new LevelObjectType[firestoreLevel.ObjectPositions.Length];
            for (int i = 0; i < firestoreLevel.ObjectPositions.Length; i++)
            {
                firestoreLevel.ObjectPositions[i] = FirestoreVector2Int.FromVector2Int(level.objectPositions[i]);
                firestoreLevel.ObjectTypes[i]     = level.objectTypes[i];
            }

            return(firestoreLevel);
        }
Beispiel #2
0
        public static FirestoreVector2Int FromVector2Int(Vector2Int vector2Int)
        {
            FirestoreVector2Int firestoreVector2Int = new FirestoreVector2Int
            {
                X = vector2Int.x,
                Y = vector2Int.y
            };

            return(firestoreVector2Int);
        }
Beispiel #3
0
 public static Vector2Int ToVector2Int(FirestoreVector2Int firestoreVector2Int)
 {
     return(new Vector2Int(firestoreVector2Int.X, firestoreVector2Int.Y));
 }