Skip to content
Open
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
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
# Asset meta data should only be ignored when the corresponding asset is also ignored
!/[Aa]ssets/**/*.meta

# NuGet
/[Aa]ssets/Packages/

# Uncomment this line if you wish to ignore the asset store tools plugin
# /[Aa]ssets/AssetStoreTools*

Expand All @@ -22,6 +25,7 @@

# Visual Studio cache directory
.vs/
.vscode/

# Gradle cache directory
.gradle/
Expand Down
18 changes: 18 additions & 0 deletions Assets/NuGet.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<clear />
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
</packageSources>
<disabledPackageSources />
<activePackageSource>
<add key="All" value="(Aggregate source)" />
</activePackageSource>
<config>
<add key="packageInstallLocation" value="CustomWithinAssets" />
<add key="repositoryPath" value="./Packages" />
<add key="PackagesConfigDirectoryPath" value="." />
<add key="slimRestore" value="true" />
<add key="PreferNetStandardOverNetFramework" value="true" />
</config>
</configuration>
34 changes: 34 additions & 0 deletions Assets/NuGet.config.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions Assets/Packages.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions Assets/packages.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Bcl.AsyncInterfaces" version="6.0.0" />
<package id="Microsoft.Bcl.TimeProvider" version="8.0.0" />
<package id="R3" version="1.2.9" manuallyInstalled="true" />
<package id="System.Buffers" version="4.5.1" />
<package id="System.ComponentModel.Annotations" version="5.0.0" />
<package id="System.Memory" version="4.5.5" />
<package id="System.Runtime.CompilerServices.Unsafe" version="6.0.0" />
<package id="System.Threading.Channels" version="8.0.0" />
<package id="System.Threading.Tasks.Extensions" version="4.5.4" />
</packages>
23 changes: 23 additions & 0 deletions Assets/packages.config.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## [0.1.0] - 2024-11-11

### Changed

- Updated from UniRx to R3
- Changed code to work for R3
- README update for R3

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System;
using UniRx;
using UniRx.Triggers;
using R3;
using R3.Triggers;
using UnityEngine;

namespace DyrdaDev.FirstPersonController
Expand All @@ -13,19 +12,19 @@ public class FirstPersonController : MonoBehaviour, ICharacterSignals
{
#region Character Signals

public IObservable<Vector3> Moved => _moved;
public Observable<Vector3> Moved => _moved;
private Subject<Vector3> _moved;

public ReactiveProperty<bool> IsRunning => _isRunning;
private ReactiveProperty<bool> _isRunning;

public IObservable<Unit> Landed => _landed;
public Observable<Unit> Landed => _landed;
private Subject<Unit> _landed;

public IObservable<Unit> Jumped => _jumped;
public Observable<Unit> Jumped => _jumped;
private Subject<Unit> _jumped;

public IObservable<Unit> Stepped => _stepped;
public Observable<Unit> Stepped => _stepped;
private Subject<Unit> _stepped;

#endregion
Expand Down Expand Up @@ -114,7 +113,7 @@ private void HandleLocomotion()
}

// Horizontal movement:
var currentSpeed = firstPersonControllerInput.Run.Value ? runSpeed : walkSpeed;
var currentSpeed = firstPersonControllerInput.Run.CurrentValue ? runSpeed : walkSpeed;
var horizontalVelocity = i.Move * currentSpeed; //Calculate velocity (direction * speed).

// Combine horizontal and vertical movement.
Expand Down Expand Up @@ -146,7 +145,7 @@ private void HandleLocomotionCharacterSignalsIteration(bool wasGrounded, bool is
{
// The character is running if the input is active and
// the character is actually moving on the ground
tempIsRunning = firstPersonControllerInput.Run.Value;
tempIsRunning = firstPersonControllerInput.Run.CurrentValue;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
"name": "DyrdaDev.FirstPersonController.Runtime",
"rootNamespace": "",
"references": [
"UniRx",
"Unity.InputSystem"
"R3",
"Unity.InputSystem",
"R3.Unity"
],
"includePlatforms": [],
"excludePlatforms": [],
Expand All @@ -14,4 +15,4 @@
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using UniRx;
using R3;
using UnityEngine;

namespace DyrdaDev.FirstPersonController
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using UniRx;
using R3;
using UnityEngine;

namespace DyrdaDev.FirstPersonController
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using System;
using UniRx;
using R3;
using UnityEngine;

namespace DyrdaDev.FirstPersonController
Expand All @@ -19,21 +19,21 @@ public interface ICharacterSignals
/// <summary>
/// A stream with the vectors the character has moved.
/// </summary>
IObservable<Vector3> Moved { get; }
Observable<Vector3> Moved { get; }

/// <summary>
/// A stream with landed events. Triggered when the character switches form airborne to grounded.
/// </summary>
IObservable<Unit> Landed { get; }
Observable<Unit> Landed { get; }

/// <summary>
/// A stream with jumped events. Triggered when the character starts to jump.
/// </summary>
IObservable<Unit> Jumped { get; }
Observable<Unit> Jumped { get; }

/// <summary>
/// A stream with stepped events. Triggered when the camera has moved one stride length.
/// </summary>
IObservable<Unit> Stepped { get; }
Observable<Unit> Stepped { get; }
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using System;
using UniRx;
using R3;
using UnityEngine;

namespace DyrdaDev.FirstPersonController
Expand All @@ -10,13 +10,13 @@ public abstract class FirstPersonControllerInput : MonoBehaviour
/// Move axes in WASD / D-Pad style.
/// Interaction type: continuous axes.
/// </summary>
public abstract IObservable<Vector2> Move { get; }
public abstract Observable<Vector2> Move { get; }

/// <summary>
/// Jump button.
/// Interaction type: Trigger.
/// </summary>
public abstract IObservable<Unit> Jump { get; }
public abstract Observable<Unit> Jump { get; }

/// <summary>
/// Run button.
Expand All @@ -28,6 +28,6 @@ public abstract class FirstPersonControllerInput : MonoBehaviour
/// Look axes following the free look (mouse look) pattern.
/// Interaction type: continuous axes.
/// </summary>
public abstract IObservable<Vector2> Look { get; }
public abstract Observable<Vector2> Look { get; }
}
}
Loading