캐릭터 모델 작성 및 스킬 버블 시스템 제작중 1
This commit is contained in:
parent
75ac817c80
commit
849cf63e2e
|
|
@ -0,0 +1,8 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: fd43d4ef45c8644b29b8f128a42af5a4
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -0,0 +1,40 @@
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
using UniRx;
|
||||||
|
|
||||||
|
public class BattleCharacter : MonoBehaviour
|
||||||
|
{
|
||||||
|
public CharacterModel.Data Data { get; private set; } = null;
|
||||||
|
|
||||||
|
public short UID { get; private set; } = 0;
|
||||||
|
|
||||||
|
public int SKILL_TIME { get; private set; } = 0;
|
||||||
|
|
||||||
|
public void Initialize(CharacterModel.Data data, short uid)
|
||||||
|
{
|
||||||
|
Data = data;
|
||||||
|
UID = uid;
|
||||||
|
SKILL_TIME = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void UpdateBattleTime(int t)
|
||||||
|
{
|
||||||
|
SKILL_TIME += t;
|
||||||
|
|
||||||
|
CheckSkill();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CheckSkill()
|
||||||
|
{
|
||||||
|
if(Data.GetStat(CharacterModel.Data.eSTAT.SPD) <= SKILL_TIME)
|
||||||
|
{
|
||||||
|
MessageBroker.Default.Publish<BattleManager.Message>(new BattleManager.Message()
|
||||||
|
{
|
||||||
|
BattleEvent = BattleManager.eBATTLE_EVENT.SPAWN_SKILL,
|
||||||
|
Source = this,
|
||||||
|
}) ;
|
||||||
|
SKILL_TIME = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 9da7f45aa275148288c5956311d60b54
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -0,0 +1,43 @@
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
using UniRx;
|
||||||
|
|
||||||
|
public partial class BattleManager
|
||||||
|
{
|
||||||
|
[SerializeField]
|
||||||
|
SkillBubbleManager mSkillManager = null;
|
||||||
|
|
||||||
|
public enum eBATTLE_EVENT
|
||||||
|
{
|
||||||
|
SPAWN_SKILL,
|
||||||
|
RUN_SKILL,
|
||||||
|
}
|
||||||
|
|
||||||
|
public struct Message
|
||||||
|
{
|
||||||
|
public eBATTLE_EVENT BattleEvent;
|
||||||
|
|
||||||
|
public BattleCharacter Source;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Awake()
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
OnMessageBroker();
|
||||||
|
}
|
||||||
|
|
||||||
|
void OnMessageBroker()
|
||||||
|
{
|
||||||
|
MessageBroker.Default.Receive<Message>().Subscribe(msg =>
|
||||||
|
{
|
||||||
|
switch(msg.BattleEvent)
|
||||||
|
{
|
||||||
|
case eBATTLE_EVENT.SPAWN_SKILL:
|
||||||
|
mSkillManager.SpawnSkill(msg.Source);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}).AddTo(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: e2b35ac764b7a4bf494ec51168810fab
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -8,10 +8,10 @@ using DarkTonic.MasterAudio;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
|
|
||||||
#if UNITY_EDITOR
|
#if UNITY_EDITOR
|
||||||
// PackageManager 관련 코드
|
// PackageManager ???? ????
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
public class BattleManager : MonoBehaviour
|
public partial class BattleManager : MonoBehaviour
|
||||||
{
|
{
|
||||||
public GameObject HeroUnit;
|
public GameObject HeroUnit;
|
||||||
public Transform[] MonsterPositions = new Transform[3];
|
public Transform[] MonsterPositions = new Transform[3];
|
||||||
|
|
@ -21,37 +21,37 @@ public class BattleManager : MonoBehaviour
|
||||||
public GameObject NumberPrefab;
|
public GameObject NumberPrefab;
|
||||||
public GameObject CriticalPrefab;
|
public GameObject CriticalPrefab;
|
||||||
public TextMeshProUGUI stageClearText;
|
public TextMeshProUGUI stageClearText;
|
||||||
public Image darkPanel; // 다크 커튼 이미지를 담을 변수
|
public Image darkPanel; // ???? ???? ???????? ???? ????
|
||||||
|
|
||||||
|
|
||||||
public float CriticalRate; // 치명타 확률(10000분율)
|
public float CriticalRate; // ?????? ????(10000????)
|
||||||
public float CriticalDamage; // 치명타 배율(10000분율)
|
public float CriticalDamage; // ?????? ????(10000????)
|
||||||
public int HeroDamag; // 영웅 공격력
|
public int HeroDamag; // ???? ??????
|
||||||
|
|
||||||
private List<Transform> aliveMonsters = new List<Transform>();
|
private List<Transform> aliveMonsters = new List<Transform>();
|
||||||
private bool stageCleared = false;
|
private bool stageCleared = false;
|
||||||
private bool isHeroAttacking = false;
|
private bool isHeroAttacking = false;
|
||||||
public string playlistName = "Bgm";
|
public string playlistName = "Bgm";
|
||||||
|
|
||||||
// 스프라이트 랜더러 배열 추가
|
// ?????????? ?????? ???? ????
|
||||||
private SpriteRenderer[] spriteRenderers;
|
private SpriteRenderer[] spriteRenderers;
|
||||||
|
|
||||||
|
|
||||||
private void Start()
|
private void Start()
|
||||||
{
|
{
|
||||||
// 처음에 모든 몬스터를 생존 몬스터 리스트에 추가
|
// ?????? ???? ???????? ???? ?????? ???????? ????
|
||||||
foreach (Transform monsterPos in MonsterPositions)
|
foreach (Transform monsterPos in MonsterPositions)
|
||||||
{
|
{
|
||||||
aliveMonsters.Add(monsterPos);
|
aliveMonsters.Add(monsterPos);
|
||||||
}
|
}
|
||||||
// NumberPrefab의 자식 오브젝트 수를 가져옵니다.
|
// NumberPrefab?? ???? ???????? ???? ??????????.
|
||||||
int childCount = NumberPrefab.transform.childCount;
|
int childCount = NumberPrefab.transform.childCount;
|
||||||
|
|
||||||
|
|
||||||
// 스프라이트 랜더러 배열 초기화
|
// ?????????? ?????? ???? ??????
|
||||||
spriteRenderers = new SpriteRenderer[childCount];
|
spriteRenderers = new SpriteRenderer[childCount];
|
||||||
|
|
||||||
// 각 자식 오브젝트의 스프라이트 랜더러 컴포넌트를 배열에 할당
|
// ?? ???? ?????????? ?????????? ?????? ?????????? ?????? ????
|
||||||
for (int i = 0; i < childCount; i++)
|
for (int i = 0; i < childCount; i++)
|
||||||
{
|
{
|
||||||
Transform child = NumberPrefab.transform.GetChild(i);
|
Transform child = NumberPrefab.transform.GetChild(i);
|
||||||
|
|
@ -78,18 +78,18 @@ public class BattleManager : MonoBehaviour
|
||||||
isHeroAttacking = true;
|
isHeroAttacking = true;
|
||||||
HeroUnit.SetActive(true);
|
HeroUnit.SetActive(true);
|
||||||
|
|
||||||
// 영웅의 공격 애니메이션
|
// ?????? ???? ??????????
|
||||||
Sequence attackSequence = DOTween.Sequence();
|
Sequence attackSequence = DOTween.Sequence();
|
||||||
attackSequence.Append(HeroUnit.transform.DOLocalMoveY(-700, 0.25f).SetEase(Ease.OutCubic));
|
attackSequence.Append(HeroUnit.transform.DOLocalMoveY(-700, 0.25f).SetEase(Ease.OutCubic));
|
||||||
attackSequence.AppendCallback(() =>
|
attackSequence.AppendCallback(() =>
|
||||||
{
|
{
|
||||||
// 공격 애니메이션이 끝나면 몬스터에게 피해를 입힙니다.
|
// ???? ???????????? ?????? ?????????? ?????? ????????.
|
||||||
DealDamageToMonster();
|
DealDamageToMonster();
|
||||||
});
|
});
|
||||||
attackSequence.Append(HeroUnit.transform.DOLocalMoveY(-1500, 0.15f).SetEase(Ease.OutCubic));
|
attackSequence.Append(HeroUnit.transform.DOLocalMoveY(-1500, 0.15f).SetEase(Ease.OutCubic));
|
||||||
attackSequence.OnComplete(() =>
|
attackSequence.OnComplete(() =>
|
||||||
{
|
{
|
||||||
// 애니메이션 종료 후 공격을 허용
|
// ?????????? ???? ?? ?????? ????
|
||||||
isHeroAttacking = false;
|
isHeroAttacking = false;
|
||||||
HeroUnit.SetActive(false);
|
HeroUnit.SetActive(false);
|
||||||
});
|
});
|
||||||
|
|
@ -104,24 +104,24 @@ public class BattleManager : MonoBehaviour
|
||||||
int randomMonsterIndex = Random.Range(0, aliveMonsters.Count);
|
int randomMonsterIndex = Random.Range(0, aliveMonsters.Count);
|
||||||
Transform targetMonster = aliveMonsters[randomMonsterIndex];
|
Transform targetMonster = aliveMonsters[randomMonsterIndex];
|
||||||
|
|
||||||
float randomNumber = Random.Range(0, HeroDamag); // 0부터 영웅 공격력만큼의 피해를 적용
|
float randomNumber = Random.Range(0, HeroDamag); // 0???? ???? ???????????? ?????? ????
|
||||||
|
|
||||||
// 랜덤 값을 생성하여 크리티컬 확률과 비교
|
// ???? ???? ???????? ???????? ?????? ????
|
||||||
float randomValue = Random.Range(0, 10000); // 0부터 9999까지의 랜덤 값
|
float randomValue = Random.Range(0, 10000); // 0???? 9999?????? ???? ??
|
||||||
bool isCritical = randomValue<= CriticalRate;
|
bool isCritical = randomValue<= CriticalRate;
|
||||||
int resultNumber = 0;
|
int resultNumber = 0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int randomSoundIndex = Random.Range(1, 4); // 1부터 3까지의 랜덤한 정수 생성
|
int randomSoundIndex = Random.Range(1, 4); // 1???? 3?????? ?????? ???? ????
|
||||||
|
|
||||||
string soundName = "Hot_Type2_" + randomSoundIndex.ToString(); // 사운드 이름 생성
|
string soundName = "Hot_Type2_" + randomSoundIndex.ToString(); // ?????? ???? ????
|
||||||
|
|
||||||
MasterAudio.PlaySound(soundName, 0.7f, null);
|
MasterAudio.PlaySound(soundName, 0.7f, null);
|
||||||
|
|
||||||
int randomVoiceIndex = Random.Range(1, 13); // 1부터 12까지의 랜덤한 정수 생성
|
int randomVoiceIndex = Random.Range(1, 13); // 1???? 12?????? ?????? ???? ????
|
||||||
|
|
||||||
string voiceName = "Voice_HERO_01_Combo_1_" + randomVoiceIndex.ToString(); // 사운드 이름 생성
|
string voiceName = "Voice_HERO_01_Combo_1_" + randomVoiceIndex.ToString(); // ?????? ???? ????
|
||||||
|
|
||||||
MasterAudio.PlaySound(voiceName, 0.7f, null);
|
MasterAudio.PlaySound(voiceName, 0.7f, null);
|
||||||
|
|
||||||
|
|
@ -138,32 +138,32 @@ public class BattleManager : MonoBehaviour
|
||||||
resultNumber = (int)randomNumber;
|
resultNumber = (int)randomNumber;
|
||||||
}
|
}
|
||||||
|
|
||||||
// HitEffectPrefab 오브젝트를 복제하여 이펙트를 표시할 오브젝트 생성
|
// HitEffectPrefab ?????????? ???????? ???????? ?????? ???????? ????
|
||||||
GameObject hitEffectPosition = Instantiate(HitEffectPrefab, targetMonster.position, Quaternion.identity);
|
GameObject hitEffectPosition = Instantiate(HitEffectPrefab, targetMonster.position, Quaternion.identity);
|
||||||
hitEffectPosition.SetActive(true);
|
hitEffectPosition.SetActive(true);
|
||||||
Destroy(hitEffectPosition, 0.5f); // 일정 시간 후에 제거
|
Destroy(hitEffectPosition, 0.5f); // ???? ???? ???? ????
|
||||||
|
|
||||||
|
|
||||||
if (resultNumber == 0)
|
if (resultNumber == 0)
|
||||||
{
|
{
|
||||||
// 몬스터 위치로 미스 이펙트 발생
|
// ?????? ?????? ???? ?????? ????
|
||||||
ShowMissDamage(targetMonster.position + new Vector3(0, 1.4f, 0), targetMonster);
|
ShowMissDamage(targetMonster.position + new Vector3(0, 1.4f, 0), targetMonster);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ShowNumberDamage(targetMonster.position + new Vector3(0, 1.4f, 0), targetMonster, resultNumber, isCritical);
|
ShowNumberDamage(targetMonster.position + new Vector3(0, 1.4f, 0), targetMonster, resultNumber, isCritical);
|
||||||
// HitEffectPrefab 오브젝트를 복제하여 이펙트를 표시할 오브젝트 생성
|
// HitEffectPrefab ?????????? ???????? ???????? ?????? ???????? ????
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ShowMissDamage(Vector3 monsterPosition, Transform targetMonster)
|
private void ShowMissDamage(Vector3 monsterPosition, Transform targetMonster)
|
||||||
{
|
{
|
||||||
// 몬스터 위치로 미스 이펙트 생성
|
// ?????? ?????? ???? ?????? ????
|
||||||
GameObject missObject = Instantiate(MissPrefab, monsterPosition, Quaternion.identity);
|
GameObject missObject = Instantiate(MissPrefab, monsterPosition, Quaternion.identity);
|
||||||
missObject.SetActive(true);
|
missObject.SetActive(true);
|
||||||
|
|
||||||
// 미스 애니메이션
|
// ???? ??????????
|
||||||
missObject.transform.localScale = Vector3.one * 1.5f;
|
missObject.transform.localScale = Vector3.one * 1.5f;
|
||||||
missObject.transform.DOScale(Vector3.one * 0.3f, 0.4f).SetEase(Ease.OutCubic);
|
missObject.transform.DOScale(Vector3.one * 0.3f, 0.4f).SetEase(Ease.OutCubic);
|
||||||
missObject.transform.DOMoveY(missObject.transform.position.y + 1, 0.5f).SetEase(Ease.OutCubic).OnComplete(() =>
|
missObject.transform.DOMoveY(missObject.transform.position.y + 1, 0.5f).SetEase(Ease.OutCubic).OnComplete(() =>
|
||||||
|
|
@ -177,7 +177,7 @@ public class BattleManager : MonoBehaviour
|
||||||
GameObject CriObject = Instantiate(CriticalPrefab, monsterPosition, Quaternion.identity);
|
GameObject CriObject = Instantiate(CriticalPrefab, monsterPosition, Quaternion.identity);
|
||||||
CriObject.SetActive(true);
|
CriObject.SetActive(true);
|
||||||
|
|
||||||
// 크리 애니메이션
|
// ???? ??????????
|
||||||
CriObject.transform.localScale = Vector3.one * 1.5f;
|
CriObject.transform.localScale = Vector3.one * 1.5f;
|
||||||
CriObject.transform.DOScale(Vector3.one * 0.3f, 0.4f).SetEase(Ease.OutCubic);
|
CriObject.transform.DOScale(Vector3.one * 0.3f, 0.4f).SetEase(Ease.OutCubic);
|
||||||
CriObject.transform.DOMoveY(CriObject.transform.position.y + 1, 0.5f).SetEase(Ease.OutCubic).OnComplete(() =>
|
CriObject.transform.DOMoveY(CriObject.transform.position.y + 1, 0.5f).SetEase(Ease.OutCubic).OnComplete(() =>
|
||||||
|
|
@ -188,13 +188,13 @@ public class BattleManager : MonoBehaviour
|
||||||
|
|
||||||
private void ShowNumberDamage(Vector3 monsterPosition, Transform targetMonster, int damage, bool isCritical)
|
private void ShowNumberDamage(Vector3 monsterPosition, Transform targetMonster, int damage, bool isCritical)
|
||||||
{
|
{
|
||||||
// 떨림 효과 추가
|
// ???? ???? ????
|
||||||
targetMonster.DOPunchPosition(new Vector3(10, 0, 0), 0.2f);
|
targetMonster.DOPunchPosition(new Vector3(10, 0, 0), 0.2f);
|
||||||
|
|
||||||
// damage를 문자열로 변환
|
// damage?? ???????? ????
|
||||||
string damageString = damage.ToString();
|
string damageString = damage.ToString();
|
||||||
|
|
||||||
// 서로 떨어진 위치 조절값
|
// ???? ?????? ???? ??????
|
||||||
float xOffset = 0;
|
float xOffset = 0;
|
||||||
|
|
||||||
if (isCritical)
|
if (isCritical)
|
||||||
|
|
@ -206,18 +206,18 @@ public class BattleManager : MonoBehaviour
|
||||||
xOffset += 1.1f;
|
xOffset += 1.1f;
|
||||||
}
|
}
|
||||||
|
|
||||||
float totalWidth = ((damageString.Length-1) * xOffset); // 전체 너비
|
float totalWidth = ((damageString.Length-1) * xOffset); // ???? ????
|
||||||
|
|
||||||
// 부모 오브젝트 생성
|
// ???? ???????? ????
|
||||||
GameObject digitObject = new GameObject("HitNumber");
|
GameObject digitObject = new GameObject("HitNumber");
|
||||||
|
|
||||||
// 숫자 위치를 monsterPosition을 기준으로 설정 (로컬 포지션)
|
// ???? ?????? monsterPosition?? ???????? ???? (???? ??????)
|
||||||
digitObject.transform.localPosition = new Vector3(monsterPosition.x, monsterPosition.y - 2f, monsterPosition.z);
|
digitObject.transform.localPosition = new Vector3(monsterPosition.x, monsterPosition.y - 2f, monsterPosition.z);
|
||||||
|
|
||||||
// 애니메이션 및 위치 설정
|
// ?????????? ?? ???? ????
|
||||||
for (int i = 0; i < damageString.Length; i++)
|
for (int i = 0; i < damageString.Length; i++)
|
||||||
{
|
{
|
||||||
int digit = int.Parse(damageString[i].ToString()); // 자릿수를 추출
|
int digit = int.Parse(damageString[i].ToString()); // ???????? ????
|
||||||
|
|
||||||
if (digit >= 0 && digit < spriteRenderers.Length)
|
if (digit >= 0 && digit < spriteRenderers.Length)
|
||||||
{
|
{
|
||||||
|
|
@ -225,28 +225,28 @@ public class BattleManager : MonoBehaviour
|
||||||
{
|
{
|
||||||
digit += 10;
|
digit += 10;
|
||||||
}
|
}
|
||||||
// 숫자 스프라이트 랜더러 설정
|
// ???? ?????????? ?????? ????
|
||||||
SpriteRenderer digitSpriteRenderer = spriteRenderers[digit];
|
SpriteRenderer digitSpriteRenderer = spriteRenderers[digit];
|
||||||
|
|
||||||
// 숫자 스프라이트 복제
|
// ???? ?????????? ????
|
||||||
GameObject digitImageObject = new GameObject("DigitImage"); // 새 게임 오브젝트 생성
|
GameObject digitImageObject = new GameObject("DigitImage"); // ?? ???? ???????? ????
|
||||||
//digitImageObject.transform.position = digitObject.transform.position;
|
//digitImageObject.transform.position = digitObject.transform.position;
|
||||||
|
|
||||||
// 스프라이트 랜더러 추가 및 설정
|
// ?????????? ?????? ???? ?? ????
|
||||||
SpriteRenderer newRenderer = digitImageObject.AddComponent<SpriteRenderer>();
|
SpriteRenderer newRenderer = digitImageObject.AddComponent<SpriteRenderer>();
|
||||||
newRenderer.sprite = digitSpriteRenderer.sprite;
|
newRenderer.sprite = digitSpriteRenderer.sprite;
|
||||||
|
|
||||||
// Order 값을 300으로 설정
|
// Order ???? 300???? ????
|
||||||
newRenderer.sortingOrder = 300;
|
newRenderer.sortingOrder = 300;
|
||||||
|
|
||||||
// x 위치 조절하여 중앙 정렬된 상태에서 배치
|
// x ???? ???????? ???? ?????? ???????? ????
|
||||||
float xPos = -totalWidth / 2 + i * xOffset;
|
float xPos = -totalWidth / 2 + i * xOffset;
|
||||||
digitImageObject.transform.localPosition = new Vector3(xPos, 0, 0);
|
digitImageObject.transform.localPosition = new Vector3(xPos, 0, 0);
|
||||||
|
|
||||||
// 스케일 조절 (크기 동일하게)
|
// ?????? ???? (???? ????????)
|
||||||
digitImageObject.transform.localScale = Vector3.one * 1.0f;
|
digitImageObject.transform.localScale = Vector3.one * 1.0f;
|
||||||
|
|
||||||
// 부모 설정
|
// ???? ????
|
||||||
digitImageObject.transform.SetParent(digitObject.transform);
|
digitImageObject.transform.SetParent(digitObject.transform);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -257,39 +257,39 @@ public class BattleManager : MonoBehaviour
|
||||||
if (isCritical)
|
if (isCritical)
|
||||||
{
|
{
|
||||||
ShowCriEffect(targetMonster.position + new Vector3(0, 1.8f, 0), targetMonster);
|
ShowCriEffect(targetMonster.position + new Vector3(0, 1.8f, 0), targetMonster);
|
||||||
digitObject.transform.localScale = Vector3.one * 0.5f; // 크기 설정
|
digitObject.transform.localScale = Vector3.one * 0.5f; // ???? ????
|
||||||
digitObject.transform.DOScale(Vector3.one * 0.2f, 0.3f).SetEase(Ease.OutCubic);
|
digitObject.transform.DOScale(Vector3.one * 0.2f, 0.3f).SetEase(Ease.OutCubic);
|
||||||
digitObject.transform.DOMoveY(digitObject.transform.position.y + 2, 0.5f).SetEase(Ease.OutCubic).OnComplete(() =>
|
digitObject.transform.DOMoveY(digitObject.transform.position.y + 2, 0.5f).SetEase(Ease.OutCubic).OnComplete(() =>
|
||||||
{
|
{
|
||||||
Destroy(digitObject); // 스프라이트 랜더러를 가진 게임 오브젝트를 제거합니다.
|
Destroy(digitObject); // ?????????? ???????? ???? ???? ?????????? ??????????.
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// digitObject를 기준으로 애니메이션 설정
|
// digitObject?? ???????? ?????????? ????
|
||||||
digitObject.transform.localScale = Vector3.one * 0.5f; // 크기 설정
|
digitObject.transform.localScale = Vector3.one * 0.5f; // ???? ????
|
||||||
digitObject.transform.DOScale(Vector3.one * 0.3f, 0.3f).SetEase(Ease.OutCubic);
|
digitObject.transform.DOScale(Vector3.one * 0.3f, 0.3f).SetEase(Ease.OutCubic);
|
||||||
digitObject.transform.DOMoveY(digitObject.transform.position.y + 2, 0.5f).SetEase(Ease.OutCubic).OnComplete(() =>
|
digitObject.transform.DOMoveY(digitObject.transform.position.y + 2, 0.5f).SetEase(Ease.OutCubic).OnComplete(() =>
|
||||||
{
|
{
|
||||||
Destroy(digitObject); // 스프라이트 랜더러를 가진 게임 오브젝트를 제거합니다.
|
Destroy(digitObject); // ?????????? ???????? ???? ???? ?????????? ??????????.
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 몬스터의 HP 게이지 감소 처리
|
// ???????? HP ?????? ???? ????
|
||||||
MonsterHealth monsterHealth = targetMonster.GetComponentInChildren<MonsterHealth>();
|
MonsterHealth monsterHealth = targetMonster.GetComponentInChildren<MonsterHealth>();
|
||||||
if (monsterHealth != null && !monsterHealth.IsDead)
|
if (monsterHealth != null && !monsterHealth.IsDead)
|
||||||
{
|
{
|
||||||
monsterHealth.TakeDamage(damage); // damage 만큼 감소
|
monsterHealth.TakeDamage(damage); // damage ???? ????
|
||||||
|
|
||||||
// 만약 몬스터의 HP가 0 이하면
|
// ???? ???????? HP?? 0 ??????
|
||||||
if (monsterHealth.CurrentHealth <= 0)
|
if (monsterHealth.CurrentHealth <= 0)
|
||||||
{
|
{
|
||||||
// 몬스터를 리스트에서 제거
|
// ???????? ?????????? ????
|
||||||
aliveMonsters.Remove(targetMonster);
|
aliveMonsters.Remove(targetMonster);
|
||||||
|
|
||||||
// 남은 몬스터가 없으면 StageClear 효과 표시
|
// ???? ???????? ?????? StageClear ???? ????
|
||||||
if (aliveMonsters.Count == 0 && !stageCleared)
|
if (aliveMonsters.Count == 0 && !stageCleared)
|
||||||
{
|
{
|
||||||
stageCleared = true;
|
stageCleared = true;
|
||||||
|
|
@ -305,31 +305,31 @@ public class BattleManager : MonoBehaviour
|
||||||
|
|
||||||
private void ShowStageClearAnimation()
|
private void ShowStageClearAnimation()
|
||||||
{
|
{
|
||||||
// 텍스트 활성화 및 초기화
|
// ?????? ?????? ?? ??????
|
||||||
stageClearText.gameObject.SetActive(true);
|
stageClearText.gameObject.SetActive(true);
|
||||||
HeroUnit.SetActive(false);
|
HeroUnit.SetActive(false);
|
||||||
stageClearText.transform.localScale = Vector3.zero;
|
stageClearText.transform.localScale = Vector3.zero;
|
||||||
|
|
||||||
// Scale 애니메이션
|
// Scale ??????????
|
||||||
stageClearText.transform.DOScale(Vector3.one, 0.5f).SetEase(Ease.OutBack).OnComplete(() =>
|
stageClearText.transform.DOScale(Vector3.one, 0.5f).SetEase(Ease.OutBack).OnComplete(() =>
|
||||||
{
|
{
|
||||||
// 텍스트 흔들림 애니메이션
|
// ?????? ?????? ??????????
|
||||||
stageClearText.transform.DOShakePosition(1.0f, new Vector3(0, 10, 0), 10, 90, false, true).OnComplete(() =>
|
stageClearText.transform.DOShakePosition(1.0f, new Vector3(0, 10, 0), 10, 90, false, true).OnComplete(() =>
|
||||||
{
|
{
|
||||||
// 텍스트 페이드 아웃 애니메이션
|
// ?????? ?????? ???? ??????????
|
||||||
CanvasGroup canvasGroup = stageClearText.GetComponent<CanvasGroup>();
|
CanvasGroup canvasGroup = stageClearText.GetComponent<CanvasGroup>();
|
||||||
canvasGroup.DOFade(0, 0.5f).OnComplete(() =>
|
canvasGroup.DOFade(0, 0.5f).OnComplete(() =>
|
||||||
{
|
{
|
||||||
// 다크 커튼 이미지 활성화
|
// ???? ???? ?????? ??????
|
||||||
darkPanel.gameObject.SetActive(true);
|
darkPanel.gameObject.SetActive(true);
|
||||||
|
|
||||||
// 어두움 효과 애니메이션 (투명도를 0에서 1로 변경)
|
// ?????? ???? ?????????? (???????? 0???? 1?? ????)
|
||||||
DOVirtual.Float(0, 1.0f, 1.0f, (fadeValue) =>
|
DOVirtual.Float(0, 1.0f, 1.0f, (fadeValue) =>
|
||||||
{
|
{
|
||||||
darkPanel.color = new Color(0, 0, 0, fadeValue);
|
darkPanel.color = new Color(0, 0, 0, fadeValue);
|
||||||
}).OnComplete(() =>
|
}).OnComplete(() =>
|
||||||
{
|
{
|
||||||
// 다음 씬 호출
|
// ???? ?? ????
|
||||||
MasterAudio.PlaySound("BGM_VAILAGE", 0);
|
MasterAudio.PlaySound("BGM_VAILAGE", 0);
|
||||||
MasterAudio.PlaylistsMuted = false;
|
MasterAudio.PlaylistsMuted = false;
|
||||||
SceneManager.LoadScene(4);
|
SceneManager.LoadScene(4);
|
||||||
|
|
@ -0,0 +1,60 @@
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
|
public class SkillBubbleManager : MonoBehaviour
|
||||||
|
{
|
||||||
|
public List<SkillData> mListSkill = new List<SkillData>(10);
|
||||||
|
|
||||||
|
Queue<SkillData> mQSkillDataPool = new Queue<SkillData>(10);
|
||||||
|
|
||||||
|
public void Initialize()
|
||||||
|
{
|
||||||
|
for(int i=0; i<10; ++i)
|
||||||
|
{
|
||||||
|
mQSkillDataPool.Enqueue(new SkillData());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SpawnSkill(BattleCharacter character)
|
||||||
|
{
|
||||||
|
var existSkill = GetExistSkill(character);
|
||||||
|
if(null != existSkill)
|
||||||
|
{
|
||||||
|
existSkill.OnStack();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var newSkill = GetNewSkillData();
|
||||||
|
newSkill.Set(character);
|
||||||
|
mListSkill.Add(newSkill);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RemoveSkill(int idx)
|
||||||
|
{
|
||||||
|
mListSkill.RemoveAt(idx);
|
||||||
|
}
|
||||||
|
|
||||||
|
SkillData GetExistSkill(BattleCharacter character)
|
||||||
|
{
|
||||||
|
var skill = mListSkill.FirstOrDefault((item) => item.Owner == character);
|
||||||
|
if (null == skill)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
if (false == skill.IsStackable())
|
||||||
|
return null;
|
||||||
|
|
||||||
|
return skill;
|
||||||
|
}
|
||||||
|
|
||||||
|
SkillData GetNewSkillData()
|
||||||
|
{
|
||||||
|
if (mQSkillDataPool.Count <= 0)
|
||||||
|
{
|
||||||
|
mQSkillDataPool.Enqueue(new SkillData());
|
||||||
|
}
|
||||||
|
|
||||||
|
return mQSkillDataPool.Dequeue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 576636a482c29486cb2a622bcb12b953
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -0,0 +1,34 @@
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
public class SkillData
|
||||||
|
{
|
||||||
|
public const int MAX_STACK = 5;
|
||||||
|
|
||||||
|
public BattleCharacter Owner { get; private set; } = null;
|
||||||
|
public int StackCnt { get; set; } = 0;
|
||||||
|
|
||||||
|
public void Reset()
|
||||||
|
{
|
||||||
|
Owner = null;
|
||||||
|
StackCnt = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Set(BattleCharacter owner)
|
||||||
|
{
|
||||||
|
Owner = owner;
|
||||||
|
StackCnt = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IsStackable()
|
||||||
|
{
|
||||||
|
return StackCnt < MAX_STACK;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnStack()
|
||||||
|
{
|
||||||
|
StackCnt++;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: fedc6dc1b6439435586cf6bf5259ab37
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: e4f2a12c7a4454e4fa2e2b23f2a9dc4b
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
public partial class CharacterModel
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 8dc698d1cb2fa4b6ebfb636046a6fe33
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -0,0 +1,89 @@
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
using UniRx;
|
||||||
|
|
||||||
|
|
||||||
|
public partial class CharacterModel : BaseModel
|
||||||
|
{
|
||||||
|
|
||||||
|
ReactiveCollection<Data> mDatas = new ReactiveCollection<Data>(new List<Data>(10));
|
||||||
|
public IReadOnlyCollection<Data> Datas => mDatas;
|
||||||
|
|
||||||
|
|
||||||
|
public class Data
|
||||||
|
{
|
||||||
|
public enum eSTAT
|
||||||
|
{
|
||||||
|
_START_,
|
||||||
|
_BASE_START_,
|
||||||
|
ATK, //공격력
|
||||||
|
DEF, //방어력
|
||||||
|
HP, //체력
|
||||||
|
CRI_RATE, //치명타 확률
|
||||||
|
CRI, //치명타 피해량
|
||||||
|
SPD, //속도
|
||||||
|
_BASE_END_,
|
||||||
|
|
||||||
|
_SUPPROT_START_,
|
||||||
|
SKILL_DMG, //스킬 피해량
|
||||||
|
CC_REGIST, //상태이상 저항
|
||||||
|
CC_HIT, //상태이상 적중
|
||||||
|
FINAL_DMG_UP, //최종 피해량 증가
|
||||||
|
FINAL_DMG_DOWN, //받는 피해 경감
|
||||||
|
FIX_DMG_UP, //고정 피해 추가
|
||||||
|
FIX_DMG_DOWN, //고정 피해 방어
|
||||||
|
CRI_REGIST, //치명타 저항
|
||||||
|
HP_RECOVERY, //생명력 재생량
|
||||||
|
HP_RECOVERY_UP, //회복 효과 증가
|
||||||
|
_SUPPORT_END_,
|
||||||
|
|
||||||
|
_SPECIAL_START_,
|
||||||
|
ATTRIBUTE, //속성
|
||||||
|
JOB, //직업
|
||||||
|
SEX, //성별
|
||||||
|
AGGRO, //어그로
|
||||||
|
_SPECIAL_END_,
|
||||||
|
_END_,
|
||||||
|
}
|
||||||
|
|
||||||
|
public int Level { get; set; } = 1;
|
||||||
|
public string Name { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
public int SkillID { get; set; } = 0;
|
||||||
|
|
||||||
|
Dictionary<eSTAT, int> mDicStat = null;
|
||||||
|
|
||||||
|
public Data()
|
||||||
|
{
|
||||||
|
mDicStat = new Dictionary<eSTAT, int>((int)eSTAT._END_);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Initialize()
|
||||||
|
{
|
||||||
|
#region [TEST]
|
||||||
|
for (var e = eSTAT._START_; e <= eSTAT._END_; ++ e)
|
||||||
|
{
|
||||||
|
if(e <= eSTAT._BASE_END_)
|
||||||
|
{
|
||||||
|
mDicStat.TryAdd(e, Random.Range(100, 150));
|
||||||
|
}
|
||||||
|
else if(e <= eSTAT._SUPPORT_END_)
|
||||||
|
{
|
||||||
|
mDicStat.TryAdd(e, Random.Range(1, 10));
|
||||||
|
}
|
||||||
|
else if(e <= eSTAT._SPECIAL_END_)
|
||||||
|
{
|
||||||
|
mDicStat.TryAdd(e, Random.Range(1, 5));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion[TEST]
|
||||||
|
}
|
||||||
|
|
||||||
|
public int GetStat(eSTAT e)
|
||||||
|
{
|
||||||
|
mDicStat.TryGetValue(e, out var stat);
|
||||||
|
return stat;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,13 +0,0 @@
|
||||||
using System.Collections;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using UnityEngine;
|
|
||||||
using UniRx;
|
|
||||||
|
|
||||||
public class CharacterModel : BaseModel
|
|
||||||
{
|
|
||||||
public IntReactiveProperty mLevel = new IntReactiveProperty(0);
|
|
||||||
public IReadOnlyReactiveProperty<int> Level => mLevel;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
Loading…
Reference in New Issue