commit 5762e435dd1003867de945028ef42efe5fd30b54 Author: Tyrel Souza Date: Thu Aug 27 01:09:43 2015 -0400 Initial Commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a39b470 --- /dev/null +++ b/.gitignore @@ -0,0 +1,25 @@ +# Created by https://www.gitignore.io/api/unity + +### Unity ### +/[Ll]ibrary/ +/[Tt]emp/ +/[Oo]bj/ +/[Bb]uild/ + +# Autogenerated VS/MD solution and project files +*.csproj +*.unityproj +*.sln +*.suo +*.tmp +*.user +*.userprefs +*.pidb +*.booproj + +# Unity3D generated meta files +*.pidb.meta + +# Unity3D Generated File On Crash Reports +sysinfo.txt + diff --git a/Assets/Game.unity b/Assets/Game.unity new file mode 100644 index 0000000..2b42cb4 Binary files /dev/null and b/Assets/Game.unity differ diff --git a/Assets/Game.unity.meta b/Assets/Game.unity.meta new file mode 100644 index 0000000..33a910c --- /dev/null +++ b/Assets/Game.unity.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 9e67a3a591b256644a1daa40ebf32a2b +timeCreated: 1440645242 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Resources.meta b/Assets/Resources.meta new file mode 100644 index 0000000..97c1168 --- /dev/null +++ b/Assets/Resources.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 2e575c5b12b669b40b861bc5ff56ad2c +folderAsset: yes +timeCreated: 1440639305 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Resources/Bouncy.physicMaterial b/Assets/Resources/Bouncy.physicMaterial new file mode 100644 index 0000000..75263e4 Binary files /dev/null and b/Assets/Resources/Bouncy.physicMaterial differ diff --git a/Assets/Resources/Bouncy.physicMaterial.meta b/Assets/Resources/Bouncy.physicMaterial.meta new file mode 100644 index 0000000..24771ed --- /dev/null +++ b/Assets/Resources/Bouncy.physicMaterial.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 37cbe527af0aed6438ce40c2beae8260 +timeCreated: 1440641514 +licenseType: Free +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Resources/Materials.meta b/Assets/Resources/Materials.meta new file mode 100644 index 0000000..161b1b6 --- /dev/null +++ b/Assets/Resources/Materials.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 12900458aad356b48ab4ffd644ec05f1 +folderAsset: yes +timeCreated: 1440644678 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Resources/Materials/Black.mat b/Assets/Resources/Materials/Black.mat new file mode 100644 index 0000000..1c72a41 Binary files /dev/null and b/Assets/Resources/Materials/Black.mat differ diff --git a/Assets/Resources/Materials/Black.mat.meta b/Assets/Resources/Materials/Black.mat.meta new file mode 100644 index 0000000..4b04cc8 --- /dev/null +++ b/Assets/Resources/Materials/Black.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: b66f9e7d5a4f43c4689ae1f1c814c68f +timeCreated: 1440644770 +licenseType: Free +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Resources/Materials/Blue.mat b/Assets/Resources/Materials/Blue.mat new file mode 100644 index 0000000..c90e656 Binary files /dev/null and b/Assets/Resources/Materials/Blue.mat differ diff --git a/Assets/Resources/Materials/Blue.mat.meta b/Assets/Resources/Materials/Blue.mat.meta new file mode 100644 index 0000000..0771506 --- /dev/null +++ b/Assets/Resources/Materials/Blue.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 349f863a023bc5a438ae6df82cbc6ae9 +timeCreated: 1440644693 +licenseType: Free +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Resources/Materials/Green.mat b/Assets/Resources/Materials/Green.mat new file mode 100644 index 0000000..9f64c57 Binary files /dev/null and b/Assets/Resources/Materials/Green.mat differ diff --git a/Assets/Resources/Materials/Green.mat.meta b/Assets/Resources/Materials/Green.mat.meta new file mode 100644 index 0000000..945ff55 --- /dev/null +++ b/Assets/Resources/Materials/Green.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: b8b897b2d7978e74ab8aefdd126fdd95 +timeCreated: 1440644701 +licenseType: Free +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Resources/Materials/Orange.mat b/Assets/Resources/Materials/Orange.mat new file mode 100644 index 0000000..f83cdcd Binary files /dev/null and b/Assets/Resources/Materials/Orange.mat differ diff --git a/Assets/Resources/Materials/Orange.mat.meta b/Assets/Resources/Materials/Orange.mat.meta new file mode 100644 index 0000000..c154d5b --- /dev/null +++ b/Assets/Resources/Materials/Orange.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 8a5ef4b1cfd15bf46a56074b8608133f +timeCreated: 1440644755 +licenseType: Free +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Resources/Materials/Purple.mat b/Assets/Resources/Materials/Purple.mat new file mode 100644 index 0000000..8412038 Binary files /dev/null and b/Assets/Resources/Materials/Purple.mat differ diff --git a/Assets/Resources/Materials/Purple.mat.meta b/Assets/Resources/Materials/Purple.mat.meta new file mode 100644 index 0000000..4373262 --- /dev/null +++ b/Assets/Resources/Materials/Purple.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: e3c8801d956f2034b8466dd0d921ff3e +timeCreated: 1440644761 +licenseType: Free +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Resources/Materials/Red.mat b/Assets/Resources/Materials/Red.mat new file mode 100644 index 0000000..ca9a2d5 Binary files /dev/null and b/Assets/Resources/Materials/Red.mat differ diff --git a/Assets/Resources/Materials/Red.mat.meta b/Assets/Resources/Materials/Red.mat.meta new file mode 100644 index 0000000..7191888 --- /dev/null +++ b/Assets/Resources/Materials/Red.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: a54a669325f5641488ffbff0e4c9d872 +timeCreated: 1440644688 +licenseType: Free +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Resources/Materials/Yellow.mat b/Assets/Resources/Materials/Yellow.mat new file mode 100644 index 0000000..956ed8e Binary files /dev/null and b/Assets/Resources/Materials/Yellow.mat differ diff --git a/Assets/Resources/Materials/Yellow.mat.meta b/Assets/Resources/Materials/Yellow.mat.meta new file mode 100644 index 0000000..a51d672 --- /dev/null +++ b/Assets/Resources/Materials/Yellow.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 64e4a72fb823c2a439a046c6af121783 +timeCreated: 1440644724 +licenseType: Free +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Resources/Prefabs.meta b/Assets/Resources/Prefabs.meta new file mode 100644 index 0000000..5a991b8 --- /dev/null +++ b/Assets/Resources/Prefabs.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 17093aed8ebf63d448e23e6cc2dd1612 +folderAsset: yes +timeCreated: 1440639314 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Resources/Prefabs/Gem.prefab b/Assets/Resources/Prefabs/Gem.prefab new file mode 100644 index 0000000..2579055 Binary files /dev/null and b/Assets/Resources/Prefabs/Gem.prefab differ diff --git a/Assets/Resources/Prefabs/Gem.prefab.meta b/Assets/Resources/Prefabs/Gem.prefab.meta new file mode 100644 index 0000000..54673ab --- /dev/null +++ b/Assets/Resources/Prefabs/Gem.prefab.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: a0f118e7f2851f9419cb0bcd452b4424 +timeCreated: 1440639401 +licenseType: Free +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Resources/Scripts.meta b/Assets/Resources/Scripts.meta new file mode 100644 index 0000000..19b7ebf --- /dev/null +++ b/Assets/Resources/Scripts.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 3db396677d4ecb84cb133b123fe24518 +folderAsset: yes +timeCreated: 1440639318 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Resources/Scripts/Board.cs b/Assets/Resources/Scripts/Board.cs new file mode 100644 index 0000000..009cc70 --- /dev/null +++ b/Assets/Resources/Scripts/Board.cs @@ -0,0 +1,202 @@ +using UnityEngine; +using System.Collections; + +using System.Collections.Generic; + + + +public class Board : MonoBehaviour { + public List gems = new List(); + public int GridWidth; + public int GridHeight; + + public GameObject gemPrefab; + public Gem lastGem; + // Animation + public Vector3 gem1Start, gem1End, gem2Start, gem2End; + public bool isSwapping = false; + public Gem gem1, gem2; + public float startTime; + public float swapRate = 0.5f; + public int AmountToMatch = 3; + public bool isMatched = false; + int topLine = 6; + + + + + // Use this for initialization + void Start () { + for (int h = 0; h < GridHeight; h++) { + for (int w = 0; w < GridWidth; w++){ + GameObject g = Instantiate(gemPrefab, new Vector3(h,w,0), Quaternion.identity) as GameObject; + g.transform.parent = gameObject.transform; + gems.Add(g.GetComponent()); + } + } + } + + // Update is called once per frame + void Update () { + if (isMatched) { + for (int i =0; i topLine) { + return true; + } + if (gems[i].GetComponent().velocity.y > 0.1f){ + return true; + } + } + + return false; + } + + public void CheckForNearbyMatches (Gem g){ + List gemList = new List (); + ConstructMatchList (g.color, g, g.XCoord, g.YCoord, ref gemList); + FixMatchList (g, gemList); + } + + public void ConstructMatchList(string color, Gem gem, int XCoord, int YCoord, ref List MatchList){ + if (gem == null || gem.color != color || MatchList.Contains(gem)){ + return; + } + + MatchList.Add (gem); + + if (XCoord == gem.XCoord || YCoord == gem.YCoord){ + foreach(Gem g in gem.Neighbors){ + ConstructMatchList(color, g, XCoord, YCoord, ref MatchList); + } + } + + } + + + public void CheckMatch(){ + List gem1List = new List (); + List gem2List = new List (); + ConstructMatchList (gem1.color, gem1, gem1.XCoord, gem1.YCoord, ref gem1List); + FixMatchList (gem1, gem1List); + ConstructMatchList (gem2.color, gem2, gem2.XCoord, gem2.YCoord, ref gem2List); + FixMatchList (gem2, gem2List); + } + + + public void FixMatchList(Gem gem, List ListToFix){ + List rows = new List (); + List columns = new List (); + + for (int i=0; i = AmountToMatch) { + isMatched = true; + for (int i=0;i= AmountToMatch) { + isMatched = true; + for (int i=0;i().isKinematic = isOn; + } + } +} diff --git a/Assets/Resources/Scripts/Board.cs.meta b/Assets/Resources/Scripts/Board.cs.meta new file mode 100644 index 0000000..2484306 --- /dev/null +++ b/Assets/Resources/Scripts/Board.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 673a5430d64e7ce41aa8817b3db6ab98 +timeCreated: 1440639417 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Resources/Scripts/Feeler.cs b/Assets/Resources/Scripts/Feeler.cs new file mode 100644 index 0000000..ba0fa83 --- /dev/null +++ b/Assets/Resources/Scripts/Feeler.cs @@ -0,0 +1,20 @@ +using UnityEngine; +using System.Collections; + +public class Feeler : MonoBehaviour { + + public Gem owner; + + void OnTriggerEnter(Collider c){ + if (c.tag == "Gem") { + owner.AddNeighbor (c.GetComponent ()); + } + } + + void OnTriggerExit(Collider c){ + if (c.tag == "Gem") { + owner.RemoveNeighbor (c.GetComponent ()); + } + } + +} diff --git a/Assets/Resources/Scripts/Feeler.cs.meta b/Assets/Resources/Scripts/Feeler.cs.meta new file mode 100644 index 0000000..bcbcdbb --- /dev/null +++ b/Assets/Resources/Scripts/Feeler.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: fbdd79d083fff1249b04e9ca1b097ea5 +timeCreated: 1440640472 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Resources/Scripts/Gem.cs b/Assets/Resources/Scripts/Gem.cs new file mode 100644 index 0000000..36b16f5 --- /dev/null +++ b/Assets/Resources/Scripts/Gem.cs @@ -0,0 +1,78 @@ +using UnityEngine; +using System.Collections; +using System.Collections.Generic; + + +public class Gem : MonoBehaviour { + + public List Neighbors = new List(); + string[] gemMats = {"Red", "Green", "Blue", "Orange", "Black", "Purple", "Yellow"}; + public string color = ""; + public GameObject gemSphere; + public GameObject selector; + public bool isSelected; + public bool isMatched; + + + public int XCoord { + get { + return Mathf.RoundToInt(transform.localPosition.x); + } + } + public int YCoord { + get { + return Mathf.RoundToInt(transform.localPosition.y); + } + } + + + + // Use this for initialization + void Start () { + CreateGem (); + } + + // Update is called once per frame + void Update () { + + } + + void OnMouseDown(){ + if (!GameObject.Find ("Board").GetComponent ().isSwapping) { + ToggleSelector (); + GameObject.Find ("Board").GetComponent ().SwapGems (this); + } + } + + public void ToggleSelector(){ + isSelected = !isSelected; + selector.SetActive (isSelected); + + } + + public bool IsNeighborWith(Gem g){ + if (Neighbors.Contains (g)) { + return true; + } + return false; + } + + + public void AddNeighbor(Gem g){ + if(!Neighbors.Contains (g)){ + Neighbors.Add (g); + } + } + + public void RemoveNeighbor(Gem g){ + Neighbors.Remove (g); + } + + public void CreateGem(){ + color = gemMats [Random.Range (0, gemMats.Length)]; + + Material m = Resources.Load ("Materials/" + color) as Material; + gemSphere.GetComponent ().material = m; + isMatched = false; + } +} \ No newline at end of file diff --git a/Assets/Resources/Scripts/Gem.cs.meta b/Assets/Resources/Scripts/Gem.cs.meta new file mode 100644 index 0000000..75eb3a4 --- /dev/null +++ b/Assets/Resources/Scripts/Gem.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 7ac8858139702bc48b6175229805ab0c +timeCreated: 1440645702 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/ProjectSettings/AudioManager.asset b/ProjectSettings/AudioManager.asset new file mode 100644 index 0000000..237cdbb Binary files /dev/null and b/ProjectSettings/AudioManager.asset differ diff --git a/ProjectSettings/DynamicsManager.asset b/ProjectSettings/DynamicsManager.asset new file mode 100644 index 0000000..fbf7d37 Binary files /dev/null and b/ProjectSettings/DynamicsManager.asset differ diff --git a/ProjectSettings/EditorBuildSettings.asset b/ProjectSettings/EditorBuildSettings.asset new file mode 100644 index 0000000..508957e Binary files /dev/null and b/ProjectSettings/EditorBuildSettings.asset differ diff --git a/ProjectSettings/EditorSettings.asset b/ProjectSettings/EditorSettings.asset new file mode 100644 index 0000000..9e574c5 Binary files /dev/null and b/ProjectSettings/EditorSettings.asset differ diff --git a/ProjectSettings/GraphicsSettings.asset b/ProjectSettings/GraphicsSettings.asset new file mode 100644 index 0000000..fc78c06 Binary files /dev/null and b/ProjectSettings/GraphicsSettings.asset differ diff --git a/ProjectSettings/InputManager.asset b/ProjectSettings/InputManager.asset new file mode 100644 index 0000000..60af1d0 Binary files /dev/null and b/ProjectSettings/InputManager.asset differ diff --git a/ProjectSettings/NavMeshAreas.asset b/ProjectSettings/NavMeshAreas.asset new file mode 100644 index 0000000..b6943d9 Binary files /dev/null and b/ProjectSettings/NavMeshAreas.asset differ diff --git a/ProjectSettings/NetworkManager.asset b/ProjectSettings/NetworkManager.asset new file mode 100644 index 0000000..8969590 Binary files /dev/null and b/ProjectSettings/NetworkManager.asset differ diff --git a/ProjectSettings/Physics2DSettings.asset b/ProjectSettings/Physics2DSettings.asset new file mode 100644 index 0000000..78c0c16 Binary files /dev/null and b/ProjectSettings/Physics2DSettings.asset differ diff --git a/ProjectSettings/ProjectSettings.asset b/ProjectSettings/ProjectSettings.asset new file mode 100644 index 0000000..d1f35b8 Binary files /dev/null and b/ProjectSettings/ProjectSettings.asset differ diff --git a/ProjectSettings/ProjectVersion.txt b/ProjectSettings/ProjectVersion.txt new file mode 100644 index 0000000..8c353d8 --- /dev/null +++ b/ProjectSettings/ProjectVersion.txt @@ -0,0 +1,2 @@ +m_EditorVersion: 5.1.2f1 +m_StandardAssetsVersion: 0 diff --git a/ProjectSettings/QualitySettings.asset b/ProjectSettings/QualitySettings.asset new file mode 100644 index 0000000..3d47582 Binary files /dev/null and b/ProjectSettings/QualitySettings.asset differ diff --git a/ProjectSettings/TagManager.asset b/ProjectSettings/TagManager.asset new file mode 100644 index 0000000..15cf87a Binary files /dev/null and b/ProjectSettings/TagManager.asset differ diff --git a/ProjectSettings/TimeManager.asset b/ProjectSettings/TimeManager.asset new file mode 100644 index 0000000..f09da06 Binary files /dev/null and b/ProjectSettings/TimeManager.asset differ