예제 #1
0
    private void OnCollisionEnter2D(Collision2D collision)
    {
        if (collision.collider.CompareTag("Field"))
        {
            if (effectImg != null)
            {
                for (int index = 0; index < effectImg.transform.childCount; index++)
                {
                    // -> Electric
                    ElectricShow eShow = effectImg.transform.GetChild(index).GetComponent <ElectricShow>();
                    if (eShow != null)
                    {
                        effectImg.SetActive(true);
                        eShow.ChargeLighting();
                    }
                }
            }
        }

        else if (collision.collider.CompareTag("FallBorder"))
        {
            if (!fallen)
            {
                Defeated();
                fallen = true;
            }

            if (PlayerPrefs.GetString("InstructionShowed", "n") == "n")
            {
                GameObject.FindGameObjectWithTag("GMScript").GetComponent <PlrPrefsCtrl>().OutGamePlay();
            }
        }
    }