Commit e7be3fc3 authored by 18류지석's avatar 18류지석

공격 정보 클래스화, 적에게 맞으면 피 깎임

parent e4de4bcb
...@@ -83,7 +83,7 @@ MonoBehaviour: ...@@ -83,7 +83,7 @@ MonoBehaviour:
lifeStoneLocation: {x: 7, y: 7} lifeStoneLocation: {x: 7, y: 7}
standardImage: {fileID: 1001509239983906, guid: a48de94a6ab80f746aec69a02812f1e3, standardImage: {fileID: 1001509239983906, guid: a48de94a6ab80f746aec69a02812f1e3,
type: 2} type: 2}
lifeStoneRowNum: 8 lifeStoneRowNum: 6
lifeStoneSize: 40 lifeStoneSize: 40
sprites: sprites:
- {fileID: 21300004, guid: eff441d843b9c664e97a81fcb39d8410, type: 3} - {fileID: 21300004, guid: eff441d843b9c664e97a81fcb39d8410, type: 3}
......
...@@ -696,6 +696,12 @@ GameObject: ...@@ -696,6 +696,12 @@ GameObject:
m_CorrespondingSourceObject: {fileID: 1939101680453256, guid: c179f0931cfabec428a868a6edc543b0, m_CorrespondingSourceObject: {fileID: 1939101680453256, guid: c179f0931cfabec428a868a6edc543b0,
type: 2} type: 2}
m_PrefabInternal: {fileID: 1711972807} m_PrefabInternal: {fileID: 1711972807}
--- !u!114 &1206751493 stripped
MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 114920782405449110, guid: c179f0931cfabec428a868a6edc543b0,
type: 2}
m_PrefabInternal: {fileID: 1711972807}
m_Script: {fileID: 11500000, guid: 7fe540ec78947fc449eabc76bd87823d, type: 3}
--- !u!224 &1209430809 stripped --- !u!224 &1209430809 stripped
RectTransform: RectTransform:
m_CorrespondingSourceObject: {fileID: 224402251087470820, guid: c179f0931cfabec428a868a6edc543b0, m_CorrespondingSourceObject: {fileID: 224402251087470820, guid: c179f0931cfabec428a868a6edc543b0,
...@@ -957,6 +963,11 @@ Prefab: ...@@ -957,6 +963,11 @@ Prefab:
propertyPath: inventoryManager propertyPath: inventoryManager
value: value:
objectReference: {fileID: 2035175000} objectReference: {fileID: 2035175000}
- target: {fileID: 114880704145925944, guid: 3d077a5f727dd1e4780e9265ed26e036,
type: 2}
propertyPath: lifeStoneManager
value:
objectReference: {fileID: 1206751493}
m_RemovedComponents: [] m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 3d077a5f727dd1e4780e9265ed26e036, type: 2} m_SourcePrefab: {fileID: 100100000, guid: 3d077a5f727dd1e4780e9265ed26e036, type: 2}
m_IsPrefabAsset: 0 m_IsPrefabAsset: 0
...@@ -1141,10 +1152,6 @@ Prefab: ...@@ -1141,10 +1152,6 @@ Prefab:
propertyPath: m_Pivot.y propertyPath: m_Pivot.y
value: 0 value: 0
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 1939101680453256, guid: c179f0931cfabec428a868a6edc543b0, type: 2}
propertyPath: m_IsActive
value: 1
objectReference: {fileID: 0}
m_RemovedComponents: [] m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: c179f0931cfabec428a868a6edc543b0, type: 2} m_SourcePrefab: {fileID: 100100000, guid: c179f0931cfabec428a868a6edc543b0, type: 2}
m_IsPrefabAsset: 0 m_IsPrefabAsset: 0
......
...@@ -13,8 +13,10 @@ public class AttackProperty : MonoBehaviour{ ...@@ -13,8 +13,10 @@ public class AttackProperty : MonoBehaviour{
if (collision.CompareTag("Enemy")) if (collision.CompareTag("Enemy"))
{ {
PlayerAttackInfo curAttack = new PlayerAttackInfo(damage, knockBackMultiplier, debuffNum, debuffType, debuffTime);
Enemy enemyInfo = collision.transform.GetChild(0).GetComponent<Enemy>();
Debug.Log("Ugh!"); Debug.Log("Ugh!");
collision.transform.GetChild(0).GetComponent<Enemy>().GetDamaged(damage); collision.transform.GetChild(0).GetComponent<Enemy>().GetDamaged(curAttack);
} }
} }
} }
...@@ -63,8 +63,8 @@ public class Enemy : MonoBehaviour { ...@@ -63,8 +63,8 @@ public class Enemy : MonoBehaviour {
} }
// hit by player or debuff // hit by player or debuff
public void GetDamaged(float damage) { public void GetDamaged(PlayerAttackInfo attack) {
currHealth -= damage; currHealth -= attack.damage;
if(currHealth <= 0) { if(currHealth <= 0) {
gameObject.SetActive(false); gameObject.SetActive(false);
return; return;
......
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class EnemyAttackInfo {
public float damage = 0;
public float knockBackMultiplier = 1f;
public int debuffNum = 0;
public PlayerDebuffCase[] debuffType = new PlayerDebuffCase[10];
public int[] debuffTime = new int[10];
public EnemyAttackInfo(float damage, float knockBackMultiplier, int debuffNum, PlayerDebuffCase[] debuffType, int[] debuffTime)
{
this.damage = damage;
this.knockBackMultiplier = knockBackMultiplier;
this.debuffNum = debuffNum;
this.debuffType = debuffType;
this.debuffTime = debuffTime;
}
}
fileFormatVersion: 2
guid: a86d0d10499f2ce44bf3990328cde908
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
...@@ -17,6 +17,7 @@ public class PlayerAttack : MonoBehaviour { ...@@ -17,6 +17,7 @@ public class PlayerAttack : MonoBehaviour {
public AnimatorOverrideController aoc; public AnimatorOverrideController aoc;
public AnimationClip[] normalAttack = new AnimationClip[3]; public AnimationClip[] normalAttack = new AnimationClip[3];
public InventoryManager inventoryManager; public InventoryManager inventoryManager;
public LifeStoneManager lifeStoneManager;
float comboEndTime; float comboEndTime;
bool comboTimeOn; bool comboTimeOn;
...@@ -170,4 +171,9 @@ public class PlayerAttack : MonoBehaviour { ...@@ -170,4 +171,9 @@ public class PlayerAttack : MonoBehaviour {
return true; return true;
return false; return false;
} }
public void TakeDamage(EnemyAttackInfo attack)
{
lifeStoneManager.DestroyStone((int)Mathf.Ceil(attack.damage));
}
} }
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerAttackInfo {
public float damage = 0;
public float knockBackMultiplier = 1f;
public int debuffNum = 0;
public EnemyDebuffCase[] debuffType = new EnemyDebuffCase[10];
public int[] debuffTime = new int[10];
public PlayerAttackInfo(float damage, float knockBackMultiplier, int debuffNum, EnemyDebuffCase[] debuffType, int[] debuffTime)
{
this.damage = damage;
this.knockBackMultiplier = knockBackMultiplier;
this.debuffNum = debuffNum;
this.debuffType = debuffType;
this.debuffTime = debuffTime;
}
}
fileFormatVersion: 2
guid: 6147d59b2c75e6142b01390e112e897f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
...@@ -9,7 +9,8 @@ public class DamageToPlayer : MonoBehaviour { ...@@ -9,7 +9,8 @@ public class DamageToPlayer : MonoBehaviour {
{ {
if (collision.CompareTag("Player")) if (collision.CompareTag("Player"))
{ {
Debug.Log("Auch!"); EnemyAttackInfo attack = new EnemyAttackInfo(damage, 1f, 0, null, null);
collision.gameObject.GetComponent<PlayerAttack>().TakeDamage(attack);
} }
} }
} }
...@@ -6,7 +6,10 @@ ...@@ -6,7 +6,10 @@
blind, blind,
charm charm
}; };
public enum PlayerDebuffCase
{
}
public enum ItemQuality public enum ItemQuality
{ {
Study, Study,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment