Commit e0b61434 authored by 16이진형's avatar 16이진형

레벨 메니저 기초 작업

parent 585600a4
...@@ -21,8 +21,8 @@ public class AlertManager : MonoBehaviour ...@@ -21,8 +21,8 @@ public class AlertManager : MonoBehaviour
void Start() void Start()
{ {
Close(); Close();
string[] aa = { "a","b" }; //string[] aa = { "a","b" };
Alert(aa); //Alert(aa);
} }
// Update is called once per frame // Update is called once per frame
......
...@@ -398,6 +398,7 @@ MonoBehaviour: ...@@ -398,6 +398,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 14f968d942299c84ca786317f6de8274, type: 3} m_Script: {fileID: 11500000, guid: 14f968d942299c84ca786317f6de8274, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
uiManager: {fileID: 394305455}
gamma: 0 gamma: 0
player: {fileID: 739347346} player: {fileID: 739347346}
winstate: 0 winstate: 0
...@@ -1063,7 +1064,7 @@ MonoBehaviour: ...@@ -1063,7 +1064,7 @@ MonoBehaviour:
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
m_Material: {fileID: 0} m_Material: {fileID: 0}
m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1 m_RaycastTarget: 1
m_OnCullStateChanged: m_OnCullStateChanged:
m_PersistentCalls: m_PersistentCalls:
......
fileFormatVersion: 2 fileFormatVersion: 2
guid: 873b374412d1e9f40aa3636ed9e2bdf8 guid: 28d090e32f2ee964db867d683e0efa36
folderAsset: yes folderAsset: yes
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
......
...@@ -2,16 +2,12 @@ ...@@ -2,16 +2,12 @@
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
public class LevelManager : MonoBehaviour public class Level1Manager : LevelManager
{ {
public double gamma;
public PlayerMovement player;
public bool winstate = false;
// Start is called before the first frame update // Start is called before the first frame update
void Start() void Start()
{ {
winstate = false;
} }
// Update is called once per frame // Update is called once per frame
......
fileFormatVersion: 2
guid: 85f33cc515852874d98f6c1e43799fe5
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 863d3674af79b2d428796d1d39759169
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class LevelManager : MonoBehaviour
{
public UIManager uiManager;
public double gamma;
public PlayerMovement player;
[SerializeField]
protected bool winstate = false;
// Start is called before the first frame update
void Start()
{
winstate = false;
}
// Update is called once per frame
void Update()
{
if (WinCondition())
{
WinState = true;
}
if (LoseCondition())
{
WinState = false;
}
}
protected virtual void OnWin()
{
uiManager.WinTextOn();
}
protected virtual void OnLose()
{
}
protected virtual bool LoseCondition()
{
return false;
}
protected virtual bool WinCondition()
{
return false;
}
public virtual bool WinState
{
set
{
if (value)
{
//if win
OnWin();
}
else
{
//if lose
OnLose();
}
}
}
}
...@@ -30,7 +30,7 @@ public class Clock : GrabableObject ...@@ -30,7 +30,7 @@ public class Clock : GrabableObject
Debug.Log("hit!"); Debug.Log("hit!");
if (Mathf.Abs((float)(otherclock.GetTime() - time)) <= 1.0f) if (Mathf.Abs((float)(otherclock.GetTime() - time)) <= 1.0f)
{ {
levelManager.winstate = true; levelManager.WinState = true;
} }
else else
{ {
......
...@@ -65,10 +65,6 @@ public class UIManager : MonoBehaviour ...@@ -65,10 +65,6 @@ public class UIManager : MonoBehaviour
mytime.text = levelManager.player.time.ToString() + " s"; mytime.text = levelManager.player.time.ToString() + " s";
//clock1time.text = clock1.GetTime().ToString() + " s"; //clock1time.text = clock1.GetTime().ToString() + " s";
//clock2time.text = clock2.GetTime().ToString() + " s"; //clock2time.text = clock2.GetTime().ToString() + " s";
if (levelManager.winstate)
{
wintext.gameObject.SetActive(true);
}
//마우스 클릭시 //마우스 클릭시
...@@ -180,6 +176,18 @@ public class UIManager : MonoBehaviour ...@@ -180,6 +176,18 @@ public class UIManager : MonoBehaviour
return new Vector3(v.x, v.z, 0.0f); return new Vector3(v.x, v.z, 0.0f);
} }
public void WinTextOn()
{
wintext.gameObject.SetActive(true);
wintext.GetComponent<Text>().text = "Clear!";
}
public void LoseTextOn()
{
wintext.gameObject.SetActive(true);
wintext.GetComponent<Text>().text = "Lose";
}
private void updatePathInfo(int pathNum) private void updatePathInfo(int pathNum)
{ {
pathName.text = "Path - " + pathNum; pathName.text = "Path - " + pathNum;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment