Unity3D에서 문제가 있습니다. 나는 플레이어와 적 모두에게 동일한 건강 스크립트를 첨부했습니다. 플레이어가 죽었을 때 게임 오버 메시지를 보여주고 싶지만 죽을 때 메시지 오버 게임이 플레이어와 적 모두에게 나타납니다.화합으로 스크립팅하기 3d
내 코드처럼 보이는 :
public class CharacterStats : MonoBehaviour
{
// Use this for initialization
void Start()
{
}
// Update is called once per frame
void Update()
{
health = Mathf.Clamp (health, 0, 100);
}
public void damage(float damage)
{
health -= damage;
if(health<=0)
{
Die();
Application.LoadLevel(gameover);
}
}
void Die()
{
characterController.enabled = false;
if (scriptstodisable.Length == 0)
return;
foreach (MonoBehaviour scripts in scriptstodisable)
scripts.enabled = false;
if (ragdollmanger != null)
ragdollmanger.Raggdoll();
}
}
당신은 당신의 캐릭터 (플레이어 또는 적) 및 쇼 '다이'메시지의 유형을 설명 열거를 추가 할 수 있습니다하는 경우에만 열거의 값 == 플레이어까지 .. (Y)의 작업 엄지 손가락 형제 – V319