コード例 #1
0
 public void LD_Panel()
 {
     //Debug.Log("L_");
     Blade.getInstance().type = 4;
     // 노크 사운드 출력
     SoundManager.instance.PlaySound(2);
     // 상태 색깔 변경
     color_state.color = blue.color;
 }
コード例 #2
0
 public void LO_Panel()
 {
     //Debug.Log("LO");
     Blade.getInstance().type = 3;
     // 노크 사운드 출력
     SoundManager.instance.PlaySound(2);
     // 상태 색깔 변경
     color_state.color = orange.color;
 }
コード例 #3
0
    // 패널을 눌렀을 때 블레이드 타일 변경

    public void RO_Panel()
    {
        //Debug.Log("RO");
        Blade.getInstance().type = 1;
        // 노크 사운드 출력
        SoundManager.instance.PlaySound(2);
        // 상태 색깔 변경
        color_state.color = red.color;
    }
コード例 #4
0
 public void RD_Panel()
 {
     //Debug.Log("R_");
     Blade.getInstance().type = 2;
     // 노크 사운드 출력
     SoundManager.instance.PlaySound(2);
     // 상태 색깔 변경
     color_state.color = green.color;
 }
コード例 #5
0
    private void OnTriggerEnter2D(Collider2D col)
    {
        // 블레이드 타입에 따라 자를 수 있는 과일이 다름
        if (col.tag == "Blade")
        {
            switch (gameObject.tag)
            {
            case "Apple":
                if (Blade.getInstance().type != 1)
                {
                    return;
                }
                break;

            case "Blueberry":
                if (Blade.getInstance().type != 4)
                {
                    return;
                }
                break;

            case "Orange":
                if (Blade.getInstance().type != 3)
                {
                    return;
                }
                break;

            case "WaterMelon":
                if (Blade.getInstance().type != 2)
                {
                    return;
                }
                break;

            default:
                return;
            }

            ShowFloatingText();

            // 잘린 과일 rotation 변경
            Vector3 direction = (col.transform.position - transform.position).normalized;

            Quaternion rotation = Quaternion.LookRotation(direction);

            // 자르는 사운드 출력
            SoundManager.instance.PlaySound(1);

            // 잘린 과일 생성
            GameObject slicedFruit = Instantiate(fruitSlicedPrefab, transform.position, rotation);
            Destroy(slicedFruit, 3f);

            //Debug.Log("과일을 공격하셨습니다 !!");
            Destroy(gameObject);
        }
    }