Merge branch 'main' of https://github.com/orsolya-st/gamejam_050626
This commit is contained in:
@@ -127,7 +127,7 @@ BoxCollider2D:
|
|||||||
m_UsedByEffector: 1
|
m_UsedByEffector: 1
|
||||||
m_CompositeOperation: 0
|
m_CompositeOperation: 0
|
||||||
m_CompositeOrder: 0
|
m_CompositeOrder: 0
|
||||||
m_Offset: {x: 0, y: -0.61813337}
|
m_Offset: {x: 0, y: -0.299548}
|
||||||
m_SpriteTilingProperty:
|
m_SpriteTilingProperty:
|
||||||
border: {x: 0, y: 0, z: 0, w: 0}
|
border: {x: 0, y: 0, z: 0, w: 0}
|
||||||
pivot: {x: 0.5, y: 0.5}
|
pivot: {x: 0.5, y: 0.5}
|
||||||
@@ -137,7 +137,7 @@ BoxCollider2D:
|
|||||||
drawMode: 0
|
drawMode: 0
|
||||||
adaptiveTiling: 0
|
adaptiveTiling: 0
|
||||||
m_AutoTiling: 0
|
m_AutoTiling: 0
|
||||||
m_Size: {x: 6.08, y: 1.5346009}
|
m_Size: {x: 6.08, y: 0.8974301}
|
||||||
m_EdgeRadius: 0
|
m_EdgeRadius: 0
|
||||||
--- !u!251 &1230605949537068183
|
--- !u!251 &1230605949537068183
|
||||||
PlatformEffector2D:
|
PlatformEffector2D:
|
||||||
|
|||||||
@@ -127,7 +127,7 @@ BoxCollider2D:
|
|||||||
m_UsedByEffector: 1
|
m_UsedByEffector: 1
|
||||||
m_CompositeOperation: 0
|
m_CompositeOperation: 0
|
||||||
m_CompositeOrder: 0
|
m_CompositeOrder: 0
|
||||||
m_Offset: {x: 0, y: -0.61813337}
|
m_Offset: {x: 0, y: -0.25666255}
|
||||||
m_SpriteTilingProperty:
|
m_SpriteTilingProperty:
|
||||||
border: {x: 0, y: 0, z: 0, w: 0}
|
border: {x: 0, y: 0, z: 0, w: 0}
|
||||||
pivot: {x: 0.5, y: 0.5}
|
pivot: {x: 0.5, y: 0.5}
|
||||||
@@ -137,7 +137,7 @@ BoxCollider2D:
|
|||||||
drawMode: 0
|
drawMode: 0
|
||||||
adaptiveTiling: 0
|
adaptiveTiling: 0
|
||||||
m_AutoTiling: 0
|
m_AutoTiling: 0
|
||||||
m_Size: {x: 6.08, y: 1.5346009}
|
m_Size: {x: 6.08, y: 0.8116592}
|
||||||
m_EdgeRadius: 0
|
m_EdgeRadius: 0
|
||||||
--- !u!251 &1230605949537068183
|
--- !u!251 &1230605949537068183
|
||||||
PlatformEffector2D:
|
PlatformEffector2D:
|
||||||
|
|||||||
@@ -119,6 +119,11 @@ NavMeshSettings:
|
|||||||
debug:
|
debug:
|
||||||
m_Flags: 0
|
m_Flags: 0
|
||||||
m_NavMeshData: {fileID: 0}
|
m_NavMeshData: {fileID: 0}
|
||||||
|
--- !u!4 &33859906 stripped
|
||||||
|
Transform:
|
||||||
|
m_CorrespondingSourceObject: {fileID: 2163867978973577705, guid: 2f44dc6d6adb9ae7f9b4f644da0e3485, type: 3}
|
||||||
|
m_PrefabInstance: {fileID: 1489069184}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
--- !u!1001 &274994935
|
--- !u!1001 &274994935
|
||||||
PrefabInstance:
|
PrefabInstance:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@@ -176,6 +181,63 @@ PrefabInstance:
|
|||||||
m_AddedGameObjects: []
|
m_AddedGameObjects: []
|
||||||
m_AddedComponents: []
|
m_AddedComponents: []
|
||||||
m_SourcePrefab: {fileID: 100100000, guid: 2f44dc6d6adb9ae7f9b4f644da0e3485, type: 3}
|
m_SourcePrefab: {fileID: 100100000, guid: 2f44dc6d6adb9ae7f9b4f644da0e3485, type: 3}
|
||||||
|
--- !u!1001 &488250683
|
||||||
|
PrefabInstance:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Modification:
|
||||||
|
serializedVersion: 3
|
||||||
|
m_TransformParent: {fileID: 0}
|
||||||
|
m_Modifications:
|
||||||
|
- target: {fileID: 3724115605263402928, guid: 5bb8206709807ff4cae9583b3ee3e67d, type: 3}
|
||||||
|
propertyPath: m_Name
|
||||||
|
value: MiniDroplet
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 7100472280186483774, guid: 5bb8206709807ff4cae9583b3ee3e67d, type: 3}
|
||||||
|
propertyPath: m_LocalPosition.x
|
||||||
|
value: 3.3575556
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 7100472280186483774, guid: 5bb8206709807ff4cae9583b3ee3e67d, type: 3}
|
||||||
|
propertyPath: m_LocalPosition.y
|
||||||
|
value: -4.47
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 7100472280186483774, guid: 5bb8206709807ff4cae9583b3ee3e67d, type: 3}
|
||||||
|
propertyPath: m_LocalPosition.z
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 7100472280186483774, guid: 5bb8206709807ff4cae9583b3ee3e67d, type: 3}
|
||||||
|
propertyPath: m_LocalRotation.w
|
||||||
|
value: 1
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 7100472280186483774, guid: 5bb8206709807ff4cae9583b3ee3e67d, type: 3}
|
||||||
|
propertyPath: m_LocalRotation.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 7100472280186483774, guid: 5bb8206709807ff4cae9583b3ee3e67d, type: 3}
|
||||||
|
propertyPath: m_LocalRotation.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 7100472280186483774, guid: 5bb8206709807ff4cae9583b3ee3e67d, type: 3}
|
||||||
|
propertyPath: m_LocalRotation.z
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 7100472280186483774, guid: 5bb8206709807ff4cae9583b3ee3e67d, type: 3}
|
||||||
|
propertyPath: m_LocalEulerAnglesHint.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 7100472280186483774, guid: 5bb8206709807ff4cae9583b3ee3e67d, type: 3}
|
||||||
|
propertyPath: m_LocalEulerAnglesHint.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 7100472280186483774, guid: 5bb8206709807ff4cae9583b3ee3e67d, type: 3}
|
||||||
|
propertyPath: m_LocalEulerAnglesHint.z
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
m_RemovedComponents: []
|
||||||
|
m_RemovedGameObjects: []
|
||||||
|
m_AddedGameObjects: []
|
||||||
|
m_AddedComponents: []
|
||||||
|
m_SourcePrefab: {fileID: 100100000, guid: 5bb8206709807ff4cae9583b3ee3e67d, type: 3}
|
||||||
--- !u!1 &505713147
|
--- !u!1 &505713147
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@@ -370,6 +432,11 @@ Transform:
|
|||||||
m_CorrespondingSourceObject: {fileID: 6566899495513628888, guid: d56297e435f8410a584581d73d99d2e4, type: 3}
|
m_CorrespondingSourceObject: {fileID: 6566899495513628888, guid: d56297e435f8410a584581d73d99d2e4, type: 3}
|
||||||
m_PrefabInstance: {fileID: 1445156949}
|
m_PrefabInstance: {fileID: 1445156949}
|
||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
--- !u!4 &688751894 stripped
|
||||||
|
Transform:
|
||||||
|
m_CorrespondingSourceObject: {fileID: 2163867978973577705, guid: 2f44dc6d6adb9ae7f9b4f644da0e3485, type: 3}
|
||||||
|
m_PrefabInstance: {fileID: 1870986352}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
--- !u!1 &750131489
|
--- !u!1 &750131489
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@@ -493,6 +560,7 @@ MonoBehaviour:
|
|||||||
maxHealth: 1
|
maxHealth: 1
|
||||||
health: 0
|
health: 0
|
||||||
minSize: 0.4
|
minSize: 0.4
|
||||||
|
maxFallingTime: 2
|
||||||
--- !u!1001 &1445156949
|
--- !u!1001 &1445156949
|
||||||
PrefabInstance:
|
PrefabInstance:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@@ -581,6 +649,63 @@ PrefabInstance:
|
|||||||
insertIndex: -1
|
insertIndex: -1
|
||||||
addedObject: {fileID: 1229548147}
|
addedObject: {fileID: 1229548147}
|
||||||
m_SourcePrefab: {fileID: 100100000, guid: d56297e435f8410a584581d73d99d2e4, type: 3}
|
m_SourcePrefab: {fileID: 100100000, guid: d56297e435f8410a584581d73d99d2e4, type: 3}
|
||||||
|
--- !u!1001 &1489069184
|
||||||
|
PrefabInstance:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Modification:
|
||||||
|
serializedVersion: 3
|
||||||
|
m_TransformParent: {fileID: 2072448676}
|
||||||
|
m_Modifications:
|
||||||
|
- target: {fileID: 2163867978973577705, guid: 2f44dc6d6adb9ae7f9b4f644da0e3485, type: 3}
|
||||||
|
propertyPath: m_LocalPosition.x
|
||||||
|
value: -2.25
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 2163867978973577705, guid: 2f44dc6d6adb9ae7f9b4f644da0e3485, type: 3}
|
||||||
|
propertyPath: m_LocalPosition.y
|
||||||
|
value: -5.23
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 2163867978973577705, guid: 2f44dc6d6adb9ae7f9b4f644da0e3485, type: 3}
|
||||||
|
propertyPath: m_LocalPosition.z
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 2163867978973577705, guid: 2f44dc6d6adb9ae7f9b4f644da0e3485, type: 3}
|
||||||
|
propertyPath: m_LocalRotation.w
|
||||||
|
value: 1
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 2163867978973577705, guid: 2f44dc6d6adb9ae7f9b4f644da0e3485, type: 3}
|
||||||
|
propertyPath: m_LocalRotation.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 2163867978973577705, guid: 2f44dc6d6adb9ae7f9b4f644da0e3485, type: 3}
|
||||||
|
propertyPath: m_LocalRotation.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 2163867978973577705, guid: 2f44dc6d6adb9ae7f9b4f644da0e3485, type: 3}
|
||||||
|
propertyPath: m_LocalRotation.z
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 2163867978973577705, guid: 2f44dc6d6adb9ae7f9b4f644da0e3485, type: 3}
|
||||||
|
propertyPath: m_LocalEulerAnglesHint.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 2163867978973577705, guid: 2f44dc6d6adb9ae7f9b4f644da0e3485, type: 3}
|
||||||
|
propertyPath: m_LocalEulerAnglesHint.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 2163867978973577705, guid: 2f44dc6d6adb9ae7f9b4f644da0e3485, type: 3}
|
||||||
|
propertyPath: m_LocalEulerAnglesHint.z
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 8871780616060845038, guid: 2f44dc6d6adb9ae7f9b4f644da0e3485, type: 3}
|
||||||
|
propertyPath: m_Name
|
||||||
|
value: Branch (3)
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
m_RemovedComponents: []
|
||||||
|
m_RemovedGameObjects: []
|
||||||
|
m_AddedGameObjects: []
|
||||||
|
m_AddedComponents: []
|
||||||
|
m_SourcePrefab: {fileID: 100100000, guid: 2f44dc6d6adb9ae7f9b4f644da0e3485, type: 3}
|
||||||
--- !u!1001 &1681788161
|
--- !u!1001 &1681788161
|
||||||
PrefabInstance:
|
PrefabInstance:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@@ -761,6 +886,63 @@ SpriteRenderer:
|
|||||||
m_SpriteTileMode: 0
|
m_SpriteTileMode: 0
|
||||||
m_WasSpriteAssigned: 1
|
m_WasSpriteAssigned: 1
|
||||||
m_SpriteSortPoint: 0
|
m_SpriteSortPoint: 0
|
||||||
|
--- !u!1001 &1870986352
|
||||||
|
PrefabInstance:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Modification:
|
||||||
|
serializedVersion: 3
|
||||||
|
m_TransformParent: {fileID: 2072448676}
|
||||||
|
m_Modifications:
|
||||||
|
- target: {fileID: 2163867978973577705, guid: 2f44dc6d6adb9ae7f9b4f644da0e3485, type: 3}
|
||||||
|
propertyPath: m_LocalPosition.x
|
||||||
|
value: 1.89
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 2163867978973577705, guid: 2f44dc6d6adb9ae7f9b4f644da0e3485, type: 3}
|
||||||
|
propertyPath: m_LocalPosition.y
|
||||||
|
value: -5.28
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 2163867978973577705, guid: 2f44dc6d6adb9ae7f9b4f644da0e3485, type: 3}
|
||||||
|
propertyPath: m_LocalPosition.z
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 2163867978973577705, guid: 2f44dc6d6adb9ae7f9b4f644da0e3485, type: 3}
|
||||||
|
propertyPath: m_LocalRotation.w
|
||||||
|
value: 1
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 2163867978973577705, guid: 2f44dc6d6adb9ae7f9b4f644da0e3485, type: 3}
|
||||||
|
propertyPath: m_LocalRotation.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 2163867978973577705, guid: 2f44dc6d6adb9ae7f9b4f644da0e3485, type: 3}
|
||||||
|
propertyPath: m_LocalRotation.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 2163867978973577705, guid: 2f44dc6d6adb9ae7f9b4f644da0e3485, type: 3}
|
||||||
|
propertyPath: m_LocalRotation.z
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 2163867978973577705, guid: 2f44dc6d6adb9ae7f9b4f644da0e3485, type: 3}
|
||||||
|
propertyPath: m_LocalEulerAnglesHint.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 2163867978973577705, guid: 2f44dc6d6adb9ae7f9b4f644da0e3485, type: 3}
|
||||||
|
propertyPath: m_LocalEulerAnglesHint.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 2163867978973577705, guid: 2f44dc6d6adb9ae7f9b4f644da0e3485, type: 3}
|
||||||
|
propertyPath: m_LocalEulerAnglesHint.z
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 8871780616060845038, guid: 2f44dc6d6adb9ae7f9b4f644da0e3485, type: 3}
|
||||||
|
propertyPath: m_Name
|
||||||
|
value: Branch (4)
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
m_RemovedComponents: []
|
||||||
|
m_RemovedGameObjects: []
|
||||||
|
m_AddedGameObjects: []
|
||||||
|
m_AddedComponents: []
|
||||||
|
m_SourcePrefab: {fileID: 100100000, guid: 2f44dc6d6adb9ae7f9b4f644da0e3485, type: 3}
|
||||||
--- !u!1001 &1890470405
|
--- !u!1001 &1890470405
|
||||||
PrefabInstance:
|
PrefabInstance:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@@ -911,6 +1093,8 @@ Transform:
|
|||||||
m_Children:
|
m_Children:
|
||||||
- {fileID: 1944302763}
|
- {fileID: 1944302763}
|
||||||
- {fileID: 1124127124}
|
- {fileID: 1124127124}
|
||||||
|
- {fileID: 33859906}
|
||||||
|
- {fileID: 688751894}
|
||||||
- {fileID: 1710653547}
|
- {fileID: 1710653547}
|
||||||
m_Father: {fileID: 0}
|
m_Father: {fileID: 0}
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
@@ -923,3 +1107,4 @@ SceneRoots:
|
|||||||
- {fileID: 2072448676}
|
- {fileID: 2072448676}
|
||||||
- {fileID: 1445156949}
|
- {fileID: 1445156949}
|
||||||
- {fileID: 750131492}
|
- {fileID: 750131492}
|
||||||
|
- {fileID: 488250683}
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.SceneManagement;
|
using UnityEngine.SceneManagement;
|
||||||
@@ -39,7 +40,7 @@ public class DamageHandler : MonoBehaviour
|
|||||||
if (lastYVelocity >= 0 && currentVelocity < 0)
|
if (lastYVelocity >= 0 && currentVelocity < 0)
|
||||||
{
|
{
|
||||||
falling = true;
|
falling = true;
|
||||||
Debug.Log("Started falling");
|
// Debug.Log("Started falling");
|
||||||
fallTime = 0f;
|
fallTime = 0f;
|
||||||
}
|
}
|
||||||
else if(lastYVelocity < 0 && currentVelocity < 0)
|
else if(lastYVelocity < 0 && currentVelocity < 0)
|
||||||
@@ -51,7 +52,7 @@ public class DamageHandler : MonoBehaviour
|
|||||||
fallTime += Time.deltaTime;
|
fallTime += Time.deltaTime;
|
||||||
} else if(currentVelocity >= 0)
|
} else if(currentVelocity >= 0)
|
||||||
{
|
{
|
||||||
Debug.Log("Not falling");
|
// Debug.Log("Not falling");
|
||||||
falling = false;
|
falling = false;
|
||||||
}
|
}
|
||||||
lastYVelocity = currentVelocity;
|
lastYVelocity = currentVelocity;
|
||||||
@@ -59,10 +60,7 @@ public class DamageHandler : MonoBehaviour
|
|||||||
|
|
||||||
private void OnCollisionEnter2D(Collision2D other)
|
private void OnCollisionEnter2D(Collision2D other)
|
||||||
{
|
{
|
||||||
|
// Debug.LogWarning("collide");
|
||||||
if (other.collider.CompareTag("Minidrop")){
|
|
||||||
UpdateHealth(0.2f);
|
|
||||||
}
|
|
||||||
//on collision check fall damage
|
//on collision check fall damage
|
||||||
float fallSpeed = lastYVelocity;
|
float fallSpeed = lastYVelocity;
|
||||||
if (fallSpeed < -threshold)
|
if (fallSpeed < -threshold)
|
||||||
@@ -71,7 +69,16 @@ public class DamageHandler : MonoBehaviour
|
|||||||
UpdateHealth(health - fallDamage);
|
UpdateHealth(health - fallDamage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void OnTriggerEnter2D(Collider2D other)
|
||||||
|
{
|
||||||
|
if (other.CompareTag("Minidrop")){
|
||||||
|
UpdateHealth(health + 0.2f);
|
||||||
|
Destroy(other.gameObject);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public void UpdateHealth(float health)
|
public void UpdateHealth(float health)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,24 +2,21 @@ using UnityEngine;
|
|||||||
|
|
||||||
public class PatternSelecter : MonoBehaviour
|
public class PatternSelecter : MonoBehaviour
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
bool isStarting = true;
|
|
||||||
void Start()
|
void Start()
|
||||||
{
|
{
|
||||||
|
foreach (Transform child in transform)
|
||||||
if (isStarting)
|
|
||||||
{
|
{
|
||||||
transform.GetChild(0).gameObject.SetActive(true);
|
child.gameObject.SetActive(false);
|
||||||
} else
|
|
||||||
{
|
|
||||||
foreach (Transform child in transform)
|
|
||||||
child.gameObject.SetActive(false);
|
|
||||||
|
|
||||||
int randomIndex = Random.Range(1, transform.childCount);
|
|
||||||
|
|
||||||
transform.GetChild(randomIndex).gameObject.SetActive(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (TreeSpawner.treeCount == 0)
|
||||||
|
{
|
||||||
|
transform.GetChild(0).gameObject.SetActive(true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int randomIndex = Random.Range(1, transform.childCount);
|
||||||
|
transform.GetChild(randomIndex).gameObject.SetActive(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -7,6 +7,9 @@ public class TreeSpawner : MonoBehaviour
|
|||||||
|
|
||||||
private bool hasSpawned = false;
|
private bool hasSpawned = false;
|
||||||
|
|
||||||
|
public static int treeCount;
|
||||||
|
|
||||||
|
|
||||||
void Update()
|
void Update()
|
||||||
{
|
{
|
||||||
if (hasSpawned == false)
|
if (hasSpawned == false)
|
||||||
@@ -18,7 +21,9 @@ public class TreeSpawner : MonoBehaviour
|
|||||||
float treeHeight = GetComponent<SpriteRenderer>().bounds.size.y;
|
float treeHeight = GetComponent<SpriteRenderer>().bounds.size.y;
|
||||||
Vector3 spawnPos = transform.position + Vector3.down * treeHeight + new Vector3(0, 0.2f, 0);
|
Vector3 spawnPos = transform.position + Vector3.down * treeHeight + new Vector3(0, 0.2f, 0);
|
||||||
|
|
||||||
|
treeCount++;
|
||||||
Instantiate(treePrefab, spawnPos, Quaternion.identity);
|
Instantiate(treePrefab, spawnPos, Quaternion.identity);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 251 KiB |
Reference in New Issue
Block a user