private void Start()
        {
            settingsScript = GameObject.FindGameObjectWithTag("SettingsCtrl").GetComponent <SettingsScript>();

            playerPreviewImage = GetComponent <Image>();

            if (isPlayerColour)
            {
                playerPreviewImage.color = Converters.ConvertFloatArrayToColor(settingsScript.gameData.playerColour);

                if (settingsScript.gameData.playerShapeChoice > 0)
                {
                    playerShape = ExtraSerialize.SpriteDeSerialize(settingsScript.gameData.playerShapeSprite);
                    playerPreviewImage.sprite = playerShape;
                }
                else
                {
                    playerPreviewImage.sprite = defaultSprite;
                    Debug.LogWarning("fff");
                }
            }
            else
            {
                playerPreviewImage.color = Converters.ConvertFloatArrayToColor(settingsScript.gameData.crusherColour);
            }
        }
Exemple #2
0
        /// <summary>
        /// Saves the changes made and returns to the main menu...
        /// </summary>
        public void Menu()
        {
            audioManager.Play("MenuButton", .75f);

            // Apply changes for gameData
            if (playerColour.GetColourPicked() != Color.black)
            {
                gameData.playerColour      = Converters.ConvertColorToFloatArray(playerColour.GetColourPicked());
                gameData.playerPipPosition = ExtraSerialize.Vector3Serialize(playerColour.GetPipPosition());
            }

            if (crusherColour.GetColourPicked() != Color.black)
            {
                gameData.crusherColour      = Converters.ConvertColorToFloatArray(crusherColour.GetColourPicked());
                gameData.crusherPipPosition = ExtraSerialize.Vector3Serialize(crusherColour.GetPipPosition());
            }

            ApplyChanges();

            // Save and change to main menu
            StartCoroutine(sceneChangerInterface.ChangeScene("MainMenu"));
            SaveManager.SaveGame(gameData);
        }
 /// <summary>
 /// Sets the shape of that is selected... (this is called via UI buttons, so no references in code).
 /// </summary>
 /// <param name="input">The Sprite that is to be set.</param>
 public void SetShape(Sprite input)
 {
     playerShape = input;
     settingsScript.gameData.playerShapeSprite = ExtraSerialize.SpriteSerialize(input);
 }