void dead() { Vector3 deadVet = transform.position; deadVet.y = 2.5f; GameObject thenewgam; switch (the_kind) { case 1: //军人 if (MENTGET.Getbody("deadZombie_Army", deadVet, Quaternion.Euler(0, Random.Range(-180f, 180f), 0)) == null) { Instantiate(Zomble, deadVet, Quaternion.Euler(0, Random.Range(-180f, 180f), 0)); } MENTGET.putbody("deadArmy", gameObject); break; case 2: //普通人 thenewgam = MENTGET.Getbody("deadZombie", deadVet, Quaternion.Euler(0, Random.Range(-180f, 180f), 0)); if (thenewgam == null) { Instantiate(Zomble, deadVet, Quaternion.Euler(0, Random.Range(-180f, 180f), 0)); } else { thenewgam.GetComponent <SkinnedMeshRenderer>().material = yinxiaod.materials[theturnindex]; thenewgam.GetComponent <ZombieAI>().thezombieway = theturnindex; } MENTGET.putbody("deadPerson", gameObject); break; case 3: //警察 if (MENTGET.Getbody("deadZombie_Police", deadVet, Quaternion.Euler(0, Random.Range(-180f, 180f), 0)) == null) { Instantiate(Zomble, deadVet, Quaternion.Euler(0, Random.Range(-180f, 180f), 0)); } MENTGET.putbody("deadPolice", gameObject); break; default: Destroy(gameObject); break; } }