Space message added

This commit is contained in:
Sewmina 2023-01-17 05:54:14 +05:30
parent 58e9ea33ba
commit 652134f007
2 changed files with 87 additions and 6 deletions

View File

@ -633,6 +633,85 @@ Transform:
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1007251547
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1007251548}
- component: {fileID: 1007251550}
- component: {fileID: 1007251549}
m_Layer: 5
m_Name: Text
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1007251548
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1007251547}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 1218230959}
m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0.5}
m_AnchorMax: {x: 1, y: 0.5}
m_AnchoredPosition: {x: 0, y: -76}
m_SizeDelta: {x: 0, y: 100}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1007251549
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1007251547}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 0
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_FontData:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_FontSize: 61
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 10
m_MaxSize: 97
m_Alignment: 4
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text: Press 'Space' to Start
--- !u!222 &1007251550
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1007251547}
m_CullTransparentMesh: 1
--- !u!1 &1076262167
GameObject:
m_ObjectHideFlags: 0
@ -943,6 +1022,7 @@ RectTransform:
- {fileID: 2047832627}
- {fileID: 1479112201}
- {fileID: 1913740238}
- {fileID: 1007251548}
m_Father: {fileID: 0}
m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@ -1116,6 +1196,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 343276379f35b714985aa57c6a87b4d8, type: 3}
m_Name:
m_EditorClassIdentifier:
StartPanel: {fileID: 1007251547}
pogeColors:
- {r: 1, g: 1, b: 1, a: 1}
- {r: 1, g: 0.9719708, b: 0.4575472, a: 1}

View File

@ -4,6 +4,7 @@ using UnityEngine;
public class Player : MonoBehaviour
{
public GameObject StartPanel;
public Color[] pogeColors;
[SerializeField]private Transform body;
[field:SerializeField]public Vector2 Velocity {get; private set;}
@ -35,6 +36,7 @@ public class Player : MonoBehaviour
[SerializeField]private Rigidbody2D playerRigidbody;
void Start(){
StartPanel.SetActive(true);
spriteRenderer = GetComponent<SpriteRenderer>();
timeAliveMoney = GetComponent<TimeAliveMoney>();
isAlive = true;
@ -52,9 +54,8 @@ public class Player : MonoBehaviour
}
int lastX = 0;
void FixedUpdate()
{
if(Input.GetKey(KeyCode.X)){
DataManager.total = 5000000;
{if(Input.GetKey(KeyCode.Space)){
Jump();
}
if (!gameStarted)
@ -65,9 +66,7 @@ public class Player : MonoBehaviour
if(!isAlive){ return; }
HandleDeath();
if(Input.GetKey(KeyCode.Space)){
Jump();
}
HandleJump();
if(lastX != (int)body.position.x){
@ -107,6 +106,7 @@ public class Player : MonoBehaviour
if (!gameStarted)
{
gameStarted = true;
StartPanel.SetActive(false);
playerRigidbody.bodyType = RigidbodyType2D.Dynamic;
playerRigidbody.gravityScale = gravity;
}