private void OnTriggerEnter(Collider other) //아이템 습득 { if (other.gameObject.CompareTag("Player")) //아이템과 닿은 오브젝트의 태그가 플레이어일 경우 { smooth.GoldSound(); //골드 줍는 사운드 출력 호출 //other.GetComponent<PlayerTestMove>().Item = true; beamPaticle.SetActive(false); ItemPooling.ReturnObject(this); } }
IEnumerator Die() { if (enemyKind == MODE_KIND.Diablo) { // Enemy의를 죽이자 //죽는 애니메이션 시작 animn = 7; Instantiate(explosion, transform.position, Quaternion.identity); //4.5 초후 오브젝트 반환 yield return(new WaitForSeconds(0.5f)); this.gameObject.SetActive(false); Box.transform.position = new Vector3(transform.position.x, transform.position.y, transform.position.z); //몬스터가 죽은 자리에서 스폰 StopAllCoroutines(); //객체 반환전 모든 코루틴을 정지 } else { // Enemy의를 죽이자 //죽는 애니메이션 시작 animn = 3; Instantiate(explosion, transform.position, Quaternion.identity); //Enemy에 추가된 모든 Collider를 비활성화(모든 충돌체는 Collider를 상속했음 따라서 다음과 같이 추출 가능) //foreach (Collider coll in gameObject.GetComponentsInChildren<Collider>()) //{ // coll.enabled = false; //} //4.5 초후 오브젝트 반환 yield return(new WaitForSeconds(0.5f)); int aaa = Random.Range(1, 10); if (aaa > 5) { var Mons = ItemPooling.GetItem(); //오브젝트풀링에서 아이템을 빌려온다. //var _Mons = ItemPooling.GetItem2(); Mons.transform.position = new Vector3(transform.position.x, 0.5f, transform.position.z); //몬스터가 죽은 자리에서 스폰 //_Mons.transform.position = new Vector3(transform.position.x, 0.8f, transform.position.z); } StopAllCoroutines(); //객체 반환전 모든 코루틴을 정지 EnemyPooling.ReturnObject(this); //몬스터가 죽으면 자신을 반환 } // 포톤 추가 // 자신과 네트워크상의 모든 아바타를 삭제 //PhotonNetwork.Destroy(gameObject); }
//Queue<DropItem> dropItem = new Queue<DropItem>(); private void Awake() { Instance = this; Initialize(10); }