Added a collider to the tiles, and created a makeshift player controller to test it.

Changed the level generation to be centered.
This commit is contained in:
RosimInc 2016-01-30 13:59:24 -05:00
parent 068de276e1
commit 3e259dfb9c
34 changed files with 478 additions and 34 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 22 KiB

View File

@ -1,6 +1,6 @@
fileFormatVersion: 2
guid: 66dd4c2892ce4c740a86a6aa21f4f4b7
timeCreated: 1454150346
guid: bd4033904c00e7e459e6c2b5b6885440
timeCreated: 1454180206
licenseType: Free
TextureImporter:
fileIDToRecycleName: {}

View File

@ -30,7 +30,7 @@ TextureImporter:
maxTextureSize: 2048
textureSettings:
filterMode: -1
aniso: -1
aniso: 16
mipBias: -1
wrapMode: 1
nPOTScale: 0

View File

@ -30,7 +30,7 @@ TextureImporter:
maxTextureSize: 2048
textureSettings:
filterMode: -1
aniso: -1
aniso: 16
mipBias: -1
wrapMode: 1
nPOTScale: 0

View File

@ -30,7 +30,7 @@ TextureImporter:
maxTextureSize: 2048
textureSettings:
filterMode: -1
aniso: -1
aniso: 16
mipBias: -1
wrapMode: 1
nPOTScale: 0

View File

@ -30,7 +30,7 @@ TextureImporter:
maxTextureSize: 2048
textureSettings:
filterMode: -1
aniso: -1
aniso: 16
mipBias: -1
wrapMode: 1
nPOTScale: 0

View File

@ -30,7 +30,7 @@ TextureImporter:
maxTextureSize: 2048
textureSettings:
filterMode: -1
aniso: -1
aniso: 16
mipBias: -1
wrapMode: 1
nPOTScale: 0

View File

@ -30,7 +30,7 @@ TextureImporter:
maxTextureSize: 2048
textureSettings:
filterMode: -1
aniso: -1
aniso: 16
mipBias: -1
wrapMode: 1
nPOTScale: 0

View File

@ -30,7 +30,7 @@ TextureImporter:
maxTextureSize: 2048
textureSettings:
filterMode: -1
aniso: -1
aniso: 16
mipBias: -1
wrapMode: 1
nPOTScale: 0

View File

@ -30,7 +30,7 @@ TextureImporter:
maxTextureSize: 2048
textureSettings:
filterMode: -1
aniso: -1
aniso: 16
mipBias: -1
wrapMode: 1
nPOTScale: 0

View File

@ -30,7 +30,7 @@ TextureImporter:
maxTextureSize: 2048
textureSettings:
filterMode: -1
aniso: -1
aniso: 16
mipBias: -1
wrapMode: 1
nPOTScale: 0

View File

@ -30,7 +30,7 @@ TextureImporter:
maxTextureSize: 2048
textureSettings:
filterMode: -1
aniso: -1
aniso: 16
mipBias: -1
wrapMode: 1
nPOTScale: 0

View File

@ -30,7 +30,7 @@ TextureImporter:
maxTextureSize: 2048
textureSettings:
filterMode: -1
aniso: -1
aniso: 16
mipBias: -1
wrapMode: 1
nPOTScale: 0

View File

@ -30,7 +30,7 @@ TextureImporter:
maxTextureSize: 2048
textureSettings:
filterMode: -1
aniso: -1
aniso: 16
mipBias: -1
wrapMode: 1
nPOTScale: 0

View File

@ -30,7 +30,7 @@ TextureImporter:
maxTextureSize: 2048
textureSettings:
filterMode: -1
aniso: -1
aniso: 16
mipBias: -1
wrapMode: 1
nPOTScale: 0

View File

@ -30,7 +30,7 @@ TextureImporter:
maxTextureSize: 2048
textureSettings:
filterMode: -1
aniso: -1
aniso: 16
mipBias: -1
wrapMode: 1
nPOTScale: 0

View File

@ -30,7 +30,7 @@ TextureImporter:
maxTextureSize: 2048
textureSettings:
filterMode: -1
aniso: -1
aniso: 16
mipBias: -1
wrapMode: 1
nPOTScale: 0

View File

@ -30,7 +30,7 @@ TextureImporter:
maxTextureSize: 2048
textureSettings:
filterMode: -1
aniso: -1
aniso: 16
mipBias: -1
wrapMode: 1
nPOTScale: 0

View File

@ -30,7 +30,7 @@ TextureImporter:
maxTextureSize: 2048
textureSettings:
filterMode: -1
aniso: -1
aniso: 16
mipBias: -1
wrapMode: 1
nPOTScale: 0

View File

@ -30,7 +30,7 @@ TextureImporter:
maxTextureSize: 2048
textureSettings:
filterMode: -1
aniso: -1
aniso: 16
mipBias: -1
wrapMode: 1
nPOTScale: 0

View File

@ -30,7 +30,7 @@ TextureImporter:
maxTextureSize: 2048
textureSettings:
filterMode: -1
aniso: -1
aniso: 16
mipBias: -1
wrapMode: 1
nPOTScale: 0

View File

@ -30,7 +30,7 @@ TextureImporter:
maxTextureSize: 2048
textureSettings:
filterMode: -1
aniso: -1
aniso: 16
mipBias: -1
wrapMode: 1
nPOTScale: 0

View File

@ -30,7 +30,7 @@ TextureImporter:
maxTextureSize: 2048
textureSettings:
filterMode: -1
aniso: -1
aniso: 16
mipBias: -1
wrapMode: 1
nPOTScale: 0

View File

@ -30,7 +30,7 @@ TextureImporter:
maxTextureSize: 2048
textureSettings:
filterMode: -1
aniso: -1
aniso: 16
mipBias: -1
wrapMode: 1
nPOTScale: 0

View File

@ -30,7 +30,7 @@ TextureImporter:
maxTextureSize: 2048
textureSettings:
filterMode: -1
aniso: -1
aniso: 16
mipBias: -1
wrapMode: 1
nPOTScale: 0

View File

@ -30,7 +30,7 @@ TextureImporter:
maxTextureSize: 2048
textureSettings:
filterMode: -1
aniso: -1
aniso: 16
mipBias: -1
wrapMode: 1
nPOTScale: 0

View File

@ -30,7 +30,7 @@ TextureImporter:
maxTextureSize: 2048
textureSettings:
filterMode: -1
aniso: -1
aniso: 16
mipBias: -1
wrapMode: 1
nPOTScale: 0

View File

@ -10,6 +10,7 @@ GameObject:
- 4: {fileID: 401170}
- 212: {fileID: 21265262}
- 114: {fileID: 11401426}
- 135: {fileID: 13500080}
m_Layer: 0
m_Name: HexSprite
m_TagString: Untagged
@ -70,6 +71,19 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
symbol: {fileID: 21241768}
letterNum: 0
--- !u!135 &13500080
SphereCollider:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 118646}
m_Material: {fileID: 0}
m_IsTrigger: 1
m_Enabled: 1
serializedVersion: 2
m_Radius: .319999993
m_Center: {x: 0, y: 0, z: 0}
--- !u!212 &21241768
SpriteRenderer:
m_ObjectHideFlags: 1

View File

@ -0,0 +1,371 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!29 &1
SceneSettings:
m_ObjectHideFlags: 0
m_PVSData:
m_PVSObjectsArray: []
m_PVSPortalsArray: []
m_OcclusionBakeSettings:
smallestOccluder: 5
smallestHole: .25
backfaceThreshold: 100
--- !u!104 &2
RenderSettings:
m_ObjectHideFlags: 0
serializedVersion: 6
m_Fog: 0
m_FogColor: {r: .5, g: .5, b: .5, a: 1}
m_FogMode: 3
m_FogDensity: .00999999978
m_LinearFogStart: 0
m_LinearFogEnd: 300
m_AmbientSkyColor: {r: .211999997, g: .226999998, b: .259000003, a: 1}
m_AmbientEquatorColor: {r: .114, g: .125, b: .133000001, a: 1}
m_AmbientGroundColor: {r: .0469999984, g: .0430000015, b: .0350000001, a: 1}
m_AmbientIntensity: 1
m_AmbientMode: 3
m_SkyboxMaterial: {fileID: 0}
m_HaloStrength: .5
m_FlareStrength: 1
m_FlareFadeSpeed: 3
m_HaloTexture: {fileID: 0}
m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0}
m_DefaultReflectionMode: 0
m_DefaultReflectionResolution: 128
m_ReflectionBounces: 1
m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 0}
--- !u!157 &3
LightmapSettings:
m_ObjectHideFlags: 0
serializedVersion: 5
m_GIWorkflowMode: 1
m_LightmapsMode: 1
m_GISettings:
serializedVersion: 2
m_BounceScale: 1
m_IndirectOutputScale: 1
m_AlbedoBoost: 1
m_TemporalCoherenceThreshold: 1
m_EnvironmentLightingMode: 0
m_EnableBakedLightmaps: 0
m_EnableRealtimeLightmaps: 0
m_LightmapEditorSettings:
serializedVersion: 3
m_Resolution: 2
m_BakeResolution: 40
m_TextureWidth: 1024
m_TextureHeight: 1024
m_AOMaxDistance: 1
m_Padding: 2
m_CompAOExponent: 0
m_LightmapParameters: {fileID: 0}
m_TextureCompression: 1
m_FinalGather: 0
m_FinalGatherRayCount: 1024
m_ReflectionCompression: 2
m_LightmapSnapshot: {fileID: 0}
m_RuntimeCPUUsage: 25
--- !u!196 &4
NavMeshSettings:
serializedVersion: 2
m_ObjectHideFlags: 0
m_BuildSettings:
serializedVersion: 2
agentRadius: .5
agentHeight: 2
agentSlope: 45
agentClimb: .400000006
ledgeDropHeight: 0
maxJumpAcrossDistance: 0
accuratePlacement: 0
minRegionArea: 2
cellSize: .166666672
manualCellSize: 0
m_NavMeshData: {fileID: 0}
--- !u!1 &132542564
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 4
m_Component:
- 4: {fileID: 132542565}
- 33: {fileID: 132542568}
- 136: {fileID: 132542567}
- 23: {fileID: 132542566}
- 114: {fileID: 132542569}
- 54: {fileID: 132542570}
m_Layer: 0
m_Name: Capsule
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &132542565
Transform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 132542564}
m_LocalRotation: {x: .707106829, y: 0, z: 0, w: .707106709}
m_LocalPosition: {x: 0, y: 0, z: -.5}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 1624102091}
m_RootOrder: 0
--- !u!23 &132542566
MeshRenderer:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 132542564}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_Materials:
- {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0}
m_SubsetIndices:
m_StaticBatchRoot: {fileID: 0}
m_UseLightProbes: 1
m_ReflectionProbeUsage: 1
m_ProbeAnchor: {fileID: 0}
m_ScaleInLightmap: 1
m_PreserveUVs: 1
m_ImportantGI: 0
m_AutoUVMaxDistance: .5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingOrder: 0
--- !u!136 &132542567
CapsuleCollider:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 132542564}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
m_Radius: .5
m_Height: 2
m_Direction: 1
m_Center: {x: 0, y: 0, z: 0}
--- !u!33 &132542568
MeshFilter:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 132542564}
m_Mesh: {fileID: 10208, guid: 0000000000000000e000000000000000, type: 0}
--- !u!114 &132542569
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 132542564}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: b33743cc22e241142886a7758ce5dc74, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!54 &132542570
Rigidbody:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 132542564}
serializedVersion: 2
m_Mass: 1
m_Drag: 0
m_AngularDrag: .0500000007
m_UseGravity: 0
m_IsKinematic: 0
m_Interpolate: 0
m_Constraints: 0
m_CollisionDetection: 0
--- !u!1 &478275693
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 4
m_Component:
- 4: {fileID: 478275698}
- 20: {fileID: 478275697}
- 92: {fileID: 478275696}
- 124: {fileID: 478275695}
- 81: {fileID: 478275694}
m_Layer: 0
m_Name: Main Camera
m_TagString: MainCamera
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!81 &478275694
AudioListener:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 478275693}
m_Enabled: 1
--- !u!124 &478275695
Behaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 478275693}
m_Enabled: 1
--- !u!92 &478275696
Behaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 478275693}
m_Enabled: 1
--- !u!20 &478275697
Camera:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 478275693}
m_Enabled: 1
serializedVersion: 2
m_ClearFlags: 1
m_BackGroundColor: {r: .192156866, g: .301960796, b: .474509805, a: .0196078438}
m_NormalizedViewPortRect:
serializedVersion: 2
x: 0
y: 0
width: 1
height: 1
near clip plane: .300000012
far clip plane: 1000
field of view: 60
orthographic: 1
orthographic size: 5
m_Depth: -1
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_RenderingPath: -1
m_TargetTexture: {fileID: 0}
m_TargetDisplay: 0
m_TargetEye: 3
m_HDR: 0
m_OcclusionCulling: 1
m_StereoConvergence: 10
m_StereoSeparation: .0219999999
m_StereoMirrorMode: 0
--- !u!4 &478275698
Transform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 478275693}
m_LocalRotation: {x: .707106829, y: 0, z: 0, w: .707106709}
m_LocalPosition: {x: 0, y: 10, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
--- !u!1 &1624102089
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 4
m_Component:
- 4: {fileID: 1624102091}
- 114: {fileID: 1624102090}
m_Layer: 0
m_Name: Level
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &1624102090
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1624102089}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: cc18b8c2e3daedc418978ae09dd589d6, type: 3}
m_Name:
m_EditorClassIdentifier:
numRows: 9
numColumns: 4
xScale: 1
yScale: 1
dimension: .680000007
hexagon: {fileID: 118646, guid: 950731e814d3ade4c91c128681c35ce2, type: 2}
--- !u!4 &1624102091
Transform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1624102089}
m_LocalRotation: {x: .707106829, y: 0, z: 0, w: .707106709}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 132542565}
m_Father: {fileID: 0}
m_RootOrder: 1
--- !u!1001 &1944944027
Prefab:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 401170, guid: 950731e814d3ade4c91c128681c35ce2, type: 2}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 401170, guid: 950731e814d3ade4c91c128681c35ce2, type: 2}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 401170, guid: 950731e814d3ade4c91c128681c35ce2, type: 2}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 401170, guid: 950731e814d3ade4c91c128681c35ce2, type: 2}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 401170, guid: 950731e814d3ade4c91c128681c35ce2, type: 2}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 401170, guid: 950731e814d3ade4c91c128681c35ce2, type: 2}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 401170, guid: 950731e814d3ade4c91c128681c35ce2, type: 2}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 401170, guid: 950731e814d3ade4c91c128681c35ce2, type: 2}
propertyPath: m_RootOrder
value: 2
objectReference: {fileID: 0}
- target: {fileID: 118646, guid: 950731e814d3ade4c91c128681c35ce2, type: 2}
propertyPath: m_Name
value: RuneTile
objectReference: {fileID: 0}
- target: {fileID: 118646, guid: 950731e814d3ade4c91c128681c35ce2, type: 2}
propertyPath: m_IsActive
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_ParentPrefab: {fileID: 100100000, guid: 950731e814d3ade4c91c128681c35ce2, type: 2}
m_IsPrefabParent: 0

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: a9c3ca496461d394ab2950948321a11d
timeCreated: 1454171695
licenseType: Free
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -29,17 +29,23 @@ public class HexSpawner : MonoBehaviour {
GameObject hex;
RuneBehaviour rune;
int index = 0;
float xOffset = numColumns * 1.5f * dimension / 2f;
float yOffset = numRows * 1f * ratio * dimension / 2f;
for (int row = 0; row < numRows; row++)
{
for (int col = 0; col < numColumns; col++)
{
hex = GameObject.Instantiate(hexagon, transform.position +
new Vector3(
(3f*dimension*col + 1.5f*dimension * (row%2)) * xScale,
(row * ratio * dimension) * yScale, 0f),
Quaternion.identity) as GameObject;
hex.transform.localScale = new Vector3(xScale, yScale, 1f);
hex = GameObject.Instantiate(hexagon) as GameObject;
hex.transform.parent = transform;
hex.transform.localScale = new Vector3(xScale, yScale, 1f);
hex.transform.localPosition = new Vector3(
(3f * dimension * col + 1.5f * dimension * (row % 2)) * xScale - xOffset,
(row * ratio * dimension) * yScale - yOffset, 0f);
hex.transform.localRotation = Quaternion.identity;
rune = hex.GetComponent<RuneBehaviour>();
rune.SetSymbol(randomNums[index++]);

View File

@ -0,0 +1,33 @@
using UnityEngine;
using System.Collections;
public class PlayerControllerSR : MonoBehaviour {
private Rigidbody rb;
// Use this for initialization
void Start () {
rb = GetComponent<Rigidbody>();
}
// Update is called once per frame
void Update () {
}
void FixedUpdate()
{
if (Input.GetKey(KeyCode.A))
rb.AddForce(-transform.right * 5);
if (Input.GetKey(KeyCode.D))
rb.AddForce(transform.right * 5);
if (Input.GetKey(KeyCode.S))
rb.AddForce(transform.forward * 5);
if (Input.GetKey(KeyCode.W))
rb.AddForce(-transform.forward * 5);
}
void OnTriggerEnter(Collider col)
{
Debug.Log(col.gameObject.GetComponent<RuneBehaviour>().letterNum);
}
}

View File

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

View File

@ -5,7 +5,7 @@ public class RuneBehaviour : MonoBehaviour {
public static float range;
public SpriteRenderer symbol;
private int letterNum;
public int letterNum;
// Use this for initialization
void Start () {