Main Menu & Pausing

This commit is contained in:
OMGeeky
2022-05-23 20:40:23 +02:00
parent d14d23594e
commit bfa8a22f63
96 changed files with 14764 additions and 177 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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;

View 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
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: fcd7296fcc9729a428b027fbf5bbc764
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: