TimeScale 기능 VisualFeedbackManager로 이동

+ 전투 맵 수정
+ CombatPlayer MainSkillUi 초기화 오류 수정
+ 메뉴UI Close버튼 미작동 수정
+ HitStop과 SlowMotion 겹치는 문제 수정
This commit is contained in:
NTG 2024-05-13 16:21:45 +09:00
parent 6d72198a34
commit 498162d4a8
11 changed files with 21920 additions and 899 deletions

File diff suppressed because it is too large Load Diff

View File

@ -51,6 +51,7 @@ namespace BlueWaterProject
var targetLayer = iMeleeComboAttackable.TargetLayer;
var ui = CombatUiManager.Inst.MainSkillUi;
ui.ResetSkillUi();
ui.gameObject.SetActive(true);
instantiateMainSkill.SkillInputData.InitInputData(transform, col, rb, null, visualLook, anim, null, targetLayer, ui);

View File

@ -147,10 +147,10 @@ namespace BlueWaterProject
case SaveStage.TUTORIAL:
break;
case SaveStage.SLIME:
FindAnyObjectByType<SlimeBossMapController>().InitBossMap();
FindAnyObjectByType<SlimeBossMapController>()?.InitBossMap();
break;
case SaveStage.RHINOCEROS:
FindAnyObjectByType<RhinocerosBossMapController>().InitBossMap();
FindAnyObjectByType<RhinocerosBossMapController>()?.InitBossMap();
break;
default:
throw new ArgumentOutOfRangeException();

View File

@ -1,5 +1,4 @@
using System;
using System.Collections;
using Sirenix.OdinInspector;
using UnityEngine;
@ -23,13 +22,6 @@ namespace BlueWaterProject
public bool IsBuildMode { get; set; }
[field: SerializeField] public bool IsOnFollowCamera { get; set; }
// Game Data
[Title("Game Data")]
[Range(0f, 1f)]
[SerializeField] private float slowSpeed = 0.1f;
private const string IN_ISLAND_PLAYER_NAME = "InIslandPlayer";
private void Init()
{
TycoonPlayer = FindAnyObjectByType<TycoonPlayer>();
@ -44,57 +36,6 @@ namespace BlueWaterProject
{
Cursor.lockState = CursorLockMode.Confined;
}
public IEnumerator ApplySlowMotion(float targetTimeScale, float duration)
{
var startScale = Time.timeScale;
var time = 0f;
while (time < duration)
{
Time.timeScale = Mathf.Lerp(startScale, targetTimeScale, time / duration);
Time.fixedDeltaTime = 0.02f * Time.timeScale;
time += Time.unscaledDeltaTime;
yield return null;
}
Time.timeScale = targetTimeScale;
}
public void SlowSpeedMode()
{
Time.timeScale = slowSpeed;
Time.fixedDeltaTime = 0.02f * Time.timeScale;
}
public void DefaultSpeedMode()
{
Time.timeScale = 1f;
Time.fixedDeltaTime = 0.02f;
}
public void SetCurrentInIslandPlayer(IInIslandPlayer inIslandPlayer)
{
// PlayerInput currentPlayerInput;
//
// if (CurrentInIslandPlayer != null)
// {
// currentPlayerInput = CurrentInIslandPlayer.Transform.GetComponent<PlayerInput>();
// if (currentPlayerInput != null)
// {
// currentPlayerInput.enabled = false;
// }
// }
//
// CurrentInIslandPlayer = inIslandPlayer;
// InIslandCamera.Inst.SetTarget(inIslandPlayer.Transform);
//
// currentPlayerInput = CurrentInIslandPlayer.Transform.GetComponent<PlayerInput>();
// if (currentPlayerInput != null)
// {
// currentPlayerInput.enabled = true;
// }
}
public void InstantiateCombatPlayer(Vector3 position, Quaternion rotation = default)
{

View File

@ -9,7 +9,7 @@ namespace BlueWaterProject
{
base.Close();
FindAnyObjectByType<PlayerInput>().SwitchCurrentActionMap(CombatInput.COMBAT);
FindAnyObjectByType<PlayerInput>()?.SwitchCurrentActionMap(CombatInput.COMBAT);
}
protected override void InitAndUpdateInventory()

View File

@ -9,7 +9,7 @@ namespace BlueWaterProject
{
base.Close();
FindAnyObjectByType<PlayerInput>().SwitchCurrentActionMap(ShipPlayer.OCEAN);
FindAnyObjectByType<PlayerInput>()?.SwitchCurrentActionMap(ShipPlayer.OCEAN);
}
protected override void InitAndUpdateInventory()

View File

@ -49,7 +49,7 @@ public class SlimeBossMapController : BossMapController
private IEnumerator DieRabbitCoroutine()
{
GameManager.Inst.SlowSpeedMode();
VisualFeedbackManager.Inst.SetBaseTimeScale(0.1f);
AllDestroyBoss();
CombatUiManager.Inst.FadeInOut();
@ -59,7 +59,7 @@ public class SlimeBossMapController : BossMapController
elapsedTime += Time.unscaledDeltaTime;
yield return null;
}
GameManager.Inst.DefaultSpeedMode();
VisualFeedbackManager.Inst.SetBaseTimeScale(1f);
elapsedTime = 0f;
while (elapsedTime <= 2f)

View File

@ -11,7 +11,7 @@ namespace BlueWaterProject
if (!CombatUiManager.Inst.IsPopupListEmpty()) return;
FindAnyObjectByType<PlayerInput>().SwitchCurrentActionMap(CombatInput.COMBAT);
FindAnyObjectByType<PlayerInput>()?.SwitchCurrentActionMap(CombatInput.COMBAT);
}
}
}

View File

@ -15,17 +15,19 @@ namespace BlueWaterProject
[field: SerializeField] public Image Fill { get; set; }
[field: SerializeField] public UIView Fade { get; set; }
public void Cooldown(float waitTime)
{
StartCoroutine(CooldownCoroutine(waitTime));
}
private Coroutine cooldownCoroutine;
private void Start()
{
Fill.fillAmount = 0f;
}
public void Cooldown(float waitTime)
{
cooldownCoroutine = StartCoroutine(CooldownCoroutine(waitTime));
}
public IEnumerator CooldownCoroutine(float waitTime)
private IEnumerator CooldownCoroutine(float waitTime)
{
Fill.fillAmount = 1f;
@ -37,5 +39,16 @@ namespace BlueWaterProject
Fade.Show();
}
public void ResetSkillUi()
{
if (cooldownCoroutine != null)
{
StopCoroutine(cooldownCoroutine);
cooldownCoroutine = null;
}
Fill.fillAmount = 0f;
}
}
}

View File

@ -9,6 +9,34 @@ namespace BlueWaterProject
{
public class VisualFeedbackManager : Singleton<VisualFeedbackManager>
{
private float baseTimeScale = 1f;
private float currentHitStopCoefficient = 1f;
public void SetBaseTimeScale(float value)
{
baseTimeScale = value;
UpdateTimeScale();
}
public void SetHitStop(float value)
{
currentHitStopCoefficient = value;
UpdateTimeScale();
}
public void ResetTimeScale()
{
baseTimeScale = 1f;
currentHitStopCoefficient = 1f;
UpdateTimeScale();
}
private void UpdateTimeScale()
{
Time.timeScale = baseTimeScale * currentHitStopCoefficient;
Time.fixedDeltaTime = Time.timeScale * 0.02f;
}
#region HitStop
/// <summary>
@ -22,10 +50,9 @@ namespace BlueWaterProject
private IEnumerator HitStopCoroutine(float duration)
{
var originalTimeScale = 1;
Time.timeScale = 0.05f;
SetHitStop(0.05f);
yield return new WaitForSecondsRealtime(duration);
Time.timeScale = originalTimeScale;
SetHitStop(1f);
}
#endregion

View File

@ -108,6 +108,37 @@ MeshCollider:
m_Convex: 0
m_CookingOptions: 30
m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0}
--- !u!1 &1160217028477158790
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 3528589141546779327}
m_Layer: 0
m_Name: Lights
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &3528589141546779327
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1160217028477158790}
serializedVersion: 2
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 7580754897896246193}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1393939264629856146
GameObject:
m_ObjectHideFlags: 0
@ -621,6 +652,38 @@ Transform:
m_Children: []
m_Father: {fileID: 665791185885374265}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &5568453933648760757
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 7798505859049167048}
m_Layer: 0
m_Name: GroundFogs
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &7798505859049167048
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5568453933648760757}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 7639058301001315723}
m_Father: {fileID: 7580754897896246193}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &5654157948257255679
GameObject:
m_ObjectHideFlags: 0
@ -748,7 +811,7 @@ Transform:
m_LocalScale: {x: 5, y: 1, z: 5}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 7580754897896246193}
m_Father: {fileID: 7798505859049167048}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!33 &1170900988332598305
MeshFilter:
@ -855,11 +918,12 @@ Transform:
m_Children:
- {fileID: 2986811746704976679}
- {fileID: 665791185885374265}
- {fileID: 7798505859049167048}
- {fileID: 3528589141546779327}
- {fileID: 7778690860228022480}
- {fileID: 5483604360458066655}
- {fileID: 8874040642671342955}
- {fileID: 5292453453235858255}
- {fileID: 7639058301001315723}
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &9198442223207540368