- Added PaymentManager integration with GameManager - Implemented credit-based lives increment system - Updated UI layout and anchor positions in MainMenu scene - Added AddCredit input action bindings for keyboard and gamepad - Refactored GameManager to use StartingLives, MaxLives properties - Added UICreditsTextController for displaying credits and lives- Fixed prefab initialization order and component dependencies - Updated ComWrapper serialization and prize checking logic - Removed obsolete setLivesToDefaultAfterFirstLose setting - Improved scene loading and player spawn management
66 lines
1.8 KiB
C#
66 lines
1.8 KiB
C#
using RR.Common.UI;
|
|
using RR.Game2D.Core.Managers;
|
|
using UnityEngine;
|
|
|
|
namespace RR.Common.Behaviour.ScriptableObjects
|
|
{
|
|
[CreateAssetMenu(fileName = "GameSettings", menuName = "Game/GameSettings")]
|
|
public class GameSettings : ScriptableObject
|
|
{
|
|
// General settings
|
|
public bool isFullscreen;
|
|
// ATTENTION: Music between 0f and 1f
|
|
public float musicVolume;
|
|
public float sfxVolume;
|
|
|
|
// Payment settings
|
|
public bool isFreeGame;
|
|
public bool isGivingPrizes;
|
|
|
|
// Player settings
|
|
public int startLivesCount;
|
|
public int livesIncreasedByCredits;
|
|
|
|
public void SetDefaultValues()
|
|
{
|
|
isFullscreen = true;
|
|
musicVolume = 1f;
|
|
sfxVolume = 1f;
|
|
|
|
isFreeGame = false;
|
|
isGivingPrizes = true;
|
|
|
|
startLivesCount = 3;
|
|
livesIncreasedByCredits = 1;
|
|
}
|
|
|
|
public void ValidateSettings()
|
|
{
|
|
if (musicVolume is < 0f or > 1f)
|
|
musicVolume = Mathf.Clamp01(musicVolume);
|
|
|
|
if (sfxVolume is < 0f or > 1f)
|
|
sfxVolume = Mathf.Clamp01(sfxVolume);
|
|
|
|
if (startLivesCount < 1)
|
|
startLivesCount = 3;
|
|
|
|
if (livesIncreasedByCredits < 0)
|
|
livesIncreasedByCredits = 0;
|
|
}
|
|
|
|
public void ApplySettings()
|
|
{
|
|
if (isFullscreen)
|
|
FullscreenToggle.SetFullscreen(isFullscreen);
|
|
|
|
if (GameManager.Instance != null)
|
|
{
|
|
GameManager.Instance.Audio.SetMusicVolume(musicVolume);
|
|
GameManager.Instance.Audio.SetSfxVolume(sfxVolume);
|
|
}
|
|
|
|
}
|
|
}
|
|
}
|