Merge branch 'dev' of https://github.com/2aurore/Gameton-06 into dev
This commit is contained in:
35
Gameton-06/Assets/Gameton/Scripts/Monster/MonsterControl.cs
Normal file
35
Gameton-06/Assets/Gameton/Scripts/Monster/MonsterControl.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Numerics;
|
||||
using UnityEngine;
|
||||
|
||||
namespace TON
|
||||
{
|
||||
public class MonsterControl : MonoBehaviour
|
||||
{
|
||||
public float speed = 2;
|
||||
|
||||
GameObject target;
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
target = GameObject.FindGameObjectWithTag("Player");
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void FixedUpdate()
|
||||
{
|
||||
// 타겟의 위치에서 내 현제 위치를 뺌
|
||||
UnityEngine.Vector2 direction = target.transform.position - transform.position;
|
||||
|
||||
// 방향 * 속도 * 시간간격
|
||||
transform.Translate(direction.normalized * speed * Time.deltaTime);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d5b05a0586cd17f47a3c35acaac06e0f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -34,13 +34,8 @@ namespace TON
|
||||
{
|
||||
UIManager.Show<PauseUI>(UIList.PauseUI);
|
||||
|
||||
Debug.Log("버튼 클릭");
|
||||
|
||||
// UIManager.Show<PauseUI>(UIList.PauseUI);
|
||||
|
||||
|
||||
// 게임 일시 정지
|
||||
// Time.timeScale = 0f;
|
||||
Time.timeScale = 0f;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -7,6 +7,13 @@ namespace TON
|
||||
{
|
||||
public class PauseUI : UIBase
|
||||
{
|
||||
|
||||
// 컨티뉴 버튼 선택 시
|
||||
public void OnPressContinueButton()
|
||||
{
|
||||
// UI 숨김
|
||||
UIManager.Hide<PauseUI>(UIList.PauseUI);
|
||||
// 게임 재생
|
||||
Time.timeScale = 1f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user