Merge branch 'main' of https://git.steelants.cz/GJP/GGJ2022
This commit is contained in:
commit
0438bfe7c6
@ -123,6 +123,11 @@ NavMeshSettings:
|
|||||||
debug:
|
debug:
|
||||||
m_Flags: 0
|
m_Flags: 0
|
||||||
m_NavMeshData: {fileID: 0}
|
m_NavMeshData: {fileID: 0}
|
||||||
|
--- !u!1 &250075900 stripped
|
||||||
|
GameObject:
|
||||||
|
m_CorrespondingSourceObject: {fileID: 3244356566819001084, guid: ec622cf6f0988bc42a99ba84304c15a9, type: 3}
|
||||||
|
m_PrefabInstance: {fileID: 1287430439}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
--- !u!1 &327689120
|
--- !u!1 &327689120
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@ -154,7 +159,7 @@ Transform:
|
|||||||
m_Children:
|
m_Children:
|
||||||
- {fileID: 708734976}
|
- {fileID: 708734976}
|
||||||
m_Father: {fileID: 0}
|
m_Father: {fileID: 0}
|
||||||
m_RootOrder: 0
|
m_RootOrder: 1
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
--- !u!114 &327689122
|
--- !u!114 &327689122
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
@ -173,7 +178,7 @@ MonoBehaviour:
|
|||||||
- {fileID: 8768991388683709947, guid: 99c4e582c7358f346ab00dae4ae956f9, type: 3}
|
- {fileID: 8768991388683709947, guid: 99c4e582c7358f346ab00dae4ae956f9, type: 3}
|
||||||
- {fileID: 6650340373999088090, guid: 76b3e3235b07ca04f91c9b020603e1dd, type: 3}
|
- {fileID: 6650340373999088090, guid: 76b3e3235b07ca04f91c9b020603e1dd, type: 3}
|
||||||
spawnedLevelBlocks: []
|
spawnedLevelBlocks: []
|
||||||
player: {fileID: 1621231496}
|
player: {fileID: 250075900}
|
||||||
lastBlock: {fileID: 708734972}
|
lastBlock: {fileID: 708734972}
|
||||||
--- !u!1 &705507993
|
--- !u!1 &705507993
|
||||||
GameObject:
|
GameObject:
|
||||||
@ -366,11 +371,63 @@ Transform:
|
|||||||
m_Father: {fileID: 327689121}
|
m_Father: {fileID: 327689121}
|
||||||
m_RootOrder: 0
|
m_RootOrder: 0
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
--- !u!1 &1621231496 stripped
|
--- !u!1001 &1287430439
|
||||||
GameObject:
|
PrefabInstance:
|
||||||
m_CorrespondingSourceObject: {fileID: 3244356566819001084, guid: ec622cf6f0988bc42a99ba84304c15a9, type: 3}
|
m_ObjectHideFlags: 0
|
||||||
m_PrefabInstance: {fileID: 1953646381}
|
serializedVersion: 2
|
||||||
m_PrefabAsset: {fileID: 0}
|
m_Modification:
|
||||||
|
m_TransformParent: {fileID: 0}
|
||||||
|
m_Modifications:
|
||||||
|
- target: {fileID: 3244356567786994344, guid: ec622cf6f0988bc42a99ba84304c15a9, type: 3}
|
||||||
|
propertyPath: m_Name
|
||||||
|
value: Player
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 3244356567786994345, guid: ec622cf6f0988bc42a99ba84304c15a9, type: 3}
|
||||||
|
propertyPath: m_RootOrder
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 3244356567786994345, guid: ec622cf6f0988bc42a99ba84304c15a9, type: 3}
|
||||||
|
propertyPath: m_LocalPosition.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 3244356567786994345, guid: ec622cf6f0988bc42a99ba84304c15a9, type: 3}
|
||||||
|
propertyPath: m_LocalPosition.y
|
||||||
|
value: 1.95
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 3244356567786994345, guid: ec622cf6f0988bc42a99ba84304c15a9, type: 3}
|
||||||
|
propertyPath: m_LocalPosition.z
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 3244356567786994345, guid: ec622cf6f0988bc42a99ba84304c15a9, type: 3}
|
||||||
|
propertyPath: m_LocalRotation.w
|
||||||
|
value: 1
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 3244356567786994345, guid: ec622cf6f0988bc42a99ba84304c15a9, type: 3}
|
||||||
|
propertyPath: m_LocalRotation.x
|
||||||
|
value: -0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 3244356567786994345, guid: ec622cf6f0988bc42a99ba84304c15a9, type: 3}
|
||||||
|
propertyPath: m_LocalRotation.y
|
||||||
|
value: -0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 3244356567786994345, guid: ec622cf6f0988bc42a99ba84304c15a9, type: 3}
|
||||||
|
propertyPath: m_LocalRotation.z
|
||||||
|
value: -0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 3244356567786994345, guid: ec622cf6f0988bc42a99ba84304c15a9, type: 3}
|
||||||
|
propertyPath: m_LocalEulerAnglesHint.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 3244356567786994345, guid: ec622cf6f0988bc42a99ba84304c15a9, type: 3}
|
||||||
|
propertyPath: m_LocalEulerAnglesHint.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 3244356567786994345, guid: ec622cf6f0988bc42a99ba84304c15a9, type: 3}
|
||||||
|
propertyPath: m_LocalEulerAnglesHint.z
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
m_RemovedComponents: []
|
||||||
|
m_SourcePrefab: {fileID: 100100000, guid: ec622cf6f0988bc42a99ba84304c15a9, type: 3}
|
||||||
--- !u!1 &1802677907
|
--- !u!1 &1802677907
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@ -420,64 +477,3 @@ Transform:
|
|||||||
m_Father: {fileID: 0}
|
m_Father: {fileID: 0}
|
||||||
m_RootOrder: 2
|
m_RootOrder: 2
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
--- !u!1001 &1953646381
|
|
||||||
PrefabInstance:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
serializedVersion: 2
|
|
||||||
m_Modification:
|
|
||||||
m_TransformParent: {fileID: 0}
|
|
||||||
m_Modifications:
|
|
||||||
- target: {fileID: 3244356566819001085, guid: ec622cf6f0988bc42a99ba84304c15a9, type: 3}
|
|
||||||
propertyPath: m_LocalPosition.z
|
|
||||||
value: 0.7
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: 3244356567786994344, guid: ec622cf6f0988bc42a99ba84304c15a9, type: 3}
|
|
||||||
propertyPath: m_Name
|
|
||||||
value: Player
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: 3244356567786994345, guid: ec622cf6f0988bc42a99ba84304c15a9, type: 3}
|
|
||||||
propertyPath: m_RootOrder
|
|
||||||
value: 1
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: 3244356567786994345, guid: ec622cf6f0988bc42a99ba84304c15a9, type: 3}
|
|
||||||
propertyPath: m_LocalPosition.x
|
|
||||||
value: 1
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: 3244356567786994345, guid: ec622cf6f0988bc42a99ba84304c15a9, type: 3}
|
|
||||||
propertyPath: m_LocalPosition.y
|
|
||||||
value: 0
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: 3244356567786994345, guid: ec622cf6f0988bc42a99ba84304c15a9, type: 3}
|
|
||||||
propertyPath: m_LocalPosition.z
|
|
||||||
value: 0
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: 3244356567786994345, guid: ec622cf6f0988bc42a99ba84304c15a9, type: 3}
|
|
||||||
propertyPath: m_LocalRotation.w
|
|
||||||
value: 1
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: 3244356567786994345, guid: ec622cf6f0988bc42a99ba84304c15a9, type: 3}
|
|
||||||
propertyPath: m_LocalRotation.x
|
|
||||||
value: 0
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: 3244356567786994345, guid: ec622cf6f0988bc42a99ba84304c15a9, type: 3}
|
|
||||||
propertyPath: m_LocalRotation.y
|
|
||||||
value: 0
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: 3244356567786994345, guid: ec622cf6f0988bc42a99ba84304c15a9, type: 3}
|
|
||||||
propertyPath: m_LocalRotation.z
|
|
||||||
value: 0
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: 3244356567786994345, guid: ec622cf6f0988bc42a99ba84304c15a9, type: 3}
|
|
||||||
propertyPath: m_LocalEulerAnglesHint.x
|
|
||||||
value: 0
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: 3244356567786994345, guid: ec622cf6f0988bc42a99ba84304c15a9, type: 3}
|
|
||||||
propertyPath: m_LocalEulerAnglesHint.y
|
|
||||||
value: 0
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: 3244356567786994345, guid: ec622cf6f0988bc42a99ba84304c15a9, type: 3}
|
|
||||||
propertyPath: m_LocalEulerAnglesHint.z
|
|
||||||
value: 0
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
m_RemovedComponents: []
|
|
||||||
m_SourcePrefab: {fileID: 100100000, guid: ec622cf6f0988bc42a99ba84304c15a9, type: 3}
|
|
||||||
|
@ -30,7 +30,7 @@ public class ProceduralGeneration : MonoBehaviour
|
|||||||
int pieceCount = 10;
|
int pieceCount = 10;
|
||||||
float radius = (pieceCount / 2) * 2;
|
float radius = (pieceCount / 2) * 2;
|
||||||
float angle = 360f / (float)pieceCount;
|
float angle = 360f / (float)pieceCount;
|
||||||
Vector3 centerPoint = new Vector3(lastObject.transform.position.x, (lastObject.transform.position.y + radius), lastObject.transform.position.z + 2.0f);
|
Vector3 centerPoint = new Vector3(lastObject.transform.position.x, (lastObject.transform.position.y + radius), lastObject.transform.position.z + 3.0f);
|
||||||
|
|
||||||
float heightOffset = radius;
|
float heightOffset = radius;
|
||||||
|
|
||||||
@ -49,28 +49,30 @@ public class ProceduralGeneration : MonoBehaviour
|
|||||||
// Update is called once per frame
|
// Update is called once per frame
|
||||||
void Update()
|
void Update()
|
||||||
{
|
{
|
||||||
int maxNumberOfBlock = 100;
|
int maxNumberOfBlock = 200;
|
||||||
|
|
||||||
Vector3 playerPosition = this.player.transform.position;
|
Vector3 playerPosition = this.player.transform.position;
|
||||||
float distance = Vector3.Distance(this.spawnedLevelBlocks[0].transform.position, playerPosition);
|
|
||||||
|
|
||||||
Debug.Log("Index" + 0);
|
Debug.Log("Index" + 0);
|
||||||
|
|
||||||
if (distance > 10.0f || this.spawnedLevelBlocks.Count >= maxNumberOfBlock + 5)
|
for (var i = 0; i < this.spawnedLevelBlocks.Count; i++)
|
||||||
{
|
{
|
||||||
Destroy(this.spawnedLevelBlocks[0]);
|
float distance = Vector3.Distance(this.spawnedLevelBlocks[i].transform.position, playerPosition);
|
||||||
this.spawnedLevelBlocks.Remove(this.spawnedLevelBlocks[0]);
|
if (distance > 10.0f && this.spawnedLevelBlocks.Count >= maxNumberOfBlock)
|
||||||
|
{
|
||||||
|
Destroy(this.spawnedLevelBlocks[i]);
|
||||||
|
this.spawnedLevelBlocks.Remove(this.spawnedLevelBlocks[i]);
|
||||||
spavnetobjectIndex++;
|
spavnetobjectIndex++;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (this.spawnedLevelBlocks.Count <= maxNumberOfBlock)
|
if (this.spawnedLevelBlocks.Count <= maxNumberOfBlock)
|
||||||
{
|
{
|
||||||
MeshFilter meshfilter = lastBlock.GetComponent<MeshFilter>();
|
|
||||||
Bounds bounds = meshfilter.mesh.bounds;
|
|
||||||
|
|
||||||
float scale = meshfilter.transform.localScale.x;
|
|
||||||
Bounds b = new Bounds(bounds.center * scale, bounds.size * scale);
|
|
||||||
|
|
||||||
int blockToSpawn = Random.Range(0, levelBlocks.Count - 1);
|
int blockToSpawn = Random.Range(0, levelBlocks.Count - 1);
|
||||||
|
|
||||||
GameObject instantiatedGameObject;
|
GameObject instantiatedGameObject;
|
||||||
@ -100,9 +102,17 @@ public class ProceduralGeneration : MonoBehaviour
|
|||||||
|
|
||||||
if ((blockToSpawn > -1 && (blockToSpawn < (levelBlocks.Count - 1))))
|
if ((blockToSpawn > -1 && (blockToSpawn < (levelBlocks.Count - 1))))
|
||||||
{
|
{
|
||||||
|
MeshFilter meshfilter = this.lastBlock.GetComponent<MeshFilter>();
|
||||||
|
Bounds bounds = meshfilter.mesh.bounds;
|
||||||
|
|
||||||
|
float scale = meshfilter.transform.localScale.x;
|
||||||
|
Bounds b = new Bounds(bounds.center * scale, bounds.size * scale);
|
||||||
|
|
||||||
blockObjToSpawn = levelBlocks[blockToSpawn];
|
blockObjToSpawn = levelBlocks[blockToSpawn];
|
||||||
instantiatedGameObject = Instantiate(blockObjToSpawn, new Vector3(lastBlock.transform.position.x, lastBlock.transform.position.y, lastBlock.transform.position.y + (b.size.z + 1.0f)), (Quaternion.identity));
|
Vector3 nextBlockLocation = new Vector3(this.lastBlock.transform.position.x, this.lastBlock.transform.position.y, this.lastBlock.transform.position.z + b.size.z + 1.0f);
|
||||||
|
instantiatedGameObject = Instantiate(blockObjToSpawn, nextBlockLocation, (Quaternion.identity));
|
||||||
this.spawnedLevelBlocks.Add(instantiatedGameObject);
|
this.spawnedLevelBlocks.Add(instantiatedGameObject);
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -116,9 +126,9 @@ public class ProceduralGeneration : MonoBehaviour
|
|||||||
}
|
}
|
||||||
|
|
||||||
Debug.Log("Spawn" + blockToSpawn);
|
Debug.Log("Spawn" + blockToSpawn);
|
||||||
|
this.lastBlock = instantiatedGameObject;
|
||||||
|
this.lastBlockPrefab = blockObjToSpawn;
|
||||||
|
|
||||||
lastBlock = instantiatedGameObject;
|
|
||||||
lastBlockPrefab = blockObjToSpawn;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user