[Update] 게임형식 및 오류수정
1. 게임형태 변경 - Game스텝에서 기존 1단계, 2단계 수정(회전만 가능하게). - ShootButton을 만들어 플레이어도 총알을 쏠수 있도록 수정. - Bullet, BulletSpawner, PlayerController를 수정 - SpawnZone을 생성하여 기존 고정이던 스포너를 랜덤으로 생성. 2. 오류 수정 - 모바일 버전 시 플레이어가 한방향만 보던 형상 수정. - 펜스에서 플레이어 캐릭터가 닿으면 회전하던 형상 수정.
This commit is contained in:
+29
-29
@@ -4,11 +4,16 @@ public class Bullet : MonoBehaviour
|
||||
{
|
||||
public float speed = 8f;
|
||||
private Rigidbody rb;
|
||||
|
||||
public GameObject effect;
|
||||
|
||||
public AudioSource audioSource;
|
||||
public AudioClip clip;
|
||||
public bool isPlayerBullet = false;
|
||||
|
||||
void Start()
|
||||
{
|
||||
rb = GetComponent<Rigidbody>();
|
||||
rb.linearVelocity = transform.forward * speed;
|
||||
Destroy(gameObject, 3f);
|
||||
}
|
||||
|
||||
private void OnTriggerEnter(Collider other)
|
||||
{
|
||||
@@ -19,33 +24,28 @@ public class Bullet : MonoBehaviour
|
||||
|
||||
if (other.CompareTag("Player"))
|
||||
{
|
||||
Instantiate(effect, other.transform.position, Quaternion.identity);
|
||||
|
||||
PlayerController pc = other.GetComponent<PlayerController>();
|
||||
if (pc != null)
|
||||
if (!isPlayerBullet)
|
||||
{
|
||||
pc.Die();
|
||||
GameObject.Find("The_Lead_Hits_Deep").GetComponent<AudioSource>().Stop();
|
||||
Instantiate(effect, other.transform.position, Quaternion.identity);
|
||||
PlayerController pc = other.GetComponent<PlayerController>();
|
||||
if (pc != null)
|
||||
{
|
||||
pc.Die();
|
||||
GameManager.instance.PlayDeathMusic();
|
||||
}
|
||||
Destroy(gameObject);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (other.CompareTag("Spawner"))
|
||||
{
|
||||
if (isPlayerBullet)
|
||||
{
|
||||
Destroy(other.gameObject);
|
||||
Destroy(gameObject);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// 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()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user