-
Notifications
You must be signed in to change notification settings - Fork 2
/
SwordCollider.cs
34 lines (28 loc) · 972 Bytes
/
SwordCollider.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class SwordCollider : MonoBehaviour
{
public float damage = 20.0f;
// Start is called before the first frame update
void Start()
{
//damage = GameManager.instance.player.atk;
}
// Update is called once per frame
void Update()
{
}
private void OnTriggerEnter(Collider other)
{
if (other.gameObject.layer == LayerMask.NameToLayer("Monster"))
{
LivingEntity attackTarget = other.GetComponent<LivingEntity>();
//������ �ǰ� ��ġ�� �ǰ� ������ �ٻ����� ���
Vector3 hitPoint = other.ClosestPoint(transform.position);
Vector3 hitnomal = transform.position - other.transform.position;
//���� ����
attackTarget.OnDamage(damage, hitPoint, hitnomal);
}
}
}