コード例 #1
0
    public void SpawnOwnCat()
    {
        //Set up the filepath names for the appropriate objects
        catModel = "CatModels/CatContainer" + playerStable.currentCat;
        Debug.Log(catModel);
        catSkin = "Skins/CatSkin00" + playerStable.catSkinCurrent[playerStable.currentCat];


        Debug.Log(catModel + catSkin + catHead + catCollar);
        //GameObject cat = Instantiate(Resources.Load(catModel, typeof(GameObject)), transform.position, transform.rotation) as GameObject;
        cat = Instantiate(Resources.Load(catModel), transform.position, transform.rotation) as GameObject;
        cat.transform.SetParent(gameObject.transform);

        catPointerScript  = cat.GetComponent <CatPointerScript>();
        catCustom         = catPointerScript.catPointer.GetComponent <CatCustomiseScript>();
        catCustom.catSkin = Resources.Load(catSkin) as Texture;

        if (playerStable.catHeadCurrent[playerStable.currentCat] != -1)
        {
            catHead           = "HeadItems/HeadItems00" + playerStable.catHeadCurrent[playerStable.currentCat];
            catCustom.catHead = Resources.Load(catHead) as GameObject;
            Debug.Log(catHead);
        }
        if (playerStable.catCollarCurrent[playerStable.currentCat] != -1)
        {
            catCollar           = "CollarItems/CollarItems00" + playerStable.catCollarCurrent[playerStable.currentCat];
            catCustom.catCollar = Resources.Load(catCollar) as GameObject;
            Debug.Log(catCollar);
        }

        catCustom.catName  = playerStable.catName[playerStable.currentCat];
        catCustom.catOwner = playerDetails.userName;
        cat = CatScripts(catPointerScript.catPointer);


        //GameObject catInstance = Instantiate(cat, transform.position, transform.rotation) as GameObject;


        foreach (GameObject catPiece in runningCatObjects)
        {
            catPiece.transform.SetParent(cat.transform);
        }
    }
コード例 #2
0
    public void SpawnChallengerCat()
    {
        //Set up the filepath names for the appropriate objects
        catModel = "CatModels/CatContainer";              // + playerStable.currentCat;

        catSkin = "Skins/CatSkin00" + Random.Range(0, 5); //Pick a random skin

        /*
         * if (playerStable.catHeadCurrent[playerStable.currentCat] != 0)
         * {
         *  catHead = "HeadItems00" + playerStable.catHeadCurrent[playerStable.currentCat];
         * }
         * if (playerStable.catCollarCurrent[playerStable.currentCat] != 0)
         * {
         *  catCollar = "CollarItems00" + playerStable.catCollarCurrent[playerStable.currentCat];
         * }
         */

        Debug.Log(catModel + catSkin + catHead + catCollar);
        //GameObject cat = Instantiate(Resources.Load(catModel, typeof(GameObject)), transform.position, transform.rotation) as GameObject;
        cat = Instantiate(Resources.Load(catModel), transform.position, transform.rotation) as GameObject;
        cat.transform.SetParent(gameObject.transform);

        catPointerScript  = cat.GetComponent <CatPointerScript>();
        catCustom         = catPointerScript.catPointer.GetComponent <CatCustomiseScript>();
        catCustom.catSkin = Resources.Load(catSkin) as Texture;
        catCustom.catNameObject.transform.localPosition += new Vector3(0.0f, 0.2f, 0.0f); //Name size fix

        catCustom.catName  = randNamesCat[Random.Range(0, randNamesCat.Length)];
        catCustom.catOwner = randNamesOwner[Random.Range(0, randNamesOwner.Length)];
        catAnim            = catPointerScript.catPointer.GetComponent <Animator>();
        catAnim.runtimeAnimatorController = Resources.Load("Animators/CatChallengerMenuAnimator") as RuntimeAnimatorController;
        cat = CatScripts(catPointerScript.catPointer);


        //GameObject catInstance = Instantiate(cat, transform.position, transform.rotation) as GameObject;
    }