Merge remote-tracking branch 'origin/develop' into develop

This commit is contained in:
IDMhan 2024-04-02 11:25:15 +09:00
commit f7560740a7
19 changed files with 34219 additions and 16559 deletions

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: e017f8a5de0968e419c32487a4669f2c
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: d89e3b89ea07ecd4185fb2c88d31e698
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,42 @@
using Sirenix.OdinInspector;
using UnityEngine;
// ReSharper disable once CheckNamespace
namespace BlueWaterProject
{
public class CombatAnimator : MonoBehaviour
{
[Required] public Animator animator;
private static readonly int IsMovingHash = Animator.StringToHash("isMoving");
private static readonly int XDirectionHash = Animator.StringToHash("xDirection");
private static readonly int ZDirectionHash = Animator.StringToHash("zDirection");
private static readonly int IsDashingHash = Animator.StringToHash("isDashing");
[Button("셋팅 초기화")]
private void InitSetting()
{
animator = GetComponentInChildren<Animator>();
}
public void SetIsMoving(bool value)
{
animator.SetBool(IsMovingHash, value);
}
public void SetXDirection(float value)
{
animator.SetFloat(XDirectionHash, value);
}
public void SetZDirection(float value)
{
animator.SetFloat(ZDirectionHash, value);
}
public void SetIsDash(bool value)
{
animator.SetBool(IsDashingHash, value);
}
}
}

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 032fb61259732644993e9ef0f4b7eb7c

View File

@ -0,0 +1,53 @@
using Sirenix.OdinInspector;
using UnityEngine;
using UnityEngine.InputSystem;
// ReSharper disable once CheckNamespace
namespace BlueWaterProject
{
public class CombatInput : MonoBehaviour
{
[Required] public PlayerInput playerInput;
public delegate void MoveInput(Vector2 movementInput);
public event MoveInput OnMoveInputReceived;
public delegate void DashInput();
public event DashInput OnDashInputReceived;
public delegate void AttackInput(InputAction.CallbackContext context);
public event AttackInput OnAttackInputReceived;
private void OnEnable()
{
playerInput.actions.FindAction("Attack").performed += OnAttackEvent;
}
private void OnDisable()
{
playerInput.actions.FindAction("Attack").performed -= OnAttackEvent;
}
[Button("셋팅 초기화")]
private void InitSetting()
{
playerInput = GetComponent<PlayerInput>();
}
private void OnMove(InputValue value)
{
var movementInput = value.Get<Vector2>();
OnMoveInputReceived?.Invoke(movementInput);
}
private void OnDash()
{
OnDashInputReceived?.Invoke();
}
private void OnAttackEvent(InputAction.CallbackContext context)
{
OnAttackInputReceived?.Invoke(context);
}
}
}

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 4f5c3b32dc7f64e43a9cd93b4ef9a424

View File

@ -0,0 +1,144 @@
using System.Collections;
using Sirenix.OdinInspector;
using UnityEngine;
// ReSharper disable once CheckNamespace
namespace BlueWaterProject
{
public class CombatMovement : MonoBehaviour
{
[SerializeField] private Rigidbody rb;
[SerializeField] private Transform visualLook;
[HideInInspector] public CombatAnimator combatAnimator;
[Range(1f, 10f), Tooltip("이동 속도")]
[SerializeField] private float moveSpeed = 7f;
// Dash
[Range(1f, 50f), Tooltip("대쉬 속도")]
[SerializeField] private float dashSpeed = 20f;
[Range(0.1f, 1f), Tooltip("대쉬 시간")]
[SerializeField] private float dashTime = 0.2f;
[Range(0f, 5f), Tooltip("대쉬 쿨타임")]
[SerializeField] private float dashCooldown = 0.5f;
// Ground
[Range(0.1f, 10.0f), Tooltip("지면 감지 거리")]
[SerializeField] private float groundCheckDistance = 2.0f;
[SerializeField] private LayerMask groundLayer;
private Animator Animator => combatAnimator.animator;
private Vector3 currentMoveDirection;
private Vector3 previousMoveDirection = Vector3.back;
private float finalSpeed;
private bool isMoving;
private bool enableDash = true;
private bool isDashing;
private void Update()
{
MoveAnimation();
FlipVisualLook();
}
private void FixedUpdate()
{
//CheckGround();
if (isDashing) return;
var finalVelocity = rb.position + currentMoveDirection * (moveSpeed * Time.fixedDeltaTime);
rb.MovePosition(finalVelocity);
}
[Button("셋팅 초기화")]
private void InitSetting()
{
rb = GetComponent<Rigidbody>();
visualLook = GetComponentInChildren<Transform>();
}
public void InputMovementValue(Vector2 movementInput)
{
currentMoveDirection = new Vector3(movementInput.x, 0, movementInput.y).normalized;
if (currentMoveDirection != Vector3.zero)
{
previousMoveDirection = currentMoveDirection;
}
isMoving = currentMoveDirection != Vector3.zero;
}
public void HandleDash()
{
if (!enableDash || isDashing) return;
StartCoroutine(nameof(DashCoroutine));
}
private IEnumerator DashCoroutine()
{
var dashDirection = previousMoveDirection;
isDashing = true;
enableDash = false;
combatAnimator.SetIsDash(true);
var elapsedTime = 0f;
while (!Animator.GetCurrentAnimatorStateInfo(0).IsName("DashState"))
{
elapsedTime += Time.deltaTime;
if (elapsedTime >= 1f)
{
yield break;
}
yield return null;
}
var animationLength = Animator.GetCurrentAnimatorStateInfo(0).length;
Animator.speed = animationLength / dashTime;
while (Animator.GetCurrentAnimatorStateInfo(0).IsName("DashState") &&
Animator.GetCurrentAnimatorStateInfo(0).normalizedTime < 1f)
{
var finalVelocity = rb.position + dashDirection * (dashSpeed * Time.fixedDeltaTime);
rb.MovePosition(finalVelocity);
yield return null;
}
Animator.speed = 1f;
isDashing = false;
combatAnimator.SetIsDash(false);
StartCoroutine(Utils.CoolDown(dashCooldown, () => enableDash = true));
}
private void MoveAnimation()
{
combatAnimator.SetIsMoving(isMoving);
if (isMoving)
{
combatAnimator.SetXDirection(previousMoveDirection.x);
combatAnimator.SetZDirection(previousMoveDirection.z);
}
}
private void FlipVisualLook()
{
var localScale = visualLook.localScale;
localScale.x = previousMoveDirection.x switch
{
> 0.01f => Mathf.Abs(localScale.x),
< -0.01f => -Mathf.Abs(localScale.x),
_ => localScale.x
};
visualLook.localScale = localScale;
}
}
}

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 58af0a680d0fc284ab994540f528bc38

View File

@ -0,0 +1,39 @@
using Sirenix.OdinInspector;
using UnityEngine;
// ReSharper disable once CheckNamespace
namespace BlueWaterProject
{
public class CombatPlayer : MonoBehaviour
{
[Required, SerializeField] private CombatInput input;
[Required, SerializeField] private CombatMovement movement;
[Required, SerializeField] private CombatAnimator animator;
private void Awake()
{
movement.combatAnimator = animator;
}
private void OnEnable()
{
input.OnMoveInputReceived += movement.InputMovementValue;
input.OnDashInputReceived += movement.HandleDash;
}
private void OnDisable()
{
input.OnMoveInputReceived -= movement.InputMovementValue;
input.OnDashInputReceived -= movement.HandleDash;
}
[Button("셋팅 초기화")]
private void InitSetting()
{
input = GetComponent<CombatInput>();
movement = GetComponent<CombatMovement>();
animator = GetComponent<CombatAnimator>();
}
}
}

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 5d45fd63a2acdca489edd72c7796e8b9

View File

@ -19,7 +19,7 @@ namespace BlueWaterProject
FOG
}
public class CozyController : MonoBehaviour
public class CozyManager : Singleton<CozyManager>
{
/***********************************************************************
* Definitions
@ -92,6 +92,8 @@ namespace BlueWaterProject
[SerializeField] private float changeWeatherTime;
public WeatherInfo CurrentWeatherInfo => weatherInfoList[0];
public WeatherType CurrentWeatherType => weatherInfoList[0].WeatherType;
public MeridiemTime CurrentTime => CozyWeather.instance.timeModule.currentTime;
private float totalRatio;
@ -143,7 +145,7 @@ namespace BlueWaterProject
#region Methods
[Button("날짜 변경")]
public void SetCurrentDat(int day) => CozyWeather.instance.timeModule.currentDay = day;
public void SetCurrentDay(int day) => CozyWeather.instance.timeModule.currentDay = day;
[Button("현재 시간 변경")]
public void SetCurrentTime(int hour, int minute)
@ -220,8 +222,6 @@ namespace BlueWaterProject
return defaultWeatherInfo;
}
public WeatherType GetCurrentWeatherType() => weatherInfoList[0].WeatherType;
#endregion
}
}

View File

@ -1,4 +1,3 @@
using System;
using System.Collections;
using DistantLands.Cozy;
using TMPro;
@ -16,7 +15,6 @@ namespace BlueWaterProject
[field: SerializeField] public Image WeatherIcon { get; set; }
[SerializeField] private float updateTime = 1f;
[SerializeField] private CozyController cozyController;
private void Start()
{
@ -29,7 +27,7 @@ namespace BlueWaterProject
{
Date.text = CozyWeather.instance.timeModule.currentDay + " Days";
Time.text = CozyWeather.instance.timeModule.currentTime.ToString();
WeatherIcon.sprite = cozyController.CurrentWeatherInfo.Sprite;
WeatherIcon.sprite = CozyManager.Inst.CurrentWeatherInfo.Sprite;
yield return new WaitForSeconds(updateTime);
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: be1d50d0f9a83864698b17f9e155db2d
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: adab498215cbf694492ab8263e3f4a31
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 9100000
userData:
assetBundleName:
assetBundleVariant: