Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Class catchup
  • Loading branch information
smz11006 committed Dec 2, 2015
1 parent 7c2f95c commit d893669
Show file tree
Hide file tree
Showing 30 changed files with 57 additions and 366 deletions.
6 changes: 6 additions & 0 deletions Roguelike/Assembly-CSharp-Editor.csproj
Expand Up @@ -48,6 +48,9 @@
<Compile Include="Assets\iTweenEditor\Editor\iTweenEventDataEditor.cs" /> <Compile Include="Assets\iTweenEditor\Editor\iTweenEventDataEditor.cs" />
<Compile Include="Assets\iTweenEditor\Editor\iTweenPathEditor.cs" /> <Compile Include="Assets\iTweenEditor\Editor\iTweenPathEditor.cs" />
<None Include="Assets\iTweenEditor\README.txt" /> <None Include="Assets\iTweenEditor\README.txt" />
<Reference Include="UnityEngine.Advertisements">
<HintPath>C:/Program Files/Unity/Editor/Data/UnityExtensions/Unity/Advertisements/UnityEngine.Advertisements.dll</HintPath>
</Reference>
<Reference Include="UnityEditor.Advertisements"> <Reference Include="UnityEditor.Advertisements">
<HintPath>C:/Program Files/Unity/Editor/Data/UnityExtensions/Unity/Advertisements/Editor/UnityEditor.Advertisements.dll</HintPath> <HintPath>C:/Program Files/Unity/Editor/Data/UnityExtensions/Unity/Advertisements/Editor/UnityEditor.Advertisements.dll</HintPath>
</Reference> </Reference>
Expand All @@ -63,6 +66,9 @@
<Reference Include="UnityEditor.Networking"> <Reference Include="UnityEditor.Networking">
<HintPath>C:/Program Files/Unity/Editor/Data/UnityExtensions/Unity/Networking/Editor/UnityEditor.Networking.dll</HintPath> <HintPath>C:/Program Files/Unity/Editor/Data/UnityExtensions/Unity/Networking/Editor/UnityEditor.Networking.dll</HintPath>
</Reference> </Reference>
<Reference Include="UnityEngine.Analytics">
<HintPath>C:/Program Files/Unity/Editor/Data/UnityExtensions/Unity/UnityAnalytics/UnityEngine.Analytics.dll</HintPath>
</Reference>
<Reference Include="UnityEditor.Graphs"> <Reference Include="UnityEditor.Graphs">
<HintPath>C:/Program Files/Unity/Editor/Data/Managed/UnityEditor.Graphs.dll</HintPath> <HintPath>C:/Program Files/Unity/Editor/Data/Managed/UnityEditor.Graphs.dll</HintPath>
</Reference> </Reference>
Expand Down
6 changes: 6 additions & 0 deletions Roguelike/Assembly-CSharp.csproj
Expand Up @@ -59,12 +59,18 @@
<Compile Include="Assets\iTweenEditor\iTweenEvent.cs" /> <Compile Include="Assets\iTweenEditor\iTweenEvent.cs" />
<Compile Include="Assets\iTweenEditor\iTweenPath.cs" /> <Compile Include="Assets\iTweenEditor\iTweenPath.cs" />
<None Include="Assets\iTweenEditor\README.txt" /> <None Include="Assets\iTweenEditor\README.txt" />
<Reference Include="UnityEngine.Advertisements">
<HintPath>C:/Program Files/Unity/Editor/Data/UnityExtensions/Unity/Advertisements/UnityEngine.Advertisements.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.UI"> <Reference Include="UnityEngine.UI">
<HintPath>C:/Program Files/Unity/Editor/Data/UnityExtensions/Unity/GUISystem/UnityEngine.UI.dll</HintPath> <HintPath>C:/Program Files/Unity/Editor/Data/UnityExtensions/Unity/GUISystem/UnityEngine.UI.dll</HintPath>
</Reference> </Reference>
<Reference Include="UnityEngine.Networking"> <Reference Include="UnityEngine.Networking">
<HintPath>C:/Program Files/Unity/Editor/Data/UnityExtensions/Unity/Networking/UnityEngine.Networking.dll</HintPath> <HintPath>C:/Program Files/Unity/Editor/Data/UnityExtensions/Unity/Networking/UnityEngine.Networking.dll</HintPath>
</Reference> </Reference>
<Reference Include="UnityEngine.Analytics">
<HintPath>C:/Program Files/Unity/Editor/Data/UnityExtensions/Unity/UnityAnalytics/UnityEngine.Analytics.dll</HintPath>
</Reference>
<Reference Include="Mono.Cecil"> <Reference Include="Mono.Cecil">
<HintPath>C:/Program Files/Unity/Editor/Data/Managed/Mono.Cecil.dll</HintPath> <HintPath>C:/Program Files/Unity/Editor/Data/Managed/Mono.Cecil.dll</HintPath>
</Reference> </Reference>
Expand Down
65 changes: 42 additions & 23 deletions Roguelike/Assets/Scripts/ProdGen/BoardManager.cs
@@ -1,75 +1,93 @@
using UnityEngine; using UnityEngine;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic; //Allows us to use lists
using Random = UnityEngine.Random; using Random = UnityEngine.Random; // Tells Random to use Untiy Engine Random number generator
//++Add in Comments++ //++Add in Comments++
namespace Completed namespace Completed
{ {


public class BoardManager : MonoBehaviour { public class BoardManager : MonoBehaviour {
//Using serializable allows us to embed a class wit hsub properties in sinpsector
[Serializable] [Serializable]
public class Count public class Count
{ {
public int minimum; public int minimum; //Minimum value for our count class
public int maximum; public int maximum; //Maximum value for our count class


//assignment constructor
public Count(int min, int max) public Count(int min, int max)
{ {
minimum = min; minimum = min;
maximum = max; maximum = max;
} }
} }


//-------------------------------------------------- //Declarations--------------------------------------------------
public int columns = 8; public int columns = 8; //Number of columns in our game baord
public int rows = 8; public int rows = 8; //Number of Rows in our game board
public Count wallCount = new Count(5, 9); public Count wallCount = new Count(5, 9); //Lower and upper limit for our random number
public Count foodCount = new Count(1, 5); public Count foodCount = new Count(1, 5); //Lowra nd uper limit for our random food count
public GameObject exit; public GameObject exit; //Prefab to spawn for exit
public GameObject[] floorTiles; //Arrays
public GameObject[] wallTiles; public GameObject[] floorTiles; //Array of floor prefabs
public GameObject[] foodTiles; public GameObject[] wallTiles; //Array of wall prefabs
public GameObject[] enemyTiles; public GameObject[] foodTiles; //Array of food prefabs
public GameObject[] outerWallTiles; public GameObject[] enemyTiles; //Array of enemy prefabs

public GameObject[] outerWallTiles; //Array of ourter tile prefabs
private Transform boardHolder;
private List<Vector3> gridPositions = new List<Vector3>(); private Transform boardHolder; //A variable to store references to the transform of something

private List<Vector3> gridPositions = new List<Vector3>(); //A list of possible locations to place tiles


//Clears our list gridPositions and prepares it to generate a new board.
void InitialiseList() void InitialiseList()
{ {
//clear our list gridPositions
gridPositions.Clear(); gridPositions.Clear();


for(int x=1; x< columns - 1; x++) //Loot through x axis (columns)
for (int x=1; x< columns - 1; x++)
{ {
//Do this thing while x>columns - 1 //within each column, loop through the y axis (rows)

for (int y = 1; y < rows -1; y++) for (int y = 1; y < rows -1; y++)
{ {
//At each index add a new vector3 to our lists with the x and y coordinates of that position
gridPositions.Add(new Vector3(x, y, 0f)); gridPositions.Add(new Vector3(x, y, 0f));
} }
} }
} }

//Sets up the outer walls and flolors of the game
void BoardSetup() void BoardSetup()
{ {
//instanciates baords and sets iup boardholder to its transform
boardHolder = new GameObject("Board").transform; boardHolder = new GameObject("Board").transform;


//loop along the x axis, starting from - 1 (to fill corner) with floor and outerwall edge tiles
for(int x = -1; x<columns + 1; x++) for(int x = -1; x<columns + 1; x++)
{ {
//Loop along y axis, starting fomr -1 to place floor or outerwall tiles
for(int y = -1; y < rows + 1; y++) for(int y = -1; y < rows + 1; y++)
{ {
//choose a random tile from our array for the floor tile prefabs and prepare to instanciete
GameObject toInstanciate = floorTiles[Random.Range(0, floorTiles.Length)]; GameObject toInstanciate = floorTiles[Random.Range(0, floorTiles.Length)];
//Detect Edges //check if we current position is at board edge, if so choose a random outerwall prefab
if (x == -1 ||x == columns|| y == -1 || y == rows) if (x == -1 ||x == columns|| y == -1 || y == rows)
{ {
toInstanciate = outerWallTiles[Random.Range(0, outerWallTiles.Length)]; toInstanciate = outerWallTiles[Random.Range(0, outerWallTiles.Length)];
} }


//Instanciate Gameobject instance using prefabt chosen for toInstanciate
GameObject instance = Instantiate(toInstanciate, new Vector3(x, y, 0f), Quaternion.identity) as GameObject; GameObject instance = Instantiate(toInstanciate, new Vector3(x, y, 0f), Quaternion.identity) as GameObject;

//Set the paretn of our newly isntanciated object isnatne to boardHolder
instance.transform.SetParent(boardHolder); instance.transform.SetParent(boardHolder);
} }
} }
} }


//Making random positions to spawn board pieces
//RanndomPosition returns a random position from our gridpositions
Vector3 RandomPosition() Vector3 RandomPosition()
{ {
int randomIndex = Random.Range(0, gridPositions.Count); int randomIndex = Random.Range(0, gridPositions.Count);
Expand All @@ -81,6 +99,7 @@ public class BoardManager : MonoBehaviour {
return randomPosition; return randomPosition;
} }


//
void LayoutObjectAtRandom(GameObject[] tileArray, int minimum, int maximum) void LayoutObjectAtRandom(GameObject[] tileArray, int minimum, int maximum)
{ {
int objectCount = Random.Range(minimum, maximum + 1); int objectCount = Random.Range(minimum, maximum + 1);
Expand Down
Binary file modified Roguelike/Library/CurrentLayout.dwlt
Binary file not shown.
Binary file modified Roguelike/Library/ProjectSettings.asset
Binary file not shown.
Binary file not shown.
Binary file modified Roguelike/Library/ScriptAssemblies/Assembly-CSharp.dll.mdb
Binary file not shown.
2 changes: 2 additions & 0 deletions Roguelike/Library/ScriptAssemblies/BuiltinAssemblies.stamp
@@ -0,0 +1,2 @@
0000.56264290.0000
0000.562642ae.0000
Binary file modified Roguelike/Library/assetDatabase3
Binary file not shown.
Binary file modified Roguelike/Library/metadata/00/00000000000000004000000000000000
Binary file not shown.
Binary file modified Roguelike/Library/metadata/d1/d10aa5ca016ed594dbaf0d44a8063a91
Binary file not shown.
Binary file modified Roguelike/ProjectSettings/ProjectSettings.asset
Binary file not shown.
2 changes: 1 addition & 1 deletion Roguelike/Roguelike.sln
Expand Up @@ -23,7 +23,7 @@ Global
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
EndGlobalSection EndGlobalSection
GlobalSection(MonoDevelopProperties) = preSolution GlobalSection(MonoDevelopProperties) = preSolution
StartupItem = Assembly-CSharp.csproj StartupItem = Assembly-CSharp.csproj
Policies = $0 Policies = $0
$0.TextStylePolicy = $1 $0.TextStylePolicy = $1
Expand Down
Binary file removed Tesselate Skbox/Assets/Scenes/SkyboxTest.unity
Binary file not shown.
9 changes: 0 additions & 9 deletions Tesselate Skbox/Assets/Skyboxes/PurpleNebula.meta

This file was deleted.

Binary file not shown.

This file was deleted.

9 changes: 0 additions & 9 deletions Tesselate Skbox/Assets/Skyboxes/PurpleNebula/Textures.meta

This file was deleted.

Binary file not shown.

This file was deleted.

Binary file not shown.

This file was deleted.

Binary file not shown.

This file was deleted.

Binary file not shown.

0 comments on commit d893669

Please sign in to comment.