d8aabbd428
1. 캐릭터, 배경 에셋 변경 2. 캐릭터 애니메이션 적용 3. 방향키에 따른 캐릭터 회전 적용
52 lines
1.1 KiB
C#
52 lines
1.1 KiB
C#
using UnityEngine;
|
|
|
|
public class Bullet : MonoBehaviour
|
|
{
|
|
public float speed = 8f;
|
|
private Rigidbody rb;
|
|
|
|
public GameObject effect;
|
|
|
|
public AudioSource audioSource;
|
|
public AudioClip clip;
|
|
|
|
private void OnTriggerEnter(Collider other)
|
|
{
|
|
if (other.CompareTag("Shield"))
|
|
{
|
|
return;
|
|
}
|
|
|
|
if (other.CompareTag("Player"))
|
|
{
|
|
Instantiate(effect, other.transform.position, Quaternion.identity);
|
|
|
|
PlayerController pc = other.GetComponent<PlayerController>();
|
|
if (pc != null)
|
|
{
|
|
pc.Die();
|
|
GameObject.Find("The_Lead_Hits_Deep").GetComponent<AudioSource>().Stop();
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
|
void Start()
|
|
{
|
|
rb = GetComponent<Rigidbody>();
|
|
rb.linearVelocity = transform.forward * speed;
|
|
|
|
Destroy(gameObject, 3f);
|
|
}
|
|
|
|
// Update is called once per frame
|
|
void Update()
|
|
{
|
|
|
|
}
|
|
}
|