캐릭터 기본 공격 영역 로직 적용
This commit is contained in:
@@ -261,7 +261,7 @@ AnimatorState:
|
|||||||
m_MirrorParameterActive: 0
|
m_MirrorParameterActive: 0
|
||||||
m_CycleOffsetParameterActive: 0
|
m_CycleOffsetParameterActive: 0
|
||||||
m_TimeParameterActive: 0
|
m_TimeParameterActive: 0
|
||||||
m_Motion: {fileID: -2764854634736250672, guid: 22f880baebb4a4d4ca00b9173a433eba, type: 3}
|
m_Motion: {fileID: -6901051952506430437, guid: 5dc38d1a1c86c3442b817209ca475d29, type: 3}
|
||||||
m_Tag:
|
m_Tag:
|
||||||
m_SpeedParameter:
|
m_SpeedParameter:
|
||||||
m_MirrorParameter:
|
m_MirrorParameter:
|
||||||
@@ -381,7 +381,7 @@ AnimatorStateTransition:
|
|||||||
m_Mute: 0
|
m_Mute: 0
|
||||||
m_IsExit: 1
|
m_IsExit: 1
|
||||||
serializedVersion: 3
|
serializedVersion: 3
|
||||||
m_TransitionDuration: 0.25
|
m_TransitionDuration: 0
|
||||||
m_TransitionOffset: 0
|
m_TransitionOffset: 0
|
||||||
m_ExitTime: 0.75
|
m_ExitTime: 0.75
|
||||||
m_HasExitTime: 1
|
m_HasExitTime: 1
|
||||||
|
|||||||
@@ -392,7 +392,7 @@ AnimatorStateTransition:
|
|||||||
m_Mute: 0
|
m_Mute: 0
|
||||||
m_IsExit: 1
|
m_IsExit: 1
|
||||||
serializedVersion: 3
|
serializedVersion: 3
|
||||||
m_TransitionDuration: 0.25
|
m_TransitionDuration: 0
|
||||||
m_TransitionOffset: 0
|
m_TransitionOffset: 0
|
||||||
m_ExitTime: 0.5833334
|
m_ExitTime: 0.5833334
|
||||||
m_HasExitTime: 1
|
m_HasExitTime: 1
|
||||||
@@ -435,7 +435,7 @@ AnimatorState:
|
|||||||
m_MirrorParameterActive: 0
|
m_MirrorParameterActive: 0
|
||||||
m_CycleOffsetParameterActive: 0
|
m_CycleOffsetParameterActive: 0
|
||||||
m_TimeParameterActive: 0
|
m_TimeParameterActive: 0
|
||||||
m_Motion: {fileID: 2250759152206282204, guid: 207fabbd0ee40a84f9ae1299da5956b6, type: 3}
|
m_Motion: {fileID: 5466364992665845606, guid: 662c9e15b5ce47443bace93854814010, type: 3}
|
||||||
m_Tag:
|
m_Tag:
|
||||||
m_SpeedParameter:
|
m_SpeedParameter:
|
||||||
m_MirrorParameter:
|
m_MirrorParameter:
|
||||||
|
|||||||
@@ -2,15 +2,14 @@
|
|||||||
"items": [
|
"items": [
|
||||||
{
|
{
|
||||||
"id": 0,
|
"id": 0,
|
||||||
"type": "b",
|
"type": "w",
|
||||||
"name": "blac",
|
"name": "white",
|
||||||
"level": 1,
|
"level": 1,
|
||||||
"experience": 0,
|
"experience": 0,
|
||||||
"hp": 100,
|
"hp": 100,
|
||||||
"mp": 100,
|
"mp": 100,
|
||||||
"attackPower": 50,
|
"attackPower": 50,
|
||||||
"defensivePower": 30,
|
"defensivePower": 30,
|
||||||
"speed": 100,
|
|
||||||
"critical": 30
|
"critical": 30
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -67,6 +67,7 @@ Transform:
|
|||||||
m_ConstrainProportionsScale: 0
|
m_ConstrainProportionsScale: 0
|
||||||
m_Children:
|
m_Children:
|
||||||
- {fileID: 3571909985532505043}
|
- {fileID: 3571909985532505043}
|
||||||
|
- {fileID: 6308497305587874648}
|
||||||
m_Father: {fileID: 0}
|
m_Father: {fileID: 0}
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
--- !u!212 &6967183450965278935
|
--- !u!212 &6967183450965278935
|
||||||
@@ -248,5 +249,86 @@ MonoBehaviour:
|
|||||||
speed: 3
|
speed: 3
|
||||||
jumpForce: 8
|
jumpForce: 8
|
||||||
firePoint: {fileID: 3571909985532505043}
|
firePoint: {fileID: 3571909985532505043}
|
||||||
|
attackCollider: {fileID: 3772826248857896723}
|
||||||
animator: {fileID: 0}
|
animator: {fileID: 0}
|
||||||
rb: {fileID: 4986202531950816680}
|
rb: {fileID: 4986202531950816680}
|
||||||
|
--- !u!1 &6930308287002930140
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 6308497305587874648}
|
||||||
|
- component: {fileID: 4524965013234206620}
|
||||||
|
- component: {fileID: 3772826248857896723}
|
||||||
|
m_Layer: 0
|
||||||
|
m_Name: AttackPoint
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!4 &6308497305587874648
|
||||||
|
Transform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 6930308287002930140}
|
||||||
|
serializedVersion: 2
|
||||||
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
|
m_LocalPosition: {x: 0.107, y: 0.1237, z: 0}
|
||||||
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
|
m_ConstrainProportionsScale: 0
|
||||||
|
m_Children: []
|
||||||
|
m_Father: {fileID: 8528093570479225059}
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
--- !u!58 &4524965013234206620
|
||||||
|
CircleCollider2D:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 6930308287002930140}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_Density: 1
|
||||||
|
m_Material: {fileID: 0}
|
||||||
|
m_IncludeLayers:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Bits: 0
|
||||||
|
m_ExcludeLayers:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Bits: 0
|
||||||
|
m_LayerOverridePriority: 0
|
||||||
|
m_ForceSendLayers:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Bits: 4294967295
|
||||||
|
m_ForceReceiveLayers:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Bits: 4294967295
|
||||||
|
m_ContactCaptureLayers:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Bits: 4294967295
|
||||||
|
m_CallbackLayers:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Bits: 4294967295
|
||||||
|
m_IsTrigger: 1
|
||||||
|
m_UsedByEffector: 0
|
||||||
|
m_UsedByComposite: 0
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Radius: 0.1
|
||||||
|
--- !u!114 &3772826248857896723
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 6930308287002930140}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: c70bfc4e889c3aa40a51378afd6deda8, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ Transform:
|
|||||||
m_ConstrainProportionsScale: 0
|
m_ConstrainProportionsScale: 0
|
||||||
m_Children:
|
m_Children:
|
||||||
- {fileID: 3204799031628172313}
|
- {fileID: 3204799031628172313}
|
||||||
|
- {fileID: 548404723012153258}
|
||||||
m_Father: {fileID: 0}
|
m_Father: {fileID: 0}
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
--- !u!212 &6967183450965278935
|
--- !u!212 &6967183450965278935
|
||||||
@@ -217,8 +218,89 @@ MonoBehaviour:
|
|||||||
speed: 3
|
speed: 3
|
||||||
jumpForce: 8
|
jumpForce: 8
|
||||||
firePoint: {fileID: 3204799031628172313}
|
firePoint: {fileID: 3204799031628172313}
|
||||||
|
attackCollider: {fileID: 5093782900058509363}
|
||||||
animator: {fileID: 0}
|
animator: {fileID: 0}
|
||||||
rb: {fileID: 4986202531950816680}
|
rb: {fileID: 4986202531950816680}
|
||||||
|
--- !u!1 &4475587780921916628
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 548404723012153258}
|
||||||
|
- component: {fileID: 8742189463934084701}
|
||||||
|
- component: {fileID: 5093782900058509363}
|
||||||
|
m_Layer: 0
|
||||||
|
m_Name: AttackPoint
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!4 &548404723012153258
|
||||||
|
Transform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 4475587780921916628}
|
||||||
|
serializedVersion: 2
|
||||||
|
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||||
|
m_LocalPosition: {x: 0.107000016, y: 0.1237, z: 0}
|
||||||
|
m_LocalScale: {x: 1, y: 1, z: 0}
|
||||||
|
m_ConstrainProportionsScale: 0
|
||||||
|
m_Children: []
|
||||||
|
m_Father: {fileID: 8528093570479225059}
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
--- !u!58 &8742189463934084701
|
||||||
|
CircleCollider2D:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 4475587780921916628}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_Density: 1
|
||||||
|
m_Material: {fileID: 0}
|
||||||
|
m_IncludeLayers:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Bits: 0
|
||||||
|
m_ExcludeLayers:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Bits: 0
|
||||||
|
m_LayerOverridePriority: 0
|
||||||
|
m_ForceSendLayers:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Bits: 4294967295
|
||||||
|
m_ForceReceiveLayers:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Bits: 4294967295
|
||||||
|
m_ContactCaptureLayers:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Bits: 4294967295
|
||||||
|
m_CallbackLayers:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Bits: 4294967295
|
||||||
|
m_IsTrigger: 1
|
||||||
|
m_UsedByEffector: 0
|
||||||
|
m_UsedByComposite: 0
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Radius: 0.1
|
||||||
|
--- !u!114 &5093782900058509363
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 4475587780921916628}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: c70bfc4e889c3aa40a51378afd6deda8, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
--- !u!1 &8790121653688035716
|
--- !u!1 &8790121653688035716
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ namespace TON
|
|||||||
public class CharacterBase : MonoBehaviour, IDamage
|
public class CharacterBase : MonoBehaviour, IDamage
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
public float currentHP;
|
public float currentHP;
|
||||||
public float maxHP;
|
public float maxHP;
|
||||||
public float currentSP;
|
public float currentSP;
|
||||||
@@ -20,6 +19,7 @@ namespace TON
|
|||||||
|
|
||||||
|
|
||||||
public Transform firePoint; // 스킬 발사 위치
|
public Transform firePoint; // 스킬 발사 위치
|
||||||
|
public CollisionDetector attackCollider; // 기본 공격 감지를 위한 자식 오브젝트
|
||||||
|
|
||||||
public Animator animator;
|
public Animator animator;
|
||||||
|
|
||||||
@@ -33,6 +33,8 @@ namespace TON
|
|||||||
joystick = ControllerUI.Instance.joystick;
|
joystick = ControllerUI.Instance.joystick;
|
||||||
ControllerUI.Instance.linkedCharactor = this;
|
ControllerUI.Instance.linkedCharactor = this;
|
||||||
|
|
||||||
|
attackCollider.EnableCollider(false); // 기본 공격 Enable 비활성화
|
||||||
|
|
||||||
Initialize();
|
Initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -45,6 +47,11 @@ namespace TON
|
|||||||
currentSP = maxSP = playerData.mp;
|
currentSP = maxSP = playerData.mp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void UpdateExpericenPoint(float point)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public void FixedUpdate()
|
public void FixedUpdate()
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -113,25 +120,35 @@ namespace TON
|
|||||||
{
|
{
|
||||||
// 공격 애니메이션 적용
|
// 공격 애니메이션 적용
|
||||||
animator.Play("Default Attack");
|
animator.Play("Default Attack");
|
||||||
|
|
||||||
|
// 공격 범위 Collider 활성화
|
||||||
|
attackCollider.EnableCollider(true);
|
||||||
|
|
||||||
|
// 일정 시간 후 Collider 다시 비활성화 (예: 0.5초 후)
|
||||||
|
Invoke("DisableAttackCollider", 0.5f);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DisableAttackCollider()
|
||||||
|
{
|
||||||
|
attackCollider.EnableCollider(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SkillAttack(string skillName)
|
public void SkillAttack(string skillName)
|
||||||
{
|
{
|
||||||
animator.Play("Skill Attack");
|
animator.Play("Skill Attack");
|
||||||
|
|
||||||
// 총알 생성
|
// 스킬 생성
|
||||||
GameObject skill = ObjectPoolManager.Instance.GetEffect(skillName);
|
GameObject skill = ObjectPoolManager.Instance.GetEffect(skillName);
|
||||||
|
|
||||||
// skill.transform.SetParent(firePoint);
|
// skill.transform.SetParent(firePoint);
|
||||||
skill.transform.SetPositionAndRotation(firePoint.position, firePoint.rotation);
|
skill.transform.SetPositionAndRotation(firePoint.position, firePoint.rotation);
|
||||||
|
|
||||||
|
// 🔥 스킬 방향 반전
|
||||||
// 🔥 총알 방향 반전
|
|
||||||
var bulletScale = skill.transform.localScale;
|
var bulletScale = skill.transform.localScale;
|
||||||
bulletScale.x = Mathf.Abs(bulletScale.x) * lastDirection;
|
bulletScale.x = Mathf.Abs(bulletScale.x) * lastDirection;
|
||||||
skill.transform.localScale = bulletScale;
|
skill.transform.localScale = bulletScale;
|
||||||
|
|
||||||
// 총알 이동 방향 설정
|
// 스킬 이동 방향 설정
|
||||||
Rigidbody2D skillRb = skill.GetComponent<Rigidbody2D>();
|
Rigidbody2D skillRb = skill.GetComponent<Rigidbody2D>();
|
||||||
skillRb.velocity = new Vector2(lastDirection * 5f, 0f);
|
skillRb.velocity = new Vector2(lastDirection * 5f, 0f);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,33 @@
|
|||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace TON
|
||||||
|
{
|
||||||
|
public class CollisionDetector : MonoBehaviour
|
||||||
|
{
|
||||||
|
private Collider2D col; // 자식 오브젝트의 Collider
|
||||||
|
|
||||||
|
private void Awake()
|
||||||
|
{
|
||||||
|
col = GetComponent<Collider2D>();
|
||||||
|
col.enabled = false; // 초기에는 감지 비활성화
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnTriggerEnter2D(Collider2D collision)
|
||||||
|
{
|
||||||
|
if (!col.enabled) return; // Collider가 활성화된 경우에만 실행
|
||||||
|
|
||||||
|
if (collision.CompareTag("Monster")) // 적과 충돌 시 제거
|
||||||
|
{
|
||||||
|
collision.GetComponent<IDamage>().ApplyDamage(10f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 부모(캐릭터)에서 호출할 메서드
|
||||||
|
public void EnableCollider(bool isEnabled)
|
||||||
|
{
|
||||||
|
col.enabled = isEnabled;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: c70bfc4e889c3aa40a51378afd6deda8
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
Reference in New Issue
Block a user