Exemplo n.º 1
0
    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();
        }
    }
Exemplo n.º 2
0
    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>();
            }
            MainEventsLog_script.PlayerCollectedSoul();
        }
    }