Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fix] 일시정지 관련 버그 일부 해결 #165

Merged
merged 12 commits into from
Nov 28, 2024
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Assets/Scenes/PrisonScene.unity
Original file line number Diff line number Diff line change
Expand Up @@ -646,6 +646,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
stageManager: {fileID: 33556873}
goalZone: {fileID: 0}
tutorialPanel: {fileID: 2146890594}
pausePanel: {fileID: 1041156427}
pauseTextPanel: {fileID: 664677909}
Expand Down Expand Up @@ -2393,7 +2394,7 @@ MonoBehaviour:
player1InZone: 0
player2InZone: 0
stageManager: {fileID: 33556873}
stageClear: 1
stageClear: 0
MapClearPanel: {fileID: 1376517036}
clearTimeText: {fileID: 619571448}
--- !u!61 &513861989
Expand Down
32 changes: 32 additions & 0 deletions Assets/Scenes/RoomScene.unity
Original file line number Diff line number Diff line change
Expand Up @@ -2507,6 +2507,37 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1956269872}
m_CullTransparentMesh: 1
--- !u!1 &2031633104
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2031633106}
m_Layer: 0
m_Name: RoomUIManager
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &2031633106
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2031633104}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 921.40106, y: 445.11484, z: -6.1936984}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1660057539 &9223372036854775807
SceneRoots:
m_ObjectHideFlags: 0
Expand All @@ -2515,3 +2546,4 @@ SceneRoots:
- {fileID: 1222379148}
- {fileID: 1276365108}
- {fileID: 1710354787}
- {fileID: 2031633106}
16 changes: 15 additions & 1 deletion Assets/Script/PlayerManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,17 @@ void Start()
void Update()
{
// 원격 플레이어일 경우 위치 및 방향 데이터를 수신하지 않음
if(!photonView.IsMine || !canMove)
if(!photonView.IsMine)
{
return;
}
// 움직일 수 없는 상태일 때, 애니메이션 속도 0으로 초기화
if(!canMove)
{
inputVec = Vector2.zero;
anim.SetFloat("Speed", 0);
return;
}

inputVec.x = Input.GetAxisRaw("Player1HorizontalKey");
inputVec.y = Input.GetAxisRaw("Player1VerticalKey");
Expand All @@ -88,6 +95,13 @@ void FixedUpdate()
{
if (!photonView.IsMine) return;

// 움직일 수 없는 상태일 때, 이동속도를 0으로 초기화
if (!canMove)
{
rigid.velocity = Vector2.zero;
return;
}

Vector2 nextVec = inputVec.normalized * speed * Time.fixedDeltaTime;
rigid.MovePosition(rigid.position + nextVec);
}
Expand Down
9 changes: 7 additions & 2 deletions Assets/Script/UIManager/PrisonUIManager.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using UnityEngine;
using UnityEngine.SceneManagement;
using Photon.Pun;
using System.Collections;

Expand All @@ -8,6 +7,8 @@ public class PrisonUIManager : MonoBehaviour
public StageManager stageManager;
private PhotonView photonView;

public GoalZoneScript goalZone;

public GameObject tutorialPanel;
public GameObject pausePanel;
public GameObject pauseTextPanel;
Expand All @@ -20,6 +21,7 @@ public class PrisonUIManager : MonoBehaviour
private void Start()
{
stageManager = FindObjectOfType<StageManager>();
goalZone = FindAnyObjectByType<GoalZoneScript>();
photonView = GetComponent<PhotonView>();
tutorialPanel.SetActive(tutorialPanelOpen);
}
Expand Down Expand Up @@ -94,7 +96,10 @@ public void ClosePausePanel()
[PunRPC]
void UpdatePauseState(int actorNumber, bool pauseState)
{
if (!goalZone.stageClear)
{
isPaused = pauseState;
if (!goalZone.stageClear && pauseState)
PauseManager.Instance.isPaused = pauseState;
if (pauseState)
{
Expand Down Expand Up @@ -122,7 +127,7 @@ void UpdatePauseState(int actorNumber, bool pauseState)
pauseTextPanel.gameObject.SetActive(false);
}
StartCoroutine(ResetTransitionState());

}
}
private IEnumerator ResetTransitionState()
{
Expand Down