Skip to content

Commit afd4a6e

Browse files
committed
Added project for example
1 parent 01d8de2 commit afd4a6e

File tree

628 files changed

+39390
-13
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

628 files changed

+39390
-13
lines changed

.gitignore

Lines changed: 611 additions & 13 deletions
Large diffs are not rendered by default.

UnityActionUpdaterService/Assets/Internal.meta

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

UnityActionUpdaterService/Assets/Internal/Codebase.meta

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

UnityActionUpdaterService/Assets/Internal/Codebase/ActionUpdater.meta

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

UnityActionUpdaterService/Assets/Internal/Codebase/ActionUpdater/Dispatcher.meta

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
// Resharper disable all
2+
// **************************************************************** //
3+
//
4+
// Copyright (c) RimuruDev. All rights reserved.
5+
// Contact me:
6+
// - Gmail: rimuru.dev@gmail.com
7+
// - GitHub: https://github.com/RimuruDev
8+
// - LinkedIn: https://www.linkedin.com/in/rimuru/
9+
// - GitHub Organizations: https://github.com/Rimuru-Dev
10+
//
11+
// **************************************************************** //
12+
13+
using Zenject;
14+
using UnityEngine;
15+
using RimuruDev.Internal.Codebase.ActionUpdater.Service;
16+
17+
namespace RimuruDev.Internal.Codebase.ActionUpdater.Dispatcher
18+
{
19+
/// <summary>
20+
/// The ActionUpdateDispatcher is responsible for dispatching update calls
21+
/// to the IActionUpdaterService. It ensures that these updates continue
22+
/// across different scenes, as it persists across scene loads.
23+
/// </summary>
24+
[DisallowMultipleComponent]
25+
public sealed class ActionUpdateDispatcher : MonoBehaviour
26+
{
27+
private IActionUpdaterService actionUpdater;
28+
29+
/// <summary>
30+
/// Injects the IActionUpdaterService dependency.
31+
/// This method is called by Zenject to provide the service instance.
32+
/// </summary>
33+
/// <param name="actionUpdater">The action updater service to be used for dispatching update events.</param>
34+
[Inject]
35+
private void Constructor(IActionUpdaterService actionUpdater) =>
36+
this.actionUpdater = actionUpdater;
37+
38+
/// <summary>
39+
/// Called when the script instance is being loaded.
40+
/// Ensures this object is not destroyed when loading a new scene.
41+
/// </summary>
42+
private void Awake()
43+
{
44+
transform.SetParent(null);
45+
DontDestroyOnLoad(gameObject);
46+
}
47+
48+
/// <summary>
49+
/// Called every fixed framerate frame. Delegates the call to the action updater service.
50+
/// </summary>
51+
private void FixedUpdate() =>
52+
actionUpdater?.FixedUpdate();
53+
54+
/// <summary>
55+
/// Called every frame. Delegates the call to the action updater service.
56+
/// </summary>
57+
private void Update() =>
58+
actionUpdater?.Update();
59+
60+
/// <summary>
61+
/// Called every frame after Update. Delegates the call to the action updater service.
62+
/// </summary>
63+
private void LateUpdate() =>
64+
actionUpdater?.LateUpdate();
65+
66+
/// <summary>
67+
/// Called when the application is quitting. Disposes the action updater service.
68+
/// </summary>
69+
private void OnApplicationQuit() =>
70+
actionUpdater?.Dispose();
71+
}
72+
}

UnityActionUpdaterService/Assets/Internal/Codebase/ActionUpdater/Dispatcher/ActionUpdateDispatcher.cs.meta

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

UnityActionUpdaterService/Assets/Internal/Codebase/ActionUpdater/Enum.meta

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
// **************************************************************** //
2+
//
3+
// Copyright (c) RimuruDev. All rights reserved.
4+
// Contact me:
5+
// - Gmail: rimuru.dev@gmail.com
6+
// - GitHub: https://github.com/RimuruDev
7+
// - LinkedIn: https://www.linkedin.com/in/rimuru/
8+
// - GitHub Organizations: https://github.com/Rimuru-Dev
9+
//
10+
// **************************************************************** //
11+
12+
using System;
13+
14+
namespace RimuruDev.Internal.Codebase.ActionUpdater.Enum
15+
{
16+
/// <summary>
17+
/// Specifies the type of update method to which an action can be subscribed.
18+
/// </summary>
19+
[Serializable]
20+
public enum UpdateType : byte
21+
{
22+
/// <summary>
23+
/// Subscribe to the FixedUpdate method, which is called every fixed framerate frame.
24+
/// Suitable for updates in physics calculations.
25+
/// </summary>
26+
FixedUpdate = 0,
27+
28+
/// <summary>
29+
/// Subscribe to the Update method, which is called once per frame.
30+
/// Suitable for most game logic.
31+
/// </summary>
32+
Update = 1,
33+
34+
/// <summary>
35+
/// Subscribe to the LateUpdate method, which is called once per frame after Update.
36+
/// Suitable for actions that require objects to be updated first.
37+
/// </summary>
38+
LateUpdate = 2,
39+
}
40+
}

UnityActionUpdaterService/Assets/Internal/Codebase/ActionUpdater/Enum/UpdateType.cs.meta

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)