mirror of
https://github.com/OMGeeky/GameDevGameJamV2.git
synced 2025-12-28 07:17:54 +01:00
Main Menu & Pausing
This commit is contained in:
@@ -30,6 +30,7 @@ public class Character : MonoBehaviour
|
||||
[SerializeField] private LayerMask findLayerMask;
|
||||
[SerializeField] private float eatRange = 2.5f;
|
||||
[SerializeField] private float attachRange = .5f;
|
||||
[SerializeField] public PauseMenuCaller PauseMenuCaller;
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ public class CharacterController2D : MonoBehaviour
|
||||
{
|
||||
public bool active = true;
|
||||
[SerializeField] private float jumpForce = 50f; // Amount of force added when the player jumps.
|
||||
[Range( 0 , .3f )] [SerializeField] private float movementSmoothing = .05f;// How much to smooth out the movement
|
||||
// [Range( 0 , .3f )] [SerializeField] private float movementSmoothing = .05f;// How much to smooth out the movement
|
||||
[SerializeField] private bool airControl = true; // Whether or not a player can steer while jumping;
|
||||
[SerializeField] private LayerMask whatIsGround; // A mask determining what is ground to the character
|
||||
[Range( 0 , 2 )] [SerializeField] private float groundedRadius = 1.5f; // Radius of the overlap circle to determine if grounded
|
||||
|
||||
@@ -26,6 +26,9 @@ public class InputToMovement : MonoBehaviour
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if ( Time.timeScale == 0 )
|
||||
return;
|
||||
|
||||
if(controller2D.active != character.isActivePlayer)
|
||||
controller2D.active = character.isActivePlayer;
|
||||
|
||||
|
||||
44
Assets/Scripts/MainMenu.cs
Normal file
44
Assets/Scripts/MainMenu.cs
Normal file
@@ -0,0 +1,44 @@
|
||||
using System;
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
|
||||
namespace OMGeeky
|
||||
{
|
||||
public class MainMenu : MonoBehaviour
|
||||
{
|
||||
public event Action StartGame;
|
||||
private Canvas canvas;
|
||||
[SerializeField] public bool IsPauseScreen;
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
Scene scene = SceneManager.GetSceneByName( "MainLevel" );
|
||||
if ( !scene.isLoaded )
|
||||
SceneManager.LoadScene( "MainLevel" , LoadSceneMode.Additive );
|
||||
|
||||
scene = SceneManager.GetSceneByName( "MainLevel" );
|
||||
|
||||
|
||||
if ( canvas == null )
|
||||
canvas = GetComponentInParent<Canvas>();
|
||||
}
|
||||
|
||||
public void StartNewGame()
|
||||
{
|
||||
StartGame?.Invoke();
|
||||
}
|
||||
|
||||
public void Options() { throw new NotImplementedException(); }
|
||||
|
||||
public void Quit()
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
UnityEditor.EditorApplication.ExitPlaymode();
|
||||
#else
|
||||
UnityEngine.Application.Quit();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/MainMenu.cs.meta
Normal file
11
Assets/Scripts/MainMenu.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fcd7296fcc9729a428b027fbf5bbc764
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user