Commit 206d4042 authored by 15김민규's avatar 15김민규

허수아비 코드 짰으니깐 이거 쓰셈 다시는 이러지 마라...

parent 3ebf24c4
fileFormatVersion: 2
guid: f0e3b19ee969d4f429ee9d8430bb4a58
guid: 8577ae016a412764684fcba81af639cb
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 7400000
......
......@@ -943,12 +943,42 @@ Prefab:
- target: {fileID: 224071041299093070, guid: e6794ab8e2e4c6340a23b382e9497cbb,
type: 2}
propertyPath: m_RootOrder
value: 4
value: 5
objectReference: {fileID: 0}
- target: {fileID: 224804297962416264, guid: e6794ab8e2e4c6340a23b382e9497cbb,
type: 2}
propertyPath: m_RootOrder
value: 5
value: 7
objectReference: {fileID: 0}
- target: {fileID: 224612213790397690, guid: e6794ab8e2e4c6340a23b382e9497cbb,
type: 2}
propertyPath: m_RootOrder
value: 4
objectReference: {fileID: 0}
- target: {fileID: 224851610276147026, guid: e6794ab8e2e4c6340a23b382e9497cbb,
type: 2}
propertyPath: m_AnchoredPosition.y
value: -675
objectReference: {fileID: 0}
- target: {fileID: 224612213790397690, guid: e6794ab8e2e4c6340a23b382e9497cbb,
type: 2}
propertyPath: m_AnchoredPosition.y
value: -580
objectReference: {fileID: 0}
- target: {fileID: 224293546598734980, guid: e6794ab8e2e4c6340a23b382e9497cbb,
type: 2}
propertyPath: m_AnchoredPosition.y
value: -487
objectReference: {fileID: 0}
- target: {fileID: 224071041299093070, guid: e6794ab8e2e4c6340a23b382e9497cbb,
type: 2}
propertyPath: m_AnchoredPosition.y
value: -440
objectReference: {fileID: 0}
- target: {fileID: 224804297962416264, guid: e6794ab8e2e4c6340a23b382e9497cbb,
type: 2}
propertyPath: m_AnchoredPosition.y
value: -394
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: e6794ab8e2e4c6340a23b382e9497cbb, type: 2}
......@@ -1036,7 +1066,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 131, y: -605}
m_AnchoredPosition: {x: 131, y: -628}
m_SizeDelta: {x: 200, y: 50}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1204443556
......
......@@ -3,7 +3,7 @@ using System.Collections;
using UnityEngine;
using Random = UnityEngine.Random;
public abstract class Enemy : MonoBehaviour {
public class Enemy : MonoBehaviour {
// data
......@@ -12,8 +12,8 @@ public abstract class Enemy : MonoBehaviour {
[SerializeField]
DebuffState[] debuffState;
float fireDuration = 0.0f;
protected abstract IEnumerator OnIce(float duration);
protected abstract IEnumerator OnStun(float duration);
protected virtual IEnumerator OnIce(float duration) { yield return 0; }
protected virtual IEnumerator OnStun(float duration) { yield return 0; }
// protected abstract IEnumerator OnBlind(float duration);
// protected abstract IEnumerator OnCharm(float duration);
......@@ -41,7 +41,7 @@ public abstract class Enemy : MonoBehaviour {
public bool Invisible { get; protected set; }
public bool KnockbackLock { get; protected set; }
public float PlayerDistance { get; protected set; }
protected abstract IEnumerator Knockback(float knockbackDist, float knockbackTime);
protected virtual IEnumerator Knockback(float knockbackDist, float knockbackTime) { yield return 0; }
// drop item
private int[] dropTable;
......@@ -73,7 +73,7 @@ public abstract class Enemy : MonoBehaviour {
{
currHealth = maxHealth;
Invisible = MovementLock = KnockbackLock = false;
dropTable = enemyManager.DropTableByID[monsterID];
if (enemyManager.DropTableByID.ContainsKey(monsterID)) { dropTable = enemyManager.DropTableByID[monsterID]; }
PlayerDistance = Vector2.Distance(enemyManager.Player.transform.position, transform.parent.position);
}
......@@ -85,12 +85,12 @@ public abstract class Enemy : MonoBehaviour {
// When damaged
// - Calculate value & Arrange information
public void GetDamaged(PlayerAttackInfo attack)
public virtual void GetDamaged(PlayerAttackInfo attack)
{
if (Invisible) { return; }
string objectName = gameObject.transform.parent.name;
float prevHealth = currHealth;
currHealth -= attack.damage;
if (currHealth <= 0)
{
Invisible = true;
......@@ -99,60 +99,31 @@ public abstract class Enemy : MonoBehaviour {
GetComponent<SpriteRenderer>().color = Color.white;
return;
}
DebuffApply(attack.debuffTime);
float knockbackDist = attack.damage * attack.knockBackMultiplier / weight;
float knockbackTime = (knockbackDist >= 0.5f) ? 0.5f : knockbackDist;
if (objectName == "NotDyingScarecrow(Clone)")
if (MovementLock) // 넉백이 진행 중
{
if (currHealth <= 0)
{
prevHealth = maxHealth;
currHealth = maxHealth;
return;
}
if (currHealth < prevHealth)
animator.SetTrigger("DamagedTrigger");
StopCoroutine("Knockback");
}
StartCoroutine(Knockback(knockbackDist, knockbackTime));
float currHealthPercentage = currHealth / maxHealth;
float prevHealthPercentage = prevHealth / maxHealth;
else
foreach (float percentage in knockbackPercentage)
{
if (currHealth <= 0)
{
Invisible = true;
animator.SetTrigger("DeadTrigger");
return;
}
if (objectName == "DyingScarecrow(Clone)")
{
if (currHealth < prevHealth)
animator.SetTrigger("DamagedTrigger");
}
else
if (currHealthPercentage > percentage) { break; }
if (prevHealthPercentage > percentage)
{
DebuffApply(attack.debuffTime);
float knockbackDist = attack.damage * attack.knockBackMultiplier / weight;
float knockbackTime = (knockbackDist >= 0.5f) ? 0.5f : knockbackDist;
if (MovementLock) // 넉백이 진행 중
{
StopCoroutine("Knockback");
}
StartCoroutine(Knockback(knockbackDist, knockbackTime));
float currHealthPercentage = currHealth / maxHealth;
float prevHealthPercentage = prevHealth / maxHealth;
foreach (float percentage in knockbackPercentage)
{
if (currHealthPercentage > percentage) { break; }
if (prevHealthPercentage > percentage)
{
animator.SetTrigger("DamagedTrigger");
break;
}
}
animator.SetTrigger("TrackTrigger");
animator.SetTrigger("DamagedTrigger");
break;
}
}
animator.SetTrigger("TrackTrigger");
}
public void GetDamaged(float damage)
......@@ -302,7 +273,11 @@ public abstract class Enemy : MonoBehaviour {
StopAllCoroutines();
enemyManager.EnemyDeadCount++; // 다른 enemy로 인해 소환되는 enemy가 추가될 경우 여기를 건드려야 함
currHealth = maxHealth;
Invisible = false;
// Drop 아이템 결정. 인덱스 별 아이템은 맨 밑에 서술
if (dropTable == null) { return; }
float denominator = dropTable[dropTable.Length - 1];
float numerator = Random.Range(0, denominator);
int indexOfItem = 0;
......@@ -338,10 +313,6 @@ public abstract class Enemy : MonoBehaviour {
{
inventoryManager.AddonInstantiate((ItemQuality)(indexOfItem - 12), transform.parent.position, EnemyManager.dropObjStrength);
}
currHealth = maxHealth;
Invisible = false;
return;
}
public void aaa()
......
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Scarecrow : Enemy {
public bool neverDie;
public override void GetDamaged(PlayerAttackInfo attack)
{
if (Invisible) { return; }
float prevHealth = currHealth;
currHealth -= attack.damage;
if (currHealth <= 0)
{
if (neverDie)
{
prevHealth = maxHealth;
currHealth = maxHealth;
}
else
{
Invisible = true;
animator.SetTrigger("DeadTrigger");
return;
}
}
animator.SetTrigger("DamagedTrigger");
}
}
fileFormatVersion: 2
guid: bf69b9b0b3af3664e89e16eab14c1b0c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
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