PauseMenuUpdated
This commit is contained in:
parent
54bd358962
commit
e7cf0b7235
Binary file not shown.
Binary file not shown.
@ -486,6 +486,7 @@ MonoBehaviour:
|
||||
m_SpriteB: {fileID: 21300000, guid: 8774469666b72e64981b972de94e1cc9, type: 3}
|
||||
duration: 0.1
|
||||
m_SR: {fileID: 0}
|
||||
logic: {fileID: 0}
|
||||
--- !u!70 &180622470
|
||||
CapsuleCollider2D:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -1229,8 +1230,10 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: 3cdc8fa984cc5fe4a8816920234d1169, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
scoreText: {fileID: 0}
|
||||
player: {fileID: 0}
|
||||
IsFreezed: 0
|
||||
gameOverScreen: {fileID: 1282931088}
|
||||
pauseMenu: {fileID: 1947065555}
|
||||
BG_Music: {fileID: 1710401282}
|
||||
bgscript: {fileID: 1489183630}
|
||||
jumpsText: {fileID: 629075521}
|
||||
@ -1269,6 +1272,7 @@ MonoBehaviour:
|
||||
pauseMenu: {fileID: 1947065555}
|
||||
BG_Music: {fileID: 1710401282}
|
||||
bgscript: {fileID: 1489183630}
|
||||
logic: {fileID: 0}
|
||||
--- !u!1 &391698955
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -2797,6 +2801,7 @@ MonoBehaviour:
|
||||
Block: {fileID: 3997803213758825311, guid: f432afb7d9785944985921bd4551a51d, type: 3}
|
||||
spawnRate: 0.1
|
||||
player: {fileID: 0}
|
||||
logic: {fileID: 0}
|
||||
--- !u!4 &1295304553
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -4623,6 +4628,7 @@ MonoBehaviour:
|
||||
m_SpriteB: {fileID: 21300000, guid: 703cea753b75d7240b3d4ec518997518, type: 3}
|
||||
duration: 0.1
|
||||
m_SR: {fileID: 0}
|
||||
logic: {fileID: 0}
|
||||
--- !u!1001 &1929532885
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -6484,6 +6490,7 @@ MonoBehaviour:
|
||||
moveSpeed: 0
|
||||
deadZone: -15
|
||||
player: {fileID: 0}
|
||||
logic: {fileID: 0}
|
||||
--- !u!4 &3997803212941429622
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -6533,6 +6540,7 @@ MonoBehaviour:
|
||||
moveSpeed: 0
|
||||
deadZone: -15
|
||||
player: {fileID: 0}
|
||||
logic: {fileID: 0}
|
||||
--- !u!61 &3997803213657427970
|
||||
BoxCollider2D:
|
||||
m_ObjectHideFlags: 0
|
||||
|
||||
@ -20,7 +20,7 @@ public class Block2Script : MonoBehaviour
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
if (player.IsAlive||!logic.IsFreezed) {
|
||||
if (player.IsAlive&&!logic.IsFreezed) {
|
||||
transform.position = transform.position + (Vector3.left * moveSpeed) * Time.deltaTime;
|
||||
}
|
||||
|
||||
|
||||
@ -9,11 +9,13 @@ public class Block2SpawnerScript : MonoBehaviour
|
||||
public float spawnRate = 0;
|
||||
private float timer = 0;
|
||||
public BlockScript player;
|
||||
public LogicScript logic;
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
player = GameObject.FindGameObjectWithTag("Player").GetComponent<BlockScript>();
|
||||
logic = GameObject.FindGameObjectWithTag("Logic").GetComponent<LogicScript>();
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
@ -30,7 +32,7 @@ public class Block2SpawnerScript : MonoBehaviour
|
||||
}
|
||||
|
||||
void spawnBlock(){
|
||||
if (player.IsAlive) {
|
||||
if (player.IsAlive&&!logic.IsFreezed) {
|
||||
Instantiate(Block, transform.position, transform.rotation);
|
||||
}
|
||||
}
|
||||
|
||||
@ -6,6 +6,7 @@ using UnityEngine;
|
||||
public class BlockScript : MonoBehaviour
|
||||
{
|
||||
|
||||
public Vector2 velocity;
|
||||
public Rigidbody2D myRigidbody;
|
||||
public float blockStrength;
|
||||
public bool IsAlive = true;
|
||||
@ -27,17 +28,23 @@ public class BlockScript : MonoBehaviour
|
||||
void Update()
|
||||
{
|
||||
|
||||
if (IsFlying) {
|
||||
if (IsFlying && !logic.IsFreezed) {
|
||||
rotation = Vector3.back;
|
||||
transform.Rotate(rotation * speed * Time.deltaTime);
|
||||
}
|
||||
|
||||
if(Input.GetKeyDown(KeyCode.Space) && IsAlive && IsFlying==false) {
|
||||
if(Input.GetKeyDown(KeyCode.Space) && IsAlive && !IsFlying && !logic.IsFreezed) {
|
||||
IsFlying = true;
|
||||
JumpSound.Play();
|
||||
myRigidbody.velocity = Vector2.up * blockStrength;
|
||||
}
|
||||
|
||||
if(logic.IsFreezed) {
|
||||
velocity = myRigidbody.velocity;
|
||||
myRigidbody.velocity = Vector2.zero;
|
||||
myRigidbody.gravityScale = 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void OnCollisionEnter2D(Collision2D collision) {
|
||||
|
||||
@ -7,6 +7,7 @@ using UnityEngine.SceneManagement;
|
||||
public class LogicScript : MonoBehaviour
|
||||
{
|
||||
|
||||
public BlockScript player;
|
||||
public bool IsFreezed = false;
|
||||
public GameObject gameOverScreen;
|
||||
public GameObject pauseMenu;
|
||||
@ -23,6 +24,7 @@ public class LogicScript : MonoBehaviour
|
||||
void Start()
|
||||
{
|
||||
bgscript = GameObject.FindGameObjectWithTag("Background").GetComponent<BackgroundScroller>();
|
||||
player = GameObject.FindGameObjectWithTag("Player").GetComponent<BlockScript>();
|
||||
}
|
||||
|
||||
public void addJump() {
|
||||
@ -45,18 +47,22 @@ public class LogicScript : MonoBehaviour
|
||||
bgscript.ScrollSpeed = 0f;
|
||||
}
|
||||
|
||||
void Update() {
|
||||
if (Input.GetKeyDown(KeyCode.Escape)||!IsFreezed) {
|
||||
void Update()
|
||||
{
|
||||
if (Input.GetKeyDown(KeyCode.Escape) && !IsFreezed && player.IsAlive) {
|
||||
IsFreezed = true;
|
||||
pauseMenu.SetActive(true);
|
||||
BG_Music.Stop();
|
||||
bgscript.ScrollSpeed = 0f;
|
||||
}
|
||||
else {
|
||||
IsFreezed = false;
|
||||
|
||||
else if (Input.GetKeyDown(KeyCode.Escape) && IsFreezed && player.IsAlive) {
|
||||
pauseMenu.SetActive(false);
|
||||
BG_Music.Play();
|
||||
bgscript.ScrollSpeed = 1f;
|
||||
player.myRigidbody.gravityScale = 2;
|
||||
player.myRigidbody.velocity = player.velocity;
|
||||
IsFreezed = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -9,15 +9,18 @@ public class PauseMenu : MonoBehaviour
|
||||
public AudioSource BG_Music;
|
||||
public BackgroundScroller bgscript;
|
||||
|
||||
public LogicScript logic;
|
||||
|
||||
|
||||
void Start()
|
||||
{
|
||||
bgscript = GameObject.FindGameObjectWithTag("Background").GetComponent<BackgroundScroller>();
|
||||
logic = GetComponent<LogicScript>();
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
if (Input.GetKeyDown(KeyCode.Escape)) {
|
||||
if (Input.GetKeyDown(KeyCode.Escape)&&!logic.IsFreezed) {
|
||||
pauseMenu.SetActive(true);
|
||||
BG_Music.Stop();
|
||||
bgscript.ScrollSpeed = 0f;
|
||||
|
||||
@ -20,7 +20,7 @@ public class SmallSpikeScript : MonoBehaviour
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
if (player.IsAlive||!logic.IsFreezed) {
|
||||
if (player.IsAlive&&!logic.IsFreezed) {
|
||||
transform.position = transform.position + (Vector3.left * moveSpeed) * Time.deltaTime;
|
||||
}
|
||||
|
||||
|
||||
@ -20,7 +20,7 @@ public class SpikeScript : MonoBehaviour
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
if (player.IsAlive||!logic.IsFreezed) {
|
||||
if (player.IsAlive&&!logic.IsFreezed) {
|
||||
transform.position = transform.position + (Vector3.left * moveSpeed) * Time.deltaTime;
|
||||
}
|
||||
|
||||
|
||||
@ -26,7 +26,7 @@ public class jumppad_script : MonoBehaviour
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
if (player.IsAlive||!logic.IsFreezed) {
|
||||
if (player.IsAlive&&!logic.IsFreezed) {
|
||||
transform.position = transform.position + (Vector3.left * moveSpeed) * Time.deltaTime;
|
||||
}
|
||||
|
||||
|
||||
@ -13,11 +13,12 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_EnablePreReleasePackages: 0
|
||||
m_EnablePackageDependencies: 0
|
||||
m_AdvancedSettingsExpanded: 1
|
||||
m_ScopedRegistriesSettingsExpanded: 1
|
||||
m_SeeAllPackageVersions: 0
|
||||
m_DismissPreviewPackagesInUse: 0
|
||||
oneTimeWarningShown: 0
|
||||
oneTimeDeprecatedPopUpShown: 1
|
||||
m_Registries:
|
||||
- m_Id: main
|
||||
m_Name:
|
||||
@ -25,20 +26,12 @@ MonoBehaviour:
|
||||
m_Scopes: []
|
||||
m_IsDefault: 1
|
||||
m_Capabilities: 7
|
||||
m_ConfigSource: 0
|
||||
m_UserSelectedRegistryName:
|
||||
m_UserAddingNewScopedRegistry: 0
|
||||
m_RegistryInfoDraft:
|
||||
m_ErrorMessage:
|
||||
m_Original:
|
||||
m_Id:
|
||||
m_Name:
|
||||
m_Url:
|
||||
m_Scopes: []
|
||||
m_IsDefault: 0
|
||||
m_Capabilities: 0
|
||||
m_Modified: 0
|
||||
m_Name:
|
||||
m_Url:
|
||||
m_Scopes:
|
||||
-
|
||||
m_SelectedScopeIndex: 0
|
||||
m_ErrorMessage:
|
||||
m_UserModificationsInstanceId: -856
|
||||
m_OriginalInstanceId: -858
|
||||
m_LoadAssets: 0
|
||||
|
||||
Loading…
Reference in New Issue
Block a user