Commit d6dc3643 authored by Jordan B Mckenney's avatar Jordan B Mckenney

Merge branch 'character' of git.gmu.edu:gadig/four into jmckenne

# Conflicts:
#	Assets/Prefabs/Ability - Water Shield Projectile.prefab
#	Assets/Scenes/player_animation_test.unity
parents a0dcf274 9eb1fc2b
fileFormatVersion: 2 fileFormatVersion: 2
guid: 9e2b88c6e90966c4893c40b3770da65a guid: 7a81b522c3eaea24ca8fcc228b393f19
folderAsset: yes folderAsset: yes
timeCreated: 1475761198 timeCreated: 1479440498
licenseType: Free licenseType: Free
DefaultImporter: DefaultImporter:
userData: userData:
......
fileFormatVersion: 2 fileFormatVersion: 2
guid: 026ac4c911a0e114891980ac911e46c6 guid: b2d2ab70ad127a6488be99d9bbbce7a9
folderAsset: yes folderAsset: yes
timeCreated: 1475761198 timeCreated: 1477028252
licenseType: Free licenseType: Free
DefaultImporter: DefaultImporter:
userData: userData:
......
using UnityEngine;
using UnityEditor;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System;
[System.Serializable]
public class goColor
{
public GameObject go;
public GameObject border;
public Color32 rgb;
public goColor(GameObject go, Color32 rgb, GameObject border = null)
{
this.go = go;
this.border = border;
this.rgb = rgb;
}
public goColor(GameObject go, byte r, byte g, byte b, GameObject border = null)
{
this.go = go;
this.border = border;
this.rgb = new Color32(r, g, b, 0);
}
}
[System.Serializable]
public class goAlpha
{
public GameObject go;
public int aPercent;
public goAlpha(GameObject go, int val)
{
this.go = go;
aPercent = val;
}
public static byte percentToByte(int val)
{
return BitConverter.GetBytes( Mathf.RoundToInt( 255 * ((float)(((((val < 100) ? val : 100) > 0) ? val : 0)) / 100)))[0];
}
public static int byteToPercent(byte val)
{
return val / 255 * 100;
}
}
public class EditorTileSelect : MonoBehaviour
{
public string levelName;
public goColor[] rgbMap;
public goAlpha[] aMap;
public void save()
{
string path = Application.dataPath + "/Resources/Levels/" + levelName + ".txt";
if (!File.Exists(path))
{
File.Create(path);
}
StreamWriter sw = new StreamWriter(path);
for (int i = 0; i < rgbMap.Length; i++) // Write RGB values
{
//Debug.Log(AssetDatabase.GetAssetPath(gos[i]));
sw.WriteLine(AssetDatabase.GetAssetPath(rgbMap[i].go));
if(rgbMap[i].border != null)
sw.WriteLine(AssetDatabase.GetAssetPath(rgbMap[i].border));
sw.WriteLine(rgbMap[i].rgb.r);
sw.WriteLine(rgbMap[i].rgb.g);
sw.WriteLine(rgbMap[i].rgb.b);
}
if(aMap.Length > 0)
{
sw.WriteLine(":");
for (int i = 0; i < aMap.Length; i++)
{
sw.WriteLine(AssetDatabase.GetAssetPath(aMap[i].go));
sw.WriteLine(goAlpha.percentToByte(aMap[i].aPercent));
}
}
sw.Close();
}
public void load()
{
List<goColor> colors = new List<goColor>();
List<goAlpha> alphas = new List<goAlpha>();
StreamReader sr;
string path = Application.dataPath + "/Resources/Levels/" + levelName + ".txt";
try
{
GameObject go;
GameObject border;
byte r, g, b;
string line;
bool doingAlphas = false;
sr = new StreamReader(path);
while (!sr.EndOfStream) // Read values until EOS
{
line = sr.ReadLine();
if (line == ":")
{
doingAlphas = true;
line = sr.ReadLine();
}
go = AssetDatabase.LoadAssetAtPath<GameObject>(line); // Load GameObject
line = sr.ReadLine();
if (!char.IsDigit(line[0])) // Has a border
{
border = AssetDatabase.LoadAssetAtPath<GameObject>(line);
line = sr.ReadLine();
}
else
border = null;
if (!doingAlphas) // Reading RGB values
{
byte.TryParse(line, out r); // Read red value
line = sr.ReadLine();
byte.TryParse(line, out g); // Read green value
line = sr.ReadLine();
byte.TryParse(line, out b); // Read blue value
//Debug.Log(r + ", " + g + ", " + b + " | " + go.name);
colors.Add(new goColor(go, r, g, b, border));
}else // Reading alpha values
{
byte.TryParse(line, out r); // Read alpha value (store in r because it wont be used any more)
//Debug.Log(r + " | " + go.name);
alphas.Add(new goAlpha(go, r));
}
}
sr.Close();
}
catch (System.Exception)
{
throw;
}
rgbMap = colors.ToArray();
aMap = alphas.ToArray();
}
}
[CustomEditor (typeof(EditorTileSelect))]
public class EditorTileSelectEditor : Editor
{
public override void OnInspectorGUI()
{
base.OnInspectorGUI();
if(GUILayout.Button("Save"))
{
((EditorTileSelect)target).save();
}
if(GUILayout.Button("Load"))
{
((EditorTileSelect)target).load();
}
}
}
fileFormatVersion: 2
guid: 71193755354b6084f8c83dfae7e13884
timeCreated: 1477028252
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
This diff is collapsed.
fileFormatVersion: 2
guid: 2eb8d042094fca74aacf1bbf0b5029bc
timeCreated: 1477028252
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
public class MapMaker : MonoBehaviour {
public GameObject emptyTile;
private Text rowsText;
private Text colsText;
private Tile[,] map;
void Start () {
rowsText = GameObject.Find ("Rows").transform.FindChild("Text").GetComponent<Text> ();
colsText = GameObject.Find ("Cols").transform.FindChild("Text").GetComponent<Text> ();
}
public void GenerateEmptyTiles () {
int rows = 0;
int cols = 0;
int.TryParse (rowsText.text, out rows);
int.TryParse (colsText.text, out cols);
map = new Tile[cols, rows];
float startx = -(float)cols / 2f * emptyTile.transform.lossyScale.x;
float starty = (float)rows / 2f * emptyTile.transform.lossyScale.y;
for (int y = 0; y < rows; y++) {
for (int x = 0; x < cols; x++) {
map[x, y] = ((GameObject) Instantiate (emptyTile, new Vector2(startx + x * emptyTile.GetComponent<BoxCollider2D>().size.x,
starty - y * emptyTile.GetComponent<BoxCollider2D>().size.x), Quaternion.identity)).GetComponent<Tile> ();
map [x, y].x = x;
map [x, y].y = y;
}
}
}
}
fileFormatVersion: 2
guid: 01d8f8592a701b6458d43a3ab7d32040
timeCreated: 1477612509
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2 fileFormatVersion: 2
guid: 647a00acb440c0c4aa002d9f0ae2ffd5 guid: 93b9c03f790a3c04ca6edb5776f2c448
folderAsset: yes folderAsset: yes
timeCreated: 1475761198 timeCreated: 1477029188
licenseType: Free licenseType: Free
DefaultImporter: DefaultImporter:
userData: userData:
......
fileFormatVersion: 2
guid: 45f2106bf38a3fc49ad19b096eb82d56
timeCreated: 1477029213
licenseType: Free
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: d26b87629a33e7f4ea695aae8f4c5121
timeCreated: 1477614983
licenseType: Free
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: d3fd44e8ccb7ad54b8f9d534900cdb93
timeCreated: 1477085344
licenseType: Free
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: d84b90404a95ff74c813d205e25dfd0c
timeCreated: 1477085344
licenseType: Free
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: bab42ab931c6fd8429640aedbf6675f6
folderAsset: yes
timeCreated: 1477029052
licenseType: Free
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 7213ed333eec9ca44a24200f0794a9f5
folderAsset: yes
timeCreated: 1477029052
licenseType: Free
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 74d7f1f922d265a4cb8e8989f9608bbf
timeCreated: 1477086866
licenseType: Free
TextureImporter:
fileIDToRecycleName: {}
serializedVersion: 2
mipmaps:
mipMapMode: 0
enableMipMap: 1
linearTexture: 0
correctGamma: 0
fadeOut: 0
borderMipMap: 0
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 1
grayScaleToAlpha: 0
generateCubemap: 0
cubemapConvolution: 0
cubemapConvolutionSteps: 7
cubemapConvolutionExponent: 1.5
seamlessCubemap: 0
textureFormat: -1
maxTextureSize: 2048
textureSettings:
filterMode: 0
aniso: 16
mipBias: -1
wrapMode: 1
nPOTScale: 0
lightmap: 0
rGBM: 0
compressionQuality: 50
allowsAlphaSplitting: 0
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spritePixelsToUnits: 100
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 5
buildTargetSettings: []
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:
Assets/Resources/Prefab/1_front.prefab
0
0
0
Assets/Resources/Prefab/5_back.prefab
255
255
255
Assets/Resources/Prefab/crate_16.prefab
255
0
0
Assets/Resources/Prefab/Tree_01.prefab
0
255
0
fileFormatVersion: 2
guid: b994f2c1c032bdf47a3135af993751bf
timeCreated: 1477086128
licenseType: Free
TextScriptImporter:
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 87ed77aef35072942a2705888df1a98f
timeCreated: 1477086529
licenseType: Free
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: fe45769cb9d72ef458a5450c4d6cb5f6
timeCreated: 1477086550
licenseType: Free
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 47cd14cbf89bb8c4e9312e93e76b8811
timeCreated: 1477086506
licenseType: Free
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 9286c3aa67775f045a5055f3f164abde
folderAsset: yes
timeCreated: 1477085342
licenseType: Free
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 9ebfaa068bf3ce248a1b8b8036d59c46
timeCreated: 1477086128
licenseType: Free
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: d9bbbcc5e70ac6c4bbd42b3651aefea7
timeCreated: 1477611955
licenseType: Free
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 42f44e0a69d63724f928d4e2bca07485
timeCreated: 1477613634
licenseType: Free
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 3449ac6e2a03fd54fa5d10fa4b3518ac
timeCreated: 1475798950
licenseType: Free
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 2c983046a45213c438316fd281ecc003
timeCreated: 1477182966
licenseType: Free
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 4560b1c3b268ec94ca00c66f9b71ea9d
folderAsset: yes
timeCreated: 1477085342
licenseType: Free
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
using UnityEngine;
using System.Collections;
using UnityEngine.SceneManagement;
public class DoorSceneScript : DoorScript {
// Use this for initialization
public string nextScene;
void Start () {
}