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