Exemple #1
0
    void OnTriggerEnter2D(Collider2D other)
    {
        //tag 1: girl, 2: police 3: item1(무적), 4: item2(복제)
        IEnumerator coroutine;

        switch (other.tag)
        {
        case "1":
            _score.AddGirlScore();
            //player가 item을 먹었는지 판단
            Destroy(other.gameObject);
            break;

        case "2":
            //player가 item을 먹었는지 판단
            if (!_gameParam.UsingItem1 && _gameParam.HavingItem1)
            {
                _gameParam.HavingItem1 = false;
                _gameParam.UsingItem1  = true;
                coroutine = WaitItem(3.0f, 1);
                StartCoroutine(coroutine);
            }
            else if (_gameParam.UsingItem1)
            {
            }
            else
            {
                _gameParam.gameOver = true;
                print("Die");
                //GAME OVER
                _uiSetting.ShowPanel(0);
            }
            gameOver = _gameParam.gameOver;
            break;

        case "3":
            _gameParam.HavingItem1 = true;
            Destroy(other.gameObject);
            break;

        case "4":
            //
            _genfake.GenPlayer(transform.position);
            Destroy(other.gameObject);
            break;
        }
    }