Example #1
0
    void Spawn(int pnumDrop, GameObject pnumBackgroundObj)
    {
        switch (pnumDrop)
        {
        case 1:
            p1Drop        = true;
            p1Cursor      = Instantiate(Cursor, new Vector3(0, 0, 20), this.transform.rotation) as GameObject;
            p1Cursor.name = "p1Cursor";
            p1Logo.SetActive(false);
            //p1Cursor.gameObject.GetComponentInChildren<GameObject>().GetComponentInChildren<MeshRenderer>().material = CursorMats[0];
            Transform tempGO1 = p1Cursor.GetComponentInChildren <Transform>();
            tempGO1.GetComponentInChildren <MeshRenderer>().material = CursorMats[0];
            break;

        case 2:
            p2Drop        = true;
            p2Cursor      = Instantiate(Cursor, new Vector3(0, 0, 20), this.transform.rotation) as GameObject;
            p2Cursor.name = "p2Cursor";
            p2Logo.SetActive(false);
            Transform tempGO2 = p2Cursor.GetComponentInChildren <Transform>();
            tempGO2.GetComponentInChildren <MeshRenderer>().material = CursorMats[1];
            break;

        case 3:
            p3Drop        = true;
            p3Cursor      = Instantiate(Cursor, new Vector3(0, 0, 20), this.transform.rotation) as GameObject;
            p3Cursor.name = "p3Cursor";
            p3Logo.SetActive(false);
            Transform tempGO3 = p3Cursor.GetComponentInChildren <Transform>();
            tempGO3.GetComponentInChildren <MeshRenderer>().material = CursorMats[2];
            break;

        case 4:
            p4Drop        = true;
            p4Cursor      = Instantiate(Cursor, new Vector3(0, 0, 20), this.transform.rotation) as GameObject;
            p4Cursor.name = "p4Cursor";
            p4Logo.SetActive(false);
            Transform tempGO4 = p4Cursor.GetComponentInChildren <Transform>();
            tempGO4.GetComponentInChildren <MeshRenderer>().material = CursorMats[3];
            break;
        }
        CM.FindTB(pnumBackgroundObj);
        God.PlayerAdd();
        //pnumBackgroundObj.SetActive(true);
    }