Esempio n. 1
0
        private void SavePlayerCustomisation(int index, PlayerCustomisationData data)
        {
            string key   = GetPrefsKeyForPlayer(index);
            string value = JsonUtility.ToJson(data);

            PlayerPrefs.SetString(key, value);
        }
Esempio n. 2
0
        private void ChangePlayerCustomisationContext(int playerID)
        {
            this.playerID = playerID;

            customisationData = CManager.GetPlayerCustomisation(playerID);
            OnPlayerChange.Invoke(customisationData);
            DragonHelper.SetDragonAsPlayer(customisationData, DemoDragon);

            UpdateUI(playerID);
        }
Esempio n. 3
0
        private PlayerCustomisationData LoadPlayerCustomisation(int index)
        {
            string key   = GetPrefsKeyForPlayer(index);
            string value = PlayerPrefs.GetString(key);

            var data = PlayerCustomisationData.CreateDefault(index);

            JsonUtility.FromJsonOverwrite(value, data);

            return(data);
        }
Esempio n. 4
0
        public static void SetDragonAsPlayer(
            PlayerCustomisationData cData,
            GameObject dragon,
            bool changeColour = true)
        {
            PlayerInput pl = dragon.AddComponent <PlayerInput>();

            pl.leftKey  = cData.LeftButton;
            pl.rightKey = cData.RightButton;

            if (changeColour)
            {
                Palette pal = dragon.GetComponent <Palette>();
                pal.ColourSet = ColourCatalogue.GetColourSet(cData.ColourSetIndex);
            }
        }
Esempio n. 5
0
 public void SetPlayerCustomisation(int i, PlayerCustomisationData data)
 {
     PlayerCustomisations[i] = data;
 }
Esempio n. 6
0
 public void SetContext(PlayerCustomisationData customisationData)
 {
     this.customisationData = customisationData;
     UpdateUIColours(customisationData.ColourSetIndex);
 }
Esempio n. 7
0
 public void SetContext(PlayerCustomisationData customisationData)
 {
     this.customisationData = customisationData;
     leftText.text          = customisationData.LeftButton;
     rightText.text         = customisationData.RightButton;
 }