Skip to content
Snippets Groups Projects
Commit 04465840 authored by czbalint's avatar czbalint
Browse files

Game Over Scene alfa verzio

parent 11f98eab
Branches
No related tags found
1 merge request!32Game Over Scene alfa verzio
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
public class GameOverController : MonoBehaviour{
[SerializeField] private Text ScoreText;
[SerializeField] private Text HighScoreText;
[SerializeField] private ScoreData scoreData;
private void Start(){
ScoreText.text = "Score: " + scoreData.CurrentScore;
HighScoreText.text = "High Score: " + scoreData.HighScore;
}
public void Restart(){
SceneManager.LoadScene(1);
}
public void BackToMenu(){
SceneManager.LoadScene(0);
}
}
fileFormatVersion: 2
guid: 22b3486454d72d044b26cb9b28dc3344
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
This diff is collapsed.
......@@ -689,6 +689,10 @@ PrefabInstance:
propertyPath: y_offset
value: 2
objectReference: {fileID: 0}
- target: {fileID: 1739828243584991409, guid: 55d2f14dee4db49449ae72330c148985, type: 3}
propertyPath: _scoreData
value:
objectReference: {fileID: 11400000, guid: c3384fdbcb43df94dbaba334a4851414, type: 2}
- target: {fileID: 1739828243584991409, guid: 55d2f14dee4db49449ae72330c148985, type: 3}
propertyPath: mainCamera
value:
......
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d3a1741d715ea404cb4bf493b0a81fd6, type: 3}
m_Name: Score
m_EditorClassIdentifier:
fileFormatVersion: 2
guid: c3384fdbcb43df94dbaba334a4851414
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[CreateAssetMenu(fileName = "Score", menuName = "ScriptableObjects/ScoreObject", order = 1)]
class ScoreData : ScriptableObject{
private int currentScore;
public int HighScore {get; private set; }
public int CurrentScore{
get => currentScore;
set{
if (value > HighScore)
HighScore = value;
currentScore = value;
}
}
}
\ No newline at end of file
fileFormatVersion: 2
guid: d3a1741d715ea404cb4bf493b0a81fd6
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
......@@ -37,6 +37,7 @@ public class GameManager : MonoBehaviour {
[SerializeField] private OnkoltsegController OnkoltsegController;
[SerializeField] private Canvas InputCanvas;
[SerializeField] private ScoreController scoreController;
[SerializeField] private ScoreData _scoreData;
[SerializeField] private FellOffController m_FellOffController;
private float startPlatformsHeight = 0;
......@@ -113,4 +114,8 @@ public class GameManager : MonoBehaviour {
if (OnkoltsegController.WaitingTime > 0.5)
OnkoltsegController.WaitingTime -= DeIncreaseOnkoltsegTime;
}
public void SaveScore(){
_scoreData.CurrentScore = (int) scoreController.Score;
}
}
\ No newline at end of file
......@@ -51,6 +51,7 @@ public class Player : MonoBehaviour {
// Ebben a fuggvenyben meg lehet adni, ha esetleg van plusz eletunk, es akkor nem hal meg egybol a jatekos ha nekimegy valaminek
public void hurt() {
// Toltsuk be a jatek vege screent.
GameManager.Instance.SaveScore();
SceneManager.LoadScene("Game_over");
}
......
......@@ -9,9 +9,10 @@ public class ScoreController : MonoBehaviour{
public double multiplier;
private double score;
public string ScoreText{
public double Score => score;
private string ScoreText{
set => scoreText.text = value;
get => scoreText.text;
}
public double BoostMultiplier{
......
m_EditorVersion: 2020.3.6f1
m_EditorVersionWithRevision: 2020.3.6f1 (338bb68529b2)
m_EditorVersion: 2020.3.11f1
m_EditorVersionWithRevision: 2020.3.11f1 (99c7afb366b3)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment