Main Menu Upgrade

This commit is contained in:
Jakub Sztuba 2023-01-07 00:39:19 +01:00
parent cc6146631b
commit 9f36774efb
8 changed files with 102 additions and 9 deletions

View File

@ -323,6 +323,7 @@
<Compile Include="Assets\Scripts\REFACTORING\Application\Dialogue\MissionDialogue.cs" />
<Compile Include="Assets\Scripts\REFACTORING\Application\UI\Panel\TaskPanelController.cs" />
<Compile Include="Assets\Scripts\Player.cs" />
<Compile Include="Assets\ContinueButton.cs" />
<None Include="Assets\TextMesh Pro\Shaders\TMPro.cginc" />
<None Include="Assets\HardLight2D\ReadMe - FAQ.txt" />
<None Include="Assets\TextMesh Pro\Shaders\TMP_SDF-Mobile Overlay.shader" />

33
Assets/ContinueButton.cs Normal file
View File

@ -0,0 +1,33 @@
using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
public class ContinueButton : MonoBehaviour
{
Color greyscale => new Color(1f, 1f, 1f, 0.3f);
Color greyscaletext => new Color(50f, 50f, 50f, 0.3f);
// Start is called before the first frame update
void Start()
{
GameObject continueButton = GameObject.Find("ContinueButton");
TMP_Text m_TextComponent;
m_TextComponent = GameObject.Find("ContinueText").GetComponent <TextMeshProUGUI>();
if (!PlayerPrefs.HasKey("SceneSaved"))
{
continueButton.GetComponent<Image>().color = greyscaletext;
m_TextComponent.color = greyscaletext;
}
}
// Update is called once per frame
void Update()
{
}
}

View File

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

View File

@ -43,7 +43,6 @@ public class NewGame : MonoBehaviour
float health = 10.0f;
PlayerPrefs.SetFloat("maxHealth", 10);
PlayerPrefs.SetFloat("health", 10);
PlayerPrefs.SetInt("HasEverPlayed",1);
//PlayerPrefs.SetInt("continued", 0);
PlayerPrefs.SetInt("rock", 0); // Is it used anywhere? I have not found it

View File

@ -564,6 +564,7 @@ GameObject:
- component: {fileID: 455923087}
- component: {fileID: 455923090}
- component: {fileID: 455923091}
- component: {fileID: 455923092}
m_Layer: 5
m_Name: ContinueButton
m_TagString: Untagged
@ -721,6 +722,18 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 7a1bf3e868faa974eacf1ae8d9407255, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!114 &455923092
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 455923085}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: e44f20bba37308745b213d8247feb6b9, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1 &502516633
GameObject:
m_ObjectHideFlags: 0
@ -890,7 +903,7 @@ MonoBehaviour:
m_Calls:
- m_Target: {fileID: 680041739}
m_TargetAssemblyTypeName: ChangeScene, Assembly-CSharp
m_MethodName: MoveToScene
m_MethodName: MoveToSceneFirst
m_Mode: 3
m_Arguments:
m_ObjectArgument: {fileID: 0}

View File

@ -3,27 +3,56 @@ using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
using System;
using System.Diagnostics;
using Debug = UnityEngine.Debug;
public class ChangeScene : MonoBehaviour
{
float x, y, z;
private Animator myanim;
public void MoveToScene(int sceneID)
{
SceneManager.LoadScene(sceneID);
}
public void MoveToSceneFirst(int sceneID)
{
//Scene current = SceneManager.GetActiveScene();
//Debug.Log(PlayerPrefs.HasKey("HER"));
if (!PlayerPrefs.HasKey("SceneSaved"))
{
SceneManager.LoadScene(5);
}
else
{
SceneManager.LoadScene(sceneID);
}
}
void Start(){
}
private void Awake()
{
}
private void Update()
{
}
private IEnumerator WaitForAnimationAndMoveToScene(float waitTime, Collision2D collision)
{
while (true)
{
yield return new WaitForSeconds(waitTime);
Debug.Log("BEFORE");
collision.gameObject.GetComponent<DoorBehaviour>().ScenetToMoveTo();
Debug.Log("AFTER");
}
}
@ -38,8 +67,11 @@ public class ChangeScene : MonoBehaviour
if(collision.gameObject.tag == "AnimatedDoorSceneTransition")
{
Debug.Log("Starting coroutine");
Debug.Log(TriggerDoor.ableToOpen);
if (TriggerDoor.ableToOpen)
{
StartCoroutine(WaitForAnimationAndMoveToScene(0.3f, collision));
}
}
}
}
}

View File

@ -6,7 +6,7 @@ public class TriggerDoor : DetectionZone
{
public string DoorOpenAnimatorParamName = "DoorOpen";
public static bool ableToOpen = false;
Animator animator;
public static Animator animator;
void Start(){
animator = GetComponent<Animator>();
@ -14,11 +14,14 @@ public class TriggerDoor : DetectionZone
void Update() {
if(detectedObjs.Count > 0) {
animator.SetBool(DoorOpenAnimatorParamName, true);
//if (Input.GetKeyDown(KeyCode.E))
//{
animator.SetBool(DoorOpenAnimatorParamName, true);
ableToOpen = true;
//}
} else {
animator.SetBool(DoorOpenAnimatorParamName, false);
ableToOpen = false;
}
}

View File

@ -1,3 +1,4 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;