public void NinjaDies() { Particles_DeathBoom.Emit(50); this.gameObject.transform.position = ActiveCheckpoint.transform.position; this.GetComponent <Rigidbody2D>().velocity = Vector2.zero; //Send message to MainEventsLog. First checks if the reference path is set. If not, it will MainEventsLog from the scene. if (MainEventsLog_script == null) { MainEventsLog_script = GameObject.FindGameObjectWithTag("MainEventLog").GetComponent <MainEventsLog>(); } MainEventsLog_script.PlayerDied(); }
void OnTriggerEnter2D(Collider2D coll) { if (coll.gameObject.tag == "Player" && collected == false) { collected = true; SoulSprites.SetActive(false); SoulParticles.Emit(10); Invoke("DestroyObject", 1f); //Send message to MainEventsLog. First checks if the reference path is set. If not, it will MainEventsLog from the scene. if (MainEventsLog_script == null) { MainEventsLog_script = GameObject.FindGameObjectWithTag("MainEventLog").GetComponent <MainEventsLog>(); } } }
public void NinjaDies() { Particles_DeathBoom.Emit(50); this.gameObject.transform.position = ActiveCheckpoint.transform.position; this.GetComponent <Rigidbody2D>().velocity = Vector2.zero; if (MainEventsLog_script == null) { MainEventsLog_script = GameObject.FindGameObjectWithTag("MainEventLog").GetComponent <MainEventsLog>(); } MainEventsLog_script.PlayerDied(); }
void OnTriggerEnter2D(Collider2D coll) { if (coll.gameObject.tag == "Player" && collected == false) { collected = true; SoulSprites.SetActive(false); SoulParticles.Emit(10); Invoke("DestroyObject", 1f); //向 MainEventsLog发送消息 if (MainEventsLog_script == null) { MainEventsLog_script = GameObject.FindGameObjectWithTag("MainEventLog").GetComponent <MainEventsLog>(); } MainEventsLog_script.PlayerCollectedSoul(); } }
// Use this for initialization void Start() { if (MainEventsLog_script == null) { MainEventsLog_script = GameObject.FindGameObjectWithTag("MainEventLog").GetComponent <MainEventsLog>(); } score = MainEventsLog_script.SoulsCollected; if (score <= 5) { endString = "太菜了!你获得了" + score.ToString() + "分"; } else if (score >= 5 && score <= 10) { endString = "再接再厉!你获得了" + score.ToString() + "分"; } else if (score >= 10) { endString = "恭喜你!你获得了" + score.ToString() + "分"; } this.GetComponent <Text>().text = endString; }