コード例 #1
0
    void OnTriggerEnter(Collider other)
    {
        if (other.tag == "Player")
        {
            int type = player.GetState();
            player.SetBulletsType(weaponType);
            switch (type)
            {
            case 1:
                obj = (GameObject)Instantiate(w1);
                obj.transform.position = transform.position + new Vector3(0, height, 0);
                break;

            case 2:
                obj = (GameObject)Instantiate(w2);
                obj.transform.position = transform.position + new Vector3(0, height, 0);
                break;

            case 3:
                obj = (GameObject)Instantiate(w3);
                obj.transform.position = transform.position + new Vector3(0, height, 0);
                break;

            case 4:
                obj = (GameObject)Instantiate(w4);
                obj.transform.position = transform.position + new Vector3(0, height, 0);
                break;

            default:
                obj = (GameObject)Instantiate(w1);
                obj.transform.position = transform.position + new Vector3(0, height, 0);
                break;
            }

            destroy = true;
        }
    }