Skip to content

Commit

Permalink
bugfix: 게임 종료시 기존 UI 제거 & Roar 적중 시 쿨타임 감소 & Cursed Howl 사용 시 침식 즉시 적용 (
Browse files Browse the repository at this point in the history
  • Loading branch information
scarleter99 committed May 12, 2024
1 parent 8757194 commit 1c20a00
Show file tree
Hide file tree
Showing 9 changed files with 43 additions and 69 deletions.
13 changes: 6 additions & 7 deletions Client/Assets/Scripts/Contents/Map/Sector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,18 +62,17 @@ public void OnCreatureExit(Creature creature)
creature.Rpc_SetErosion(false);
}

public void GetErosion()
[Rpc(RpcSources.All, RpcTargets.StateAuthority)]
public void Rpc_GetErosion()
{
Rpc_GetErosion();
IsErosion = true;

if (MyCreatureIn)
Managers.ObjectMng.MyCreature.Rpc_SetErosion(true);
Rpc_GetErosionAll();
}

[Rpc(RpcSources.All, RpcTargets.StateAuthority)]
public void Rpc_GetErosion()
[Rpc(RpcSources.StateAuthority, RpcTargets.All)]
public void Rpc_GetErosionAll()
{
IsErosion = true;
if (MyCreatureIn)
Managers.ObjectMng.MyCreature.Rpc_SetErosion(true);
}
Expand Down
4 changes: 2 additions & 2 deletions Client/Assets/Scripts/Contents/Skills/CursedHowl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ protected override IEnumerator ProgressSkill()
PlayAnim(false);
PlaySound();

Managers.GameMng.MapSystem.Sectors[Owner.CurrentSector].Rpc_GetErosion();

while (CurrentSkillAmount < SkillData.TotalSkillAmount)
{
Managers.GameMng.MapSystem.Sectors[Owner.CurrentSector].GetErosion();

UpdateWorkAmount();
yield return null;
}
Expand Down
2 changes: 1 addition & 1 deletion Client/Assets/Scripts/Contents/Skills/Roar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ protected override IEnumerator ProgressSkill()
IsHit = true;
crew.Rpc_OnDamaged(SkillData.Damage);
crew.Rpc_OnSanityDamaged(SkillData.SanityDamage);
Owner.SkillController.Skills[3].CurrentCoolTime -= 20f;
Owner.SkillController.Skills[2].CurrentCoolTime -= 20f;
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion Client/Assets/Scripts/Creatures/Alien.cs
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,8 @@ public void OnGameEnd()
AlienSoundController.StopAllSound();
AlienSoundController.PlayEndGame();

AlienIngameUI.UIGameClear();
AlienIngameUI.HideUI();
AlienIngameUI.EndGame();

Rpc_OnGameEnd();
}
Expand Down
2 changes: 1 addition & 1 deletion Client/Assets/Scripts/Creatures/Crew.cs
Original file line number Diff line number Diff line change
Expand Up @@ -326,8 +326,8 @@ public void OnWin()
CrewSoundController.StopAllSound();
CrewSoundController.PlayEndGame();

CrewIngameUI.HideUI();
Managers.GameMng.GameEndSystem.EndCrewGame(true);
CrewIngameUI.HideUI();
CrewIngameUI.EndGame();

Rpc_OnWin();
Expand Down
12 changes: 6 additions & 6 deletions Client/Assets/Scripts/Systems/GameEndSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,6 @@ public void Init()
Managers.GameMng.GameEndSystem = this;
}

private void ShowCursor()
{
Cursor.lockState = CursorLockMode.None;
Cursor.visible = true;
}

public void EndCrewGame(bool isWin)
{
ShowCursor();
Expand Down Expand Up @@ -82,4 +76,10 @@ public void Rpc_EndCrewGame(NetworkBool isWin)

CrewNum--;
}

private void ShowCursor()
{
Cursor.lockState = CursorLockMode.None;
Cursor.visible = true;
}
}
28 changes: 5 additions & 23 deletions Client/Assets/Scripts/UI/Scene/UI_AlienIngame.cs
Original file line number Diff line number Diff line change
@@ -1,26 +1,20 @@
using System;
using System.Collections;
using UnityEngine.UI;
using TMPro;
using UnityEngine;

public class UI_AlienIngame : UI_Ingame
{
public UI_AlienSkill UI_AlienSkill { get; private set; }//
public UI_AlienSkill UI_AlienSkill { get; private set; }

private Alien Alien {
get => Creature as Alien;
set => Creature = value;
}

public Canvas Canvas;
public Camera camera;

enum AlienSubItemUIs
{
UI_AlienSkill,//
}


public override bool Init()
{
if (base.Init() == false) { return false; }
Expand All @@ -41,21 +35,9 @@ public override void InitAfterNetworkSpawn(Creature creature)
(Get<UI_Base>(Enum.GetNames(typeof(SubItemUIs)).Length + (int)AlienSubItemUIs.UI_AlienSkill) as UI_AlienSkill).Alien = Alien;
}

public void UIGameClear()
public void HideUI()
{
Canvas.renderMode = RenderMode.ScreenSpaceCamera;
Transform[] children = gameObject.GetComponentsInChildren<Transform>();

// 자식 객체들 중에서 Camera 컴포넌트를 가진 객체 찾기
foreach (Transform child in children)
{
// 자식 객체가 Camera 컴포넌트를 가지고 있는지 확인
Camera childCamera = child.GetComponent<Camera>();
if (childCamera != null)
{
camera = childCamera;
}
}
Canvas.worldCamera = camera;
UI_AlienSkill.gameObject.SetActive(false);
CurrentSectorUI.gameObject.SetActive(false);
}
}
24 changes: 0 additions & 24 deletions Client/Assets/Scripts/UI/Scene/UI_CrewIngame.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
using System;
using System.Collections;
using UnityEngine.UI;
using TMPro;
using UnityEngine;

public class UI_CrewIngame : UI_Ingame
Expand All @@ -13,9 +10,6 @@ public class UI_CrewIngame : UI_Ingame

public UI_CrewWin UICrewWin { get; private set; }

public Canvas Canvas;
public Camera camera;

private Crew Crew {
get => Creature as Crew;
set => Creature = value;
Expand Down Expand Up @@ -64,22 +58,4 @@ public void HideUI()
CrewStaminaUI.gameObject.SetActive(false);
CurrentSectorUI.gameObject.SetActive(false);
}

public void EndGame()
{
Canvas.renderMode = RenderMode.ScreenSpaceCamera;
Transform[] children = gameObject.GetComponentsInChildren<Transform>();

// 자식 객체들 중에서 Camera 컴포넌트를 가진 객체 찾기
foreach (Transform child in children)
{
// 자식 객체가 Camera 컴포넌트를 가지고 있는지 확인
Camera childCamera = child.GetComponent<Camera>();
if (childCamera != null)
{
camera = childCamera;
}
}
Canvas.worldCamera = camera;
}
}
24 changes: 20 additions & 4 deletions Client/Assets/Scripts/UI/Scene/UI_Ingame.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
using UnityEngine.UI;

public class UI_Ingame : UI_Scene
{
Expand All @@ -12,6 +8,9 @@ public class UI_Ingame : UI_Scene
public UI_ErrorText ErrorTextUI { get; private set; }
public UI_CurrentSector CurrentSectorUI { get; private set; }

public Canvas Canvas { get; protected set; }
public Camera Camera { get; protected set; }

protected enum SubItemUIs
{
UI_WorkProgressBar,
Expand Down Expand Up @@ -39,4 +38,21 @@ public virtual void InitAfterNetworkSpawn(Creature creature)
Creature = creature;
}

public void EndGame()
{
Canvas.renderMode = RenderMode.ScreenSpaceCamera;
Transform[] children = gameObject.GetComponentsInChildren<Transform>();

// 자식 객체들 중에서 Camera 컴포넌트를 가진 객체 찾기
foreach (Transform child in children)
{
// 자식 객체가 Camera 컴포넌트를 가지고 있는지 확인
Camera childCamera = child.GetComponent<Camera>();
if (childCamera != null)
{
Camera = childCamera;
}
}
Canvas.worldCamera = Camera;
}
}

0 comments on commit 1c20a00

Please sign in to comment.