Closes #207 전투 플레이어 스턴 효과 추가

+ IStun 인터페이스 추가
+ 전투 플레이어 Stun 파티클 추가
+ 코뿔소 JumpSmash 스턴 변경에 따른 로직 변경
+ EarthquakeWave, LineRush material 수정(라인 변경)
This commit is contained in:
NTG 2024-02-16 17:12:48 +09:00
parent 93d76ea1d4
commit 6bbf6b2b86
9 changed files with 9826 additions and 31 deletions

View File

@ -7,7 +7,7 @@ using UnityEngine.InputSystem;
// ReSharper disable once CheckNamespace
namespace BlueWaterProject
{
public class PhysicsMovement : MonoBehaviour
public class PhysicsMovement : MonoBehaviour, IStun
{
/***********************************************************************
* Definitions
@ -73,7 +73,7 @@ namespace BlueWaterProject
public bool isOutOfControl;
public bool isDashing;
public bool enableDash = true;
public bool IsStunned { get; set; }
public bool isStunned;
}
[Serializable]
@ -111,7 +111,15 @@ namespace BlueWaterProject
[field: SerializeField] public MovementOption MyMovementOption { get; private set; } = new();
[field: SerializeField] public CurrentState MyCurrentState { get; set; } = new();
[field: SerializeField] public CurrentValue MyCurrentValue { get; set; } = new();
[Title("효과")]
[SerializeField] private ParticleSystem stunParticle;
public bool IsStunned
{
get => MyCurrentState.isStunned;
set => MyCurrentState.isStunned = value;
}
private float capsuleRadiusDifferent;
private float castRadius;
@ -141,7 +149,7 @@ namespace BlueWaterProject
private void FixedUpdate()
{
if (!MyCurrentState.enableMoving || MyCurrentState.IsStunned) return;
if (!MyCurrentState.enableMoving || IsStunned) return;
InputMove();
CheckGround();
@ -166,7 +174,6 @@ namespace BlueWaterProject
if (TryGetComponent(out MyComponents.rb)) return;
MyComponents.rb = gameObject.AddComponent<Rigidbody>();
MyComponents.rb.constraints = RigidbodyConstraints.FreezeRotation;
MyComponents.rb.interpolation = RigidbodyInterpolation.Interpolate;
MyComponents.rb.collisionDetectionMode = CollisionDetectionMode.ContinuousDynamic;
@ -192,6 +199,40 @@ namespace BlueWaterProject
private void InitStartValue()
{
MyCurrentValue.gravity = Physics.gravity;
if (stunParticle)
{
stunParticle.Stop();
}
}
#endregion
/***********************************************************************
* Interfaces
***********************************************************************/
#region Interfaces
public void Stun(float stunTime)
{
if (MyCurrentState.isDashing) return;
IsStunned = true;
if (stunParticle)
{
stunParticle.Play();
}
StartCoroutine(Utils.CoolDown(stunTime, StopStun));
}
private void StopStun()
{
if (stunParticle)
{
stunParticle.Stop();
}
IsStunned = false;
}
#endregion
@ -389,7 +430,7 @@ namespace BlueWaterProject
public void MoveToCurrentDirection(float speed)
{
var finalVelocity = MyComponents.rb.position + MyCurrentValue.previousMoveDirection * speed * Time.fixedDeltaTime;
var finalVelocity = MyComponents.rb.position + MyCurrentValue.previousMoveDirection * (speed * Time.fixedDeltaTime);
MyComponents.rb.MovePosition(finalVelocity);
// var finalVelocity = MyCurrentValue.previousMoveDirection * speed;

View File

@ -0,0 +1,9 @@
// ReSharper disable once CheckNamespace
namespace BlueWaterProject
{
public interface IStun
{
bool IsStunned { get; set; }
void Stun(float stunTime);
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 36bcdf0bca582be42b5ca8e901940eae
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -23,7 +23,7 @@ namespace RhinocerosSkill
{
if (SkillInputData.TargetCollider)
{
SkillInputData.TargetCollider.GetComponent<PhysicsMovement>().MyCurrentState.IsStunned = false;
SkillInputData.TargetCollider.GetComponent<IStun>().IsStunned = true;
}
}
@ -211,11 +211,8 @@ namespace RhinocerosSkill
maxSize = Physics.OverlapSphereNonAlloc(transform.position, Range * 2f, hitColliders, SkillInputData.TargetLayer);
for (var i = 0; i < maxSize; i++)
{
var physicsMovement = hitColliders[i].GetComponent<PhysicsMovement>();
if (physicsMovement != null && !physicsMovement.MyCurrentState.isDashing)
{
StartCoroutine(StunCoroutine(physicsMovement));
}
var iStun = hitColliders[i].GetComponent<IStun>();
iStun?.Stun(stunTime);
}
SkillInputData.PlayerAnimator.SetBool("isJump", false);
@ -223,21 +220,6 @@ namespace RhinocerosSkill
actions[0].Invoke();
}
private IEnumerator StunCoroutine(PhysicsMovement physicsMovement)
{
physicsMovement.MyCurrentState.isMoving = false;
physicsMovement.MyCurrentState.IsStunned = true;
var elapsedTime = 0f;
while (elapsedTime < stunTime)
{
elapsedTime += Time.deltaTime;
yield return null;
}
physicsMovement.MyCurrentState.IsStunned = false;
}
private void IgnoreCollision(bool value)
{

View File

@ -70,11 +70,11 @@ Material:
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _FillMap:
m_Texture: {fileID: 2800000, guid: ea0b0456f57dcfb419cd00341ed9dd42, type: 3}
m_Texture: {fileID: 2800000, guid: 9515963cf5e9c974ca7475bc21224a5e, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _IndicatorMap:
m_Texture: {fileID: 2800000, guid: 5a8997cdbe93eea4c896ab8a804d3e40, type: 3}
m_Texture: {fileID: 2800000, guid: a6151ccb538d4c446868f265c10c2fc5, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:

View File

@ -70,11 +70,11 @@ Material:
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _FillMap:
m_Texture: {fileID: 2800000, guid: ea0b0456f57dcfb419cd00341ed9dd42, type: 3}
m_Texture: {fileID: 2800000, guid: 9515963cf5e9c974ca7475bc21224a5e, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _IndicatorMap:
m_Texture: {fileID: 2800000, guid: 5a8997cdbe93eea4c896ab8a804d3e40, type: 3}
m_Texture: {fileID: 2800000, guid: a6151ccb538d4c446868f265c10c2fc5, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:

View File

@ -316,6 +316,7 @@ MonoBehaviour:
isOutOfControl: 0
isDashing: 0
enableDash: 1
isStunned: 0
<MyCurrentValue>k__BackingField:
movementInput: {x: 0, y: 0}
currentMoveDirection: {x: 0, y: 0, z: 0}
@ -328,6 +329,7 @@ MonoBehaviour:
groundSlopeAngle: 0
forwardSlopeAngle: 0
gravity: {x: 0, y: 0, z: 0}
stunParticle: {fileID: 1597267395097946864}
showGizmos: 1
gizmoRadius: 0.05
showGUI: 1
@ -360,6 +362,87 @@ Transform:
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Children:
- {fileID: 326479083604171915}
m_Father: {fileID: 8934240191915016273}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1001 &3485468299342031378
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
serializedVersion: 3
m_TransformParent: {fileID: 1638774919638391188}
m_Modifications:
- target: {fileID: 3808140985359726233, guid: 14a638ef7385bda42b7f0f8fcc49e55e,
type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3808140985359726233, guid: 14a638ef7385bda42b7f0f8fcc49e55e,
type: 3}
propertyPath: m_LocalPosition.y
value: 2
objectReference: {fileID: 0}
- target: {fileID: 3808140985359726233, guid: 14a638ef7385bda42b7f0f8fcc49e55e,
type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3808140985359726233, guid: 14a638ef7385bda42b7f0f8fcc49e55e,
type: 3}
propertyPath: m_LocalRotation.w
value: 0.7071068
objectReference: {fileID: 0}
- target: {fileID: 3808140985359726233, guid: 14a638ef7385bda42b7f0f8fcc49e55e,
type: 3}
propertyPath: m_LocalRotation.x
value: -0.7071068
objectReference: {fileID: 0}
- target: {fileID: 3808140985359726233, guid: 14a638ef7385bda42b7f0f8fcc49e55e,
type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3808140985359726233, guid: 14a638ef7385bda42b7f0f8fcc49e55e,
type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3808140985359726233, guid: 14a638ef7385bda42b7f0f8fcc49e55e,
type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: -90
objectReference: {fileID: 0}
- target: {fileID: 3808140985359726233, guid: 14a638ef7385bda42b7f0f8fcc49e55e,
type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3808140985359726233, guid: 14a638ef7385bda42b7f0f8fcc49e55e,
type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 9051303996272931366, guid: 14a638ef7385bda42b7f0f8fcc49e55e,
type: 3}
propertyPath: m_Name
value: StunnedCirclingStarsSimple
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 14a638ef7385bda42b7f0f8fcc49e55e, type: 3}
--- !u!4 &326479083604171915 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 3808140985359726233, guid: 14a638ef7385bda42b7f0f8fcc49e55e,
type: 3}
m_PrefabInstance: {fileID: 3485468299342031378}
m_PrefabAsset: {fileID: 0}
--- !u!198 &1597267395097946864 stripped
ParticleSystem:
m_CorrespondingSourceObject: {fileID: 2770976869746131170, guid: 14a638ef7385bda42b7f0f8fcc49e55e,
type: 3}
m_PrefabInstance: {fileID: 3485468299342031378}
m_PrefabAsset: {fileID: 0}

File diff suppressed because it is too large Load Diff

View File

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