Пример #1
0
    //Awake is always called before any Start functions
    void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }
        else if (instance != this)
        {
            Destroy(gameObject);
        }

        DontDestroyOnLoad(gameObject);

        playerCustomization = new PlayerCustomization();

        baseHairs.AddRange(Resources.LoadAll <HairData>("Body Customization Data/Hair Data"));
        baseShirts.AddRange(Resources.LoadAll <ShirtData>("Body Customization Data/Shirt Data"));
        basePants.AddRange(Resources.LoadAll <PantsData>("Body Customization Data/Pants Data"));

        baseBodyTypes.AddRange(Resources.LoadAll <BodyTypeData>("Body Customization Data/Body Type Data"));
        baseEyebrows.AddRange(Resources.LoadAll <EyebrowsData>("Body Customization Data/Eyebrows Data"));
        baseEyes.AddRange(Resources.LoadAll <EyesData>("Body Customization Data/Eyes Data"));
        baseMouths.AddRange(Resources.LoadAll <MouthData>("Body Customization Data/Mouth Data"));
        baseShoes.AddRange(Resources.LoadAll <ShoesData>("Body Customization Data/Shoes Data"));
    }
Пример #2
0
    public void startGame()
    {
        CharCustomManager ccm = CharCustomManager.instance;

        ccm.playerCustomization.characterName = ccm.characterName.text.Replace("\u200B", "");
        ccm.playerCustomization.bodyTypeId    = ccm.baseBodyTypes[ccm.characterCustomButton.currentBodyType].id;
        ccm.playerCustomization.eyebrowsId    = ccm.baseEyebrows[ccm.characterCustomButton.currentEyebrows].id;
        ccm.playerCustomization.eyesId        = ccm.baseEyes[ccm.characterCustomButton.currentEyes].id;
        ccm.playerCustomization.hairId        = ccm.baseHairs[ccm.characterCustomButton.currentHair].id;
        ccm.playerCustomization.mouthId       = ccm.baseMouths[ccm.characterCustomButton.currentMouth].id;
        ccm.playerCustomization.pantsId       = ccm.basePants[ccm.characterCustomButton.currentPants].id;
        ccm.playerCustomization.shirtId       = ccm.baseShirts[ccm.characterCustomButton.currentShirt].id;
        ccm.playerCustomization.shoesId       = ccm.baseShoes[ccm.characterCustomButton.currentShoes].id;

        File.WriteAllText(Application.dataPath + "/StreamingAssets/PlayerCustomization.json", JsonMapper.ToJson(CharCustomManager.instance.playerCustomization));
        SceneManager.LoadScene("MainScene");
    }