fixed
This commit is contained in:
parent
122f60bdda
commit
fe14f582b9
|
|
@ -281,6 +281,115 @@ CanvasRenderer:
|
|||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 98590474}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!1 &187158564
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 187158565}
|
||||
- component: {fileID: 187158566}
|
||||
- component: {fileID: 187158567}
|
||||
m_Layer: 0
|
||||
m_Name: Square
|
||||
m_TagString: Death
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &187158565
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 187158564}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: -7.4247, z: 0}
|
||||
m_LocalScale: {x: 1, y: 15.209486, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 1987779770}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!212 &187158566
|
||||
SpriteRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 187158564}
|
||||
m_Enabled: 0
|
||||
m_CastShadows: 0
|
||||
m_ReceiveShadows: 0
|
||||
m_DynamicOccludee: 1
|
||||
m_MotionVectors: 1
|
||||
m_LightProbeUsage: 1
|
||||
m_ReflectionProbeUsage: 1
|
||||
m_RayTracingMode: 0
|
||||
m_RayTraceProcedural: 0
|
||||
m_RenderingLayerMask: 1
|
||||
m_RendererPriority: 0
|
||||
m_Materials:
|
||||
- {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_StaticBatchInfo:
|
||||
firstSubMesh: 0
|
||||
subMeshCount: 0
|
||||
m_StaticBatchRoot: {fileID: 0}
|
||||
m_ProbeAnchor: {fileID: 0}
|
||||
m_LightProbeVolumeOverride: {fileID: 0}
|
||||
m_ScaleInLightmap: 1
|
||||
m_ReceiveGI: 1
|
||||
m_PreserveUVs: 0
|
||||
m_IgnoreNormalsForChartDetection: 0
|
||||
m_ImportantGI: 0
|
||||
m_StitchLightmapSeams: 1
|
||||
m_SelectedEditorRenderState: 0
|
||||
m_MinimumChartSize: 4
|
||||
m_AutoUVMaxDistance: 0.5
|
||||
m_AutoUVMaxAngle: 89
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_SortingLayerID: 0
|
||||
m_SortingLayer: 0
|
||||
m_SortingOrder: 0
|
||||
m_Sprite: {fileID: 7482667652216324306, guid: 48e93eef0688c4a259cb0eddcd8661f7, type: 3}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_FlipX: 0
|
||||
m_FlipY: 0
|
||||
m_DrawMode: 0
|
||||
m_Size: {x: 1, y: 1}
|
||||
m_AdaptiveModeThreshold: 0.5
|
||||
m_SpriteTileMode: 0
|
||||
m_WasSpriteAssigned: 1
|
||||
m_MaskInteraction: 0
|
||||
m_SpriteSortPoint: 0
|
||||
--- !u!61 &187158567
|
||||
BoxCollider2D:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 187158564}
|
||||
m_Enabled: 1
|
||||
m_Density: 1
|
||||
m_Material: {fileID: 0}
|
||||
m_IsTrigger: 0
|
||||
m_UsedByEffector: 0
|
||||
m_UsedByComposite: 0
|
||||
m_Offset: {x: 0, y: 0}
|
||||
m_SpriteTilingProperty:
|
||||
border: {x: 0, y: 0, z: 0, w: 0}
|
||||
pivot: {x: 0.5, y: 0.5}
|
||||
oldSize: {x: 1, y: 1}
|
||||
newSize: {x: 1, y: 1}
|
||||
adaptiveTilingThreshold: 0.5
|
||||
drawMode: 0
|
||||
adaptiveTiling: 0
|
||||
m_AutoTiling: 0
|
||||
serializedVersion: 2
|
||||
m_Size: {x: 1, y: 1}
|
||||
m_EdgeRadius: 0
|
||||
--- !u!1 &205374841
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
@ -507,7 +616,7 @@ SpriteRenderer:
|
|||
m_FlipX: 0
|
||||
m_FlipY: 0
|
||||
m_DrawMode: 2
|
||||
m_Size: {x: 9584.945, y: 747.2357}
|
||||
m_Size: {x: 9653.238, y: 747.2357}
|
||||
m_AdaptiveModeThreshold: 0.5
|
||||
m_SpriteTileMode: 0
|
||||
m_WasSpriteAssigned: 1
|
||||
|
|
@ -521,7 +630,7 @@ Transform:
|
|||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1109062756}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 948.0227, y: 6, z: 0}
|
||||
m_LocalPosition: {x: 941.1934, y: 6, z: 0}
|
||||
m_LocalScale: {x: 0.20000002, y: 0.2, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
|
|
@ -1066,7 +1175,7 @@ Transform:
|
|||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1773216340}
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: -8.69, y: -4.96, z: 0}
|
||||
m_LocalPosition: {x: -28.010002, y: -4.96, z: 0}
|
||||
m_LocalScale: {x: 0.52, y: 3.52, z: 1}
|
||||
m_Children:
|
||||
- {fileID: 1864620565}
|
||||
|
|
@ -1498,9 +1607,10 @@ Transform:
|
|||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1987779768}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: -8.64, y: 0, z: 0}
|
||||
m_LocalScale: {x: 0.52, y: 3.52, z: 1}
|
||||
m_Children: []
|
||||
m_LocalPosition: {x: -28.94, y: -1.8477, z: 0}
|
||||
m_LocalScale: {x: 0.52, y: 4.4433446, z: 1}
|
||||
m_Children:
|
||||
- {fileID: 187158565}
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 3
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ using UnityEngine;
|
|||
|
||||
public class LevelGenerator : MonoBehaviour
|
||||
{
|
||||
public static LevelGenerator instance{get; private set;}
|
||||
[SerializeField]private GameObject LevelPrefab;
|
||||
[SerializeField]private GameObject TopPrefab;
|
||||
private List<GameObject> spawnedLevels = new List<GameObject>();
|
||||
|
|
@ -13,17 +14,22 @@ public class LevelGenerator : MonoBehaviour
|
|||
[SerializeField]private float maxHigh;
|
||||
|
||||
[SerializeField]private List<float> Levels;
|
||||
|
||||
void Awake(){
|
||||
instance = this;
|
||||
}
|
||||
|
||||
void Start()
|
||||
{
|
||||
GenerateAhead(150);
|
||||
}
|
||||
|
||||
|
||||
public void GenerateAhead(int count = 10){
|
||||
if(Levels.Count <= 0){
|
||||
Levels = new List<float>();
|
||||
}
|
||||
Levels.Add(1);
|
||||
|
||||
}
|
||||
int startIndex= Levels.Count;
|
||||
int lastIndex = Levels.Count +count;
|
||||
for(int i =startIndex; i < lastIndex; i++){
|
||||
|
|
|
|||
|
|
@ -43,19 +43,15 @@ public class Player : MonoBehaviour
|
|||
Velocity = new Vector2(forwardSpeed,0);
|
||||
|
||||
CameraFollower.Target= body;
|
||||
CameraFollower.UpdateFrame();
|
||||
|
||||
playerRigidbody.bodyType = RigidbodyType2D.Static;
|
||||
playerRigidbody.gravityScale = 0;
|
||||
}
|
||||
|
||||
int lastX = 0;
|
||||
void FixedUpdate()
|
||||
{
|
||||
if (!gameStarted && Input.GetKey(KeyCode.Space))
|
||||
{
|
||||
gameStarted = true;
|
||||
playerRigidbody.bodyType = RigidbodyType2D.Dynamic;
|
||||
playerRigidbody.gravityScale = gravity;
|
||||
}
|
||||
|
||||
|
||||
if (!gameStarted)
|
||||
{
|
||||
|
|
@ -70,6 +66,11 @@ public class Player : MonoBehaviour
|
|||
}
|
||||
HandleJump();
|
||||
|
||||
if(lastX != (int)body.position.x){
|
||||
lastX = (int)body.position.x;
|
||||
LevelGenerator.instance.GenerateAhead(2);
|
||||
}
|
||||
|
||||
//Gravity
|
||||
Velocity -= new Vector2(0, gravity);
|
||||
|
||||
|
|
@ -99,6 +100,12 @@ public class Player : MonoBehaviour
|
|||
|
||||
|
||||
public void Jump(){
|
||||
if (!gameStarted)
|
||||
{
|
||||
gameStarted = true;
|
||||
playerRigidbody.bodyType = RigidbodyType2D.Dynamic;
|
||||
playerRigidbody.gravityScale = gravity;
|
||||
}
|
||||
if(!isReadyToJump){ return; }
|
||||
jumpTimer =0;
|
||||
Velocity = new Vector2(Velocity.x, jumpForce);
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ public class TimeAliveMoney : MonoBehaviour
|
|||
public TMP_Text moneyText;
|
||||
public TMP_Text totalMoneyText;
|
||||
public Player player;
|
||||
private bool isAlive = true;
|
||||
private float timeAlive = 0f;
|
||||
private float totalMoneyEarned = 0f;
|
||||
|
||||
|
|
@ -19,7 +18,7 @@ public class TimeAliveMoney : MonoBehaviour
|
|||
|
||||
void Update()
|
||||
{
|
||||
if (player.gameStarted && isAlive == true) {
|
||||
if (player.gameStarted && player.isAlive == true) {
|
||||
timeAlive += Time.deltaTime;
|
||||
float earnedMoney = timeAlive * moneyPerSecond;
|
||||
if (moneyText != null)
|
||||
|
|
@ -29,7 +28,6 @@ public class TimeAliveMoney : MonoBehaviour
|
|||
|
||||
public void OnPlayerDeath()
|
||||
{
|
||||
isAlive = false;
|
||||
totalMoneyEarned += timeAlive * moneyPerSecond;
|
||||
SaveMoney();
|
||||
timeAlive = 0f;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user