Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ This template contains the following:
| [Cinemachine](https://docs.unity3d.com/Packages/com.unity.cinemachine@latest) | Advanced camera system for dynamic shots. |
| [Physics](https://docs.unity3d.com/Manual/PhysicsSection.html) | Physics simulation for 2D and 3D games. |
| [ProBuilder](https://docs.unity3d.com/Packages/com.unity.probuilder@latest) | 3D modeling and level design toolset. |
| [R3](https://github.com/Cysharp/R3) | Reactive Extensions for Unity with ReactiveProperty. |
| [Rendering: Post-Processing](https://docs.unity3d.com/Packages/com.unity.postprocessing@latest) | Visual effects like color grading and bloom. |
| [Rendering: URP](https://docs.unity3d.com/Packages/com.unity.render-pipelines.universal@latest) | Efficient rendering pipeline for various platforms. |
| [Text Mesh Pro](https://docs.unity3d.com/Packages/com.unity.textmeshpro@latest) | High-quality text rendering and formatting. |
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Threading.Tasks;
using R3;
using RMC.Audio;
using RMC.MyProject.UI;
using UnityEngine;
Expand Down Expand Up @@ -33,6 +34,9 @@ public int Score
{
_score = value;
HudUI.ScoreLabel.text = $"Score: {_score:000}/{ScoreMax:000}";

// R3 ReactiveProperty demonstration - Update reactive property when score changes
_reactiveScore.Value = _score;
}
}

Expand Down Expand Up @@ -107,6 +111,9 @@ private set
private bool _isEnabledInput = true;
private bool _isPlayerGrounded = false;

// R3 ReactiveProperty demonstration
private ReactiveProperty<int> _reactiveScore = new ReactiveProperty<int>(0);

// Audio
private const string PlayerResetAudioClip = "ItemRead01";
private const string GameWinAudioClip = "Music_Win01";
Expand All @@ -122,6 +129,12 @@ protected void Start()
{
Debug.Log($"{GetType().Name}.Start()");

// R3 ReactiveProperty demonstration - Subscribe to value changes
_reactiveScore.Subscribe(value =>
{
Debug.Log($"[R3 Demo] ReactiveScore changed to: {value}");
});

// Input
_movePlayerInputAction = InputSystem.actions.FindAction("MovePlayer");
_jumpPlayerInputAction = InputSystem.actions.FindAction("JumpPlayer");
Expand All @@ -134,6 +147,9 @@ protected void Start()
Lives = LivesMax;
SetInstructions();
SetTitle();

// R3 ReactiveProperty demonstration - Set initial value to trigger subscription
_reactiveScore.Value = 1;
}

/// <summary>
Expand Down
1 change: 1 addition & 0 deletions Unity/Packages/manifest.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"dependencies": {
"com.cysharp.r3": "https://github.com/Cysharp/R3.git?path=src/R3.Unity/Assets/R3.Unity",
"com.rmc.rmc-audio": "1.8.4",
"com.rmc.rmc-core": "1.9.5",
"com.rmc.rmc-readme": "1.2.2",
Expand Down