Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
 into develop
  • Loading branch information
miniron-v committed Jun 6, 2024
2 parents 7f5c194 + da4993f commit 2593e88
Show file tree
Hide file tree
Showing 51 changed files with 9,721 additions and 3,784 deletions.
584 changes: 127 additions & 457 deletions Assets/01. Scenes/Main.unity

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions Assets/02. Scripts/Battle/Cards/Card SO/Adrenaline.asset
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ MonoBehaviour:
description: "2\uD134 \uB3D9\uC548 \uACF5\uACA9\uB825\uC774 5 \uC99D\uAC00\uD569\uB2C8\uB2E4."
sprite: {fileID: 21300000, guid: 59f9b61088bf9154db61e42630ed947e, type: 3}
skills:
- type: 7
- type: 12
target: 0
amount: 5
turnCount: 0
turnCount: 2
effectPrefeb: {fileID: 3675006101537835259, guid: 2e5ad2beaf55e9f4b9c3ebc4a7a2d823, type: 3}
cost: 3
2 changes: 1 addition & 1 deletion Assets/02. Scripts/Battle/Cards/Card SO/Amanita.asset
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ MonoBehaviour:
\uAC04 \uD654\uC0C1\uC744 6 \uBD80\uC5EC\uD569\uB2C8\uB2E4."
sprite: {fileID: 21300000, guid: 6f3435f12967b544e9abeccac0a085a3, type: 3}
skills:
- type: 8
- type: 11
target: 0
amount: 6
turnCount: 6
Expand Down
2 changes: 1 addition & 1 deletion Assets/02. Scripts/Battle/Cards/Card SO/Capture.asset
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ MonoBehaviour:
\uB9CC\uB4ED\uB2C8\uB2E4."
sprite: {fileID: 21300000, guid: 028caf8b60168b849bea37070b28b491, type: 3}
skills:
- type: 6
- type: 0
target: 1
amount: 0
turnCount: 2
Expand Down
4 changes: 2 additions & 2 deletions Assets/02. Scripts/Battle/Cards/Card SO/Chain Saw.asset
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ MonoBehaviour:
amount: 30
turnCount: 0
effectPrefeb: {fileID: 6898238570730899697, guid: 3c6884803ff0c444d8aa3a83e11a109e, type: 3}
- type: 6
- type: 10
target: 1
amount: 2
turnCount: 3
effectPrefeb: {fileID: 0}
cost: 3
cost: 5
2 changes: 1 addition & 1 deletion Assets/02. Scripts/Battle/Cards/Card SO/Doping.asset
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ MonoBehaviour:
description: "1\uD134 \uB3D9\uC548 \uACF5\uACA9\uB825\uC774 5 \uC99D\uAC00\uD569\uB2C8\uB2E4."
sprite: {fileID: 21300000, guid: 403d8e023d8484f4fade64f053e8edeb, type: 3}
skills:
- type: 7
- type: 12
target: 0
amount: 5
turnCount: 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ MonoBehaviour:
amount: 12
turnCount: 0
effectPrefeb: {fileID: 6898238570730899697, guid: 3c6884803ff0c444d8aa3a83e11a109e, type: 3}
- type: 6
- type: 10
target: 0
amount: 2
turnCount: 3
Expand Down
4 changes: 2 additions & 2 deletions Assets/02. Scripts/Battle/Cards/Card SO/Healing Factor.asset
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ MonoBehaviour:
description: "3\uD134 \uAC04 4\uC529 \uCCB4\uB825\uC744 \uD68C\uBCF5\uD569\uB2C8\uB2E4."
sprite: {fileID: 21300000, guid: 46e1283ebfcfe9b42a4b44cfaedb178e, type: 3}
skills:
- type: 2
- type: 9
target: 0
amount: 4
turnCount: 0
turnCount: 3
effectPrefeb: {fileID: 3675006101537835259, guid: 075bd88e74682664792ed12c07fc48c9, type: 3}
cost: 2
2 changes: 1 addition & 1 deletion Assets/02. Scripts/Battle/Cards/Card SO/Shield.asset
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ MonoBehaviour:
m_Name: Shield
m_EditorClassIdentifier:
name: "\uBC29\uD328"
description: "5\uC758 \uBC29\uC5B4\uB3C4\uB97C \uC5BB\uB294\uB2E4."
description: "5\uC758 \uBC29\uC5B4\uB3C4\uB97C \uC5BB\uC2B5\uB2C8\uB2E4."
sprite: {fileID: 21300000, guid: 3f427f214776e5a4fa7a59a6ceb2b52a, type: 3}
skills:
- type: 1
Expand Down
6 changes: 3 additions & 3 deletions Assets/02. Scripts/Battle/Cards/Card SO/Stinger.asset
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@ MonoBehaviour:
m_Name: Stinger
m_EditorClassIdentifier:
name: "\uB3C5\uCE68"
description: "\uC801\uC5D0\uAC8C \uD53C\uD574\uB97C 5 \uC785\uD799\uB2C8\uB2E4.
\uC801\uC5D0\uAC8C \uCD9C\uD608\uC744 \uBD80\uC5EC\uD569\uB2C8\uB2E4."
description: "\uC801\uC5D0\uAC8C \uD53C\uD574\uB97C 5 \uC785\uD788\uACE0 3\uD134
\uAC04 \uCD9C\uD608\uC744 \uBD80\uC5EC\uD569\uB2C8\uB2E4."
sprite: {fileID: 21300000, guid: f797eb44aef8d994082db7961fe621e9, type: 3}
skills:
- type: 0
target: 1
amount: 5
turnCount: 0
effectPrefeb: {fileID: 974780746110677456, guid: 15629367e0df1a444b54d0e1dfad4c0e, type: 3}
- type: 6
- type: 10
target: 1
amount: 2
turnCount: 3
Expand Down
2 changes: 1 addition & 1 deletion Assets/02. Scripts/Battle/Cards/Card SO/Vodka.asset
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ MonoBehaviour:
6 \uBD80\uC5EC\uD569\uB2C8\uB2E4."
sprite: {fileID: 21300000, guid: 304b9e10f3c2f844785bd1488737cf5f, type: 3}
skills:
- type: 8
- type: 11
target: 2
amount: 6
turnCount: 2
Expand Down
22 changes: 13 additions & 9 deletions Assets/02. Scripts/Battle/Cards/CardData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,19 @@
// 카드의 종류
public enum SkillType
{
Attack, // 공격
Shield, // 실드 생성
Heal, // 체력 회복
Cleanse, // 디버프 제거
RestoreCost, // 코스트 회복
Draw, // 카드 드로우
Bleed, // 출혈
AddExtraDamage, // 추가 데미지 제공
Burn, // 화상
Attack = 0, // 공격
Shield = 1, // 실드 생성
Heal = 2, // 체력 회복
Cleanse = 3, // 디버프 제거
RestoreCost = 4, // 코스트 회복
Draw = 5, // 카드 드로우
Bleed = 6, // 출혈 데미지 (한 턴)
Burn = 7, // 화상 데미지 (한 턴)
AddExtraDamage = 8, // 추가 데미지 제공 (한 턴)
LingeringHeal = 9, // 지속 회복
LingeringBleed = 10, // 출혈 (지속)
LingeringBurn = 11, // 화상 (지속)
LingeringExtraDamage = 12, // 추가 데미지 제공 (지속)
}

public enum SkillTarget
Expand Down
19 changes: 1 addition & 18 deletions Assets/02. Scripts/Battle/Cards/CardManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,6 @@ void Start()
cardBackObjectList[i].SetActive(false);
}
#endregion

GameManager.Instance.onStartBattle.AddListener(StartBattle);
}

private void Update()
Expand Down Expand Up @@ -130,13 +128,6 @@ private void EnrollComponent()
effectGroup = GameObject.Find("Effect Group").transform;
}

private void StartBattle()
{
UpdateDeckCount();
MergeDumpToDeck();
SetUpDeck();
}

// 카드를 덱에 추가한다. (string)
public void AddCardToDeck(string cardName)
{
Expand Down Expand Up @@ -349,7 +340,7 @@ public void ClearSelectCard()
}

// dump와 hand를 덱으로 모아서 셔플
public void SetUpDeck()
public void ResetDeck()
{
// hand의 카드들을 deck에 추가하고 오브젝트 파괴
for (int i = 0; i < hand.Count; i++)
Expand All @@ -367,14 +358,6 @@ public void SetUpDeck()
ShuffleDeck();
}

// dump를 deck에 모아 셔플
void ResetDeck()
{
MergeDumpToDeck();

ShuffleDeck();
}

public void MergeDumpToDeck()
{
// dump의 카드들을 deck에 추가
Expand Down
96 changes: 51 additions & 45 deletions Assets/02. Scripts/Battle/Character/Character.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@
using System.Collections.Generic;
using TMPro;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;
using DG.Tweening;

public class BuffEffect
{
public BuffEffect(SkillType type, int damagePerTurn, int remainingTurns)
public BuffEffect(SkillType type, int amount, int remainingTurns)
{
this.type = type;
this.damagePerTurn = damagePerTurn;
this.amount = amount;
this.remainingTurns = remainingTurns;
}

public SkillType type;
public int damagePerTurn;
public int amount;
public int remainingTurns;
}

Expand Down Expand Up @@ -47,36 +47,29 @@ public class Character : MonoBehaviour
// 추가 방어력. 데미지 계산 식에 적용
public int bonusArmor = 0;

// 디버그용, 추후 삭제
[Header("컴포넌트")]
[Header("일러스트")]
// 스프라이트
protected Image imageComponent;

[Header("HP 바")]
// HP 바
[SerializeField] protected Image hpBar;
[SerializeField] protected TMP_Text hpText;
// 실드 바
protected Image shieldBar;
// 버프 아이콘 생성기 구현 예정 -> 오브젝트 풀링으로 대체
protected Transform statusPanel;
// 디버프창
protected List<buffIconComponent> buffIcons;
protected TMP_Text[] buffName;
protected TMP_Text[] buffDescription;
[SerializeField] protected Image shieldBar;

// 데미지 텍스트
[SerializeField] protected GameObject damageTextPrefab;

[Header("상태이상")]
protected Transform buffIconContainer;
protected List<BuffEffect> buffs;

[Header("이벤트")]
protected UnityEvent onTurnStarted;

public virtual void Awake()
{

}
[SerializeField] protected Transform buffIconContainer;
[SerializeField] protected List<BuffEffect> buffs;
// 버프 아이콘 생성기 구현 예정 -> 오브젝트 풀링으로 대체
[SerializeField] protected Transform statusPanel;
// 디버프창
[SerializeField] protected List<buffIconComponent> buffIcons;
[SerializeField] protected TMP_Text[] buffName;
[SerializeField] protected TMP_Text[] buffDescription;

// 컴포넌트들을 등록한다.
protected virtual void EnrollComponents()
Expand Down Expand Up @@ -118,13 +111,19 @@ protected virtual void EnrollComponents()
}
}

protected virtual void StartBattle()
public virtual void ResetState()
{
UpdateShieldUI();
// 스탯을 초기화한다.
ResetStat();

// 체력 데이터 및 UI를 초기화한다.
currentHp = maxHp;
shield = 0;
UpdateHPUI();
UpdateShieldUI();

// 버프를 제거한다.
CleanseDebuff();
ResetStat();
}

#region HP
Expand Down Expand Up @@ -291,7 +290,7 @@ public void EnrollBuff(BuffEffect bleedEffect)

// 출혈 디버프 UI 추가
int i = buffs.Count - 1;

UpdateBuffIcon(i);
}

Expand All @@ -305,14 +304,21 @@ public void CleanseDebuff()

public void UpdateBuffIcon(int index)
{
if (buffs[index].remainingTurns <= 0)
{
return;
}

// i번째 아이콘와 숫자를 변경하고
buffIcons[index].image.sprite = CardInfo.Instance.skillIcons[(int)buffs[index].type];
buffIcons[index].tmp_Text.text = buffs[index].remainingTurns.ToString();

// i번째 디버프창의 내용을 갱신한다
buffName[index].text = DebuffInfo.debuffNameDict[buffs[index].type];
// 이렇게 $와 {}를 쓰면 변수명과 문자열을 섞어쓸 수 있다.
buffDescription[index].text = $"{buffs[index].remainingTurns}{DebuffInfo.debuffDescriptionDict[buffs[index].type]}";
// 스킬 텍스트를 만든다.
SkillText buffText = DebuffInfo.GetSkillText(buffs[index]);
// 텍스트를 변경한다.
buffName[index].text = buffText.name;
buffDescription[index].text = buffText.description;

// 오브젝트 활성화
// 이 구문들은 리팩토링이 필요해보인다.
Expand All @@ -335,47 +341,47 @@ public void UpdateAllBuffIcon()
for (; i < buffIconContainer.childCount; ++i)
{
// 비활성화한다.
// 아이콘 비활성화
buffIconContainer.GetChild(i).gameObject.SetActive(false);
buffName[i].gameObject.transform.parent.gameObject.SetActive(false);
// 상세정보창 비활성화
buffName[i].transform.parent.gameObject.SetActive(false);
}
}

// 출혈 효과를 발생시킨다.
public void GetBleedAll()
public void GetBuffAll()
{
// 받게 될 전체 데미지
int totalDamage = 0;
// 스탯 초기화
ResetStat();

// 모든 적용 중인 출혈 효과에 대해
for(int i = 0; i < buffs.Count; ++i)
for (int i = 0; i < buffs.Count; ++i)
{
totalDamage += buffs[i].damagePerTurn;
// 스킬 발동
CardInfo.Instance.ActivateSkill(buffs[i], this, this);

// 남은 턴 1 감소
--buffs[i].remainingTurns;
// 남은 턴이 0 이하라면
if (buffs[i].remainingTurns <= 0)
{
// 해당 출혈 효과를 삭제한다.
// 해당 효과를 삭제한다.
buffs.RemoveAt(i);
// 뒤의 디버프들이 1칸씩 앞으로 땡겨졌으니, 인덱스도 1 앞으로 조정
--i;
}
}

// 출혈 이펙트 재생
// 이펙트 재생

// 체력을 감소시킨다.
DecreaseHP(totalDamage);
// 0.1초 딜레이
// yield return new WaitForSeconds(0.1f);
}

// 아이콘을 업데이트 한다.
// 아이콘 최신화
UpdateAllBuffIcon();
}
#endregion 디버프

#region 스텟

// 모든 능력치 값을 초기화한다.
public void ResetStat()
{
bonusAttackStat = 0;
Expand Down
Loading

0 comments on commit 2593e88

Please sign in to comment.