Implemented resource manager which can load textures and levels.

Implemented script to generate Resources.g.h file linking assets to code.
Added assets from old project.
This commit is contained in:
2016-11-12 14:17:00 +02:00
parent 294fd6e2ac
commit 914ae0de0d
74 changed files with 14937 additions and 304 deletions

View File

@ -0,0 +1,43 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Linq;
using Model;
using UnityEngine;
namespace Storage
{
public static class MapLoader
{
public static void LoadLayer(Map map, string layerName, string dataCsv)
{
// Process layer attributes
Layer layer = new Layer();
layer.Name = layerName;
// Split into substrings
string[] dataRows = dataCsv.Split(new[] { '\n', '\r' }, StringSplitOptions.RemoveEmptyEntries);
for (int y = 0; y < dataRows.Length; y++)
{
string[] dataRowItems = dataRows[y].Trim().Split(',');
// Allocate cells
if (y == 0)
{
layer.Cells = new int[dataRows.Length, dataRowItems.Length];
layer.Width = dataRowItems.Length;
layer.Height = dataRows.Length;
}
// Set cells
for (int x = 0; x < layer.Width; x++)
layer.Cells[y, x] = Int32.Parse(dataRowItems[x]);
}
// Add layer
map.Layers.Add(layer);
}
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 6c11a44a1418f7c4bbfbd9f82893e900
timeCreated: 1477767546
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: