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

화살이 벽에 박힘

parent 50afa1b6
......@@ -114,7 +114,10 @@ MonoBehaviour:
m_Bits: 65536
vanishLayer:
serializedVersion: 2
m_Bits: 65792
m_Bits: 65536
stopLayer:
serializedVersion: 2
m_Bits: 256
attackCombo:
--- !u!114 &114988624070961888
MonoBehaviour:
......
......@@ -2,7 +2,7 @@
using System.Collections.Generic;
using UnityEngine;
public class AttackProperty : MonoBehaviour{
public class AttackProperty : MonoBehaviour {
public float damage = 0;
public float knockBackMultiplier = 1f;
public float[] debuffTime = new float[(int)EnemyDebuffCase.END_POINTER];
......@@ -11,6 +11,7 @@ public class AttackProperty : MonoBehaviour{
InventoryManager inventoryManager;
public LayerMask enemyLayer;
public LayerMask vanishLayer;
public LayerMask stopLayer;
public string attackCombo;
private void Awake()
......@@ -26,13 +27,13 @@ public class AttackProperty : MonoBehaviour{
private void OnTriggerEnter2D(Collider2D collision)
{
Bounds tmpBounds = new Bounds();
if ((enemyLayer == (enemyLayer | 1 << collision.gameObject.layer)) && !collision.transform.GetChild(0).GetComponent<Enemy>().Invisible)
{
PlayerAttackInfo curAttack = new PlayerAttackInfo(damage, knockBackMultiplier, debuffTime);
Enemy enemyInfo = collision.transform.GetChild(0).GetComponent<Enemy>();
foreach (Item tmpItem in inventoryManager.itemList)
for (int i = 0; i < tmpItem.skillNum; i++)
{
......@@ -44,7 +45,7 @@ public class AttackProperty : MonoBehaviour{
}
collision.transform.GetChild(0).GetComponent<Enemy>().GetDamaged(curAttack);
//make effect
foreach (Collider2D col in GetComponents<Collider2D>())
if (col.isActiveAndEnabled)
......@@ -54,9 +55,21 @@ public class AttackProperty : MonoBehaviour{
effectManager.StartEffect(0, tmpBounds, collision.bounds);
}
if(projectileType == 1 && (vanishLayer == (vanishLayer | 1 << collision.gameObject.layer)))
if (projectileType == 1 && (vanishLayer == (vanishLayer | 1 << collision.gameObject.layer)))
{
Destroy(gameObject);
}
if (projectileType == 1 && (stopLayer == (stopLayer | 1 << collision.gameObject.layer)))
{
GetComponent<Rigidbody2D>().velocity = Vector2.zero;
GetComponent<Collider2D>().enabled = false;
StartCoroutine(WaitVanish(10f));
}
}
IEnumerator WaitVanish(float time)
{
yield return new WaitForSeconds(time);
Destroy(gameObject);
}
}
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