Pause Menu Updated
This commit is contained in:
@@ -16,6 +16,7 @@ public class BlockScript : MonoBehaviour
|
||||
public bool IsFlying = false;
|
||||
[SerializeField] private AudioSource JumpSound;
|
||||
[SerializeField] private AudioSource DieSound;
|
||||
public UnityEngine.RigidbodyConstraints2D constraints;
|
||||
|
||||
|
||||
// Start is called before the first frame update
|
||||
@@ -27,7 +28,11 @@ public class BlockScript : MonoBehaviour
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
if (!logic.IsFreezed) {
|
||||
myRigidbody.gravityScale = 2;
|
||||
myRigidbody.constraints = RigidbodyConstraints2D.None;
|
||||
}
|
||||
|
||||
if (IsFlying && !logic.IsFreezed) {
|
||||
rotation = Vector3.back;
|
||||
transform.Rotate(rotation * speed * Time.deltaTime);
|
||||
@@ -44,6 +49,7 @@ public class BlockScript : MonoBehaviour
|
||||
velocity = myRigidbody.velocity;
|
||||
myRigidbody.velocity = Vector2.zero;
|
||||
myRigidbody.gravityScale = 0;
|
||||
myRigidbody.constraints = RigidbodyConstraints2D.FreezeRotation;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using Photon.Pun;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
public class ConnectToServer : MonoBehaviourPunCallbacks
|
||||
{
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
PhotonNetwork.ConnectUsingSettings();
|
||||
}
|
||||
|
||||
public override void OnConnectedToMaster()
|
||||
{
|
||||
PhotonNetwork.JoinLobby();
|
||||
}
|
||||
|
||||
public override void OnJoinedLobby()
|
||||
{
|
||||
SceneManager.LoadScene("Lobby");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5d93ed45bf1c3d14391a3885160ba5ae
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -14,7 +14,7 @@ public class CreateAndJoinLevel : MonoBehaviour
|
||||
}
|
||||
public void JoinRoom()
|
||||
{
|
||||
SceneManager.LoadScene(scroller.i + 3);
|
||||
SceneManager.LoadScene(scroller.i + 2);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
public class EndPauseMenuScript : MonoBehaviour
|
||||
{
|
||||
public GameObject pauseMenu;
|
||||
public AudioSource BG_Music;
|
||||
public BackgroundScroller bgscript;
|
||||
|
||||
public LogicScript logic;
|
||||
|
||||
void Start()
|
||||
{
|
||||
bgscript = GameObject.FindGameObjectWithTag("Background").GetComponent<BackgroundScroller>();
|
||||
logic = GetComponent<LogicScript>();
|
||||
}
|
||||
public void ClosePauseMenu(){
|
||||
pauseMenu.SetActive(false);
|
||||
BG_Music.Play();
|
||||
bgscript.ScrollSpeed = 0.5f;
|
||||
}
|
||||
|
||||
public void ExitGame() {
|
||||
pauseMenu.SetActive(false);
|
||||
SceneManager.LoadScene(1);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c973e36edacbad745be546656dbf9e74
|
||||
@@ -5,7 +5,7 @@ using UnityEngine;
|
||||
public class LevelScoller : MonoBehaviour
|
||||
{
|
||||
RectTransform myRectTransform;
|
||||
public int i;
|
||||
public int i = 0;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
@@ -13,13 +13,19 @@ public class LevelScoller : MonoBehaviour
|
||||
}
|
||||
public void LeftClick()
|
||||
{
|
||||
myRectTransform.localPosition += Vector3.right * 1500;
|
||||
i -= 1;
|
||||
if (i==0) {}
|
||||
else {
|
||||
myRectTransform.localPosition += Vector3.right * 1500;
|
||||
i -= 1;
|
||||
}
|
||||
}
|
||||
|
||||
public void RightClick()
|
||||
{
|
||||
myRectTransform.localPosition += Vector3.left * 1500;
|
||||
i += 1;
|
||||
if (i==2) {}
|
||||
else{
|
||||
myRectTransform.localPosition += Vector3.left * 1500;
|
||||
i += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
public class PauseMenu : MonoBehaviour
|
||||
{
|
||||
@@ -11,7 +12,18 @@ public class PauseMenu : MonoBehaviour
|
||||
|
||||
public LogicScript logic;
|
||||
|
||||
public void ClosePauseMenu(){
|
||||
pauseMenu.SetActive(false);
|
||||
BG_Music.Play();
|
||||
bgscript.ScrollSpeed = 1f;
|
||||
logic.IsFreezed = false;
|
||||
}
|
||||
|
||||
public void ExitGame() {
|
||||
pauseMenu.SetActive(false);
|
||||
SceneManager.LoadScene(1);
|
||||
}
|
||||
|
||||
void Start()
|
||||
{
|
||||
bgscript = GameObject.FindGameObjectWithTag("Background").GetComponent<BackgroundScroller>();
|
||||
@@ -24,6 +36,8 @@ public class PauseMenu : MonoBehaviour
|
||||
pauseMenu.SetActive(true);
|
||||
BG_Music.Stop();
|
||||
bgscript.ScrollSpeed = 0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using Photon.Pun;
|
||||
|
||||
public class SpawnPlayers : MonoBehaviour
|
||||
{
|
||||
public GameObject playerPrefab;
|
||||
|
||||
public int x;
|
||||
public int y;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
Vector2 startPosition = new Vector2(x, y);
|
||||
PhotonNetwork.Instantiate(playerPrefab.name, startPosition, Quaternion.identity);
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 85a58a3c02a4c704bac27c095e959c6c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user