Esempio n. 1
0
    // Start is called before the first frame update
    void Start()
    {
        players.AddRange(GameObject.FindGameObjectsWithTag("Hunter"));
        players.AddRange(GameObject.FindGameObjectsWithTag("HunterPlayer"));
        players.AddRange(GameObject.FindGameObjectsWithTag("Hider"));
        players.AddRange(GameObject.FindGameObjectsWithTag("HiderPlayer"));

        if (PlayerPrefs.GetString("Skin Selected") == "")
        {
            PlayerPrefs.SetString("Skin Selected", Skins[0].GetComponentInChildren <SkinParams>().NameSkin);
        }


        for (int i = 0; i < players.Count; i++)
        {
            GameObject stepCopy = Instantiate(Skins[Random.Range(0, Skins.Count)], new Vector3(players[i].transform.position.x, players[i].transform.position.y - 0.7f, players[i].transform.position.z), players[i].transform.rotation) as GameObject;

            Transform Body = ChildObjManager.GetChildObject(stepCopy.transform, "Body");

            var outline = Body.gameObject.AddComponent <cakeslice.Outline>();

            stepCopy.transform.parent = players[i].transform;
        }
        StartCoroutine(PlayerSkinChanger());
    }
Esempio n. 2
0
    // Start is called before the first frame update
    void Start()
    {
        //print(PlayerPrefs.GetString("Skin Selecasdted"));

        humansSpawner = SkinSpawner.GetComponentInChildren <HumansSpawner>();


        if (PlayerPrefs.GetString("Skin Selected") == "")
        {
            PlayerPrefs.SetString("Skin Selected", humansSpawner.Skins[0].GetComponentInChildren <SkinParams>().NameSkin);
            PlayerPrefs.SetInt(humansSpawner.Skins[0].GetComponentInChildren <SkinParams>().NameSkin + " Buyed", 1);
        }



        //ItemTemplate = ShopScrollView.GetChild(0).gameObject;
        ItemTemplate = ShopItem;
        for (int i = 0; i < humansSpawner.Skins.Count; i++)
        {
            string nameSkin = humansSpawner.Skins[i].GetComponentInChildren <SkinParams>().NameSkin;
            int    price    = humansSpawner.Skins[i].GetComponentInChildren <SkinParams>().Price;

            g = Instantiate(ShopItem, ShopScrollView);
            Transform button = ChildObjManager.GetChildObject(g.transform, "BuyButton");

            Debug.Log(button.GetComponentInChildren <Text>().text);

            if (PlayerPrefs.GetInt(nameSkin + " Buyed") == 1)
            {
                if (PlayerPrefs.GetString("Skin Selected") == nameSkin)
                {
                    button.GetComponentInChildren <Text>().text = "Selected";
                    StaticField.SkinSelected = nameSkin;
                }
                else
                {
                    button.GetComponentInChildren <Text>().text = "Select";
                }
            }
            else
            {
                button.GetComponentInChildren <Text>().text = Convert.ToString(price);
            }

            GameObject s = Instantiate(humansSpawner.Skins[i], g.transform);
            s.transform.localScale    = new Vector3(150, 150, 150);
            s.transform.localPosition = new Vector3(0, -90, -50);
            s.transform.localRotation = Quaternion.Euler(0, -180, 0);

            button.GetComponentInChildren <BuySkinButtonController>().Skin = s;


            Transform transform = ChildObjManager.GetChildObject(s.transform, "Body");
            transform.gameObject.layer = 20;
        }
        //Destroy(ItemTemplate);
    }
Esempio n. 3
0
    private void SkinChanger(string skinName)
    {
        GameObject Skin    = GameObject.FindGameObjectsWithTag(skinName)[0];
        Transform  OldSkin = ChildObjManager.GetChildObject(Skin.transform, "Skin");

        Destroy(OldSkin.gameObject);

        GameObject stepCopy = Instantiate(FindSkinInList(Skins), new Vector3(Skin.transform.position.x, Skin.transform.position.y - 0.7f, Skin.transform.position.z), Skin.transform.rotation) as GameObject;
        Transform  Body     = ChildObjManager.GetChildObject(stepCopy.transform, "Body");

        var outline = Body.gameObject.AddComponent <cakeslice.Outline>();

        outline.color             = 2;
        stepCopy.transform.parent = Skin.transform;
    }