Organize custom scripts under Assets/Baba_yaga and merge Opsive folders to Assets root

This commit is contained in:
2026-07-01 20:32:28 +07:00
parent 83d4157ac6
commit befc19bf37
5901 changed files with 243 additions and 141 deletions

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 50a98954ba2a8c04884fd88ab24729d0
guid: a9b006dd8e14db24589de0c5dfc03af6
folderAsset: yes
DefaultImporter:
externalObjects: {}

View File

@@ -2,8 +2,9 @@ using UnityEngine;
using TMPro;
using PrimeTween;
namespace Hallucinate.UI
namespace Baba_yaga.UI
{
[UnityEngine.Scripting.APIUpdating.MovedFrom(true, sourceNamespace: "Hallucinate.UI", sourceAssembly: "Opsive.UltimateCharacterController")]
public class ChatBubble : MonoBehaviour
{
[SerializeField] private TextMeshProUGUI textDisplay;

View File

@@ -4,20 +4,25 @@ using System.Text;
using UnityEngine;
using UnityEngine.Networking;
namespace Hallucinate.AI
namespace Baba_yaga.AI
{
[Serializable]
[UnityEngine.Scripting.APIUpdating.MovedFrom(true, sourceNamespace: "Hallucinate.AI", sourceAssembly: "Opsive.UltimateCharacterController")]
public class Part { public string text; }
[Serializable]
[UnityEngine.Scripting.APIUpdating.MovedFrom(true, sourceNamespace: "Hallucinate.AI", sourceAssembly: "Opsive.UltimateCharacterController")]
public class Content { public Part[] parts; }
[Serializable]
[UnityEngine.Scripting.APIUpdating.MovedFrom(true, sourceNamespace: "Hallucinate.AI", sourceAssembly: "Opsive.UltimateCharacterController")]
public class Candidate { public Content content; }
[Serializable]
[UnityEngine.Scripting.APIUpdating.MovedFrom(true, sourceNamespace: "Hallucinate.AI", sourceAssembly: "Opsive.UltimateCharacterController")]
public class GeminiResponse { public Candidate[] candidates; }
[UnityEngine.Scripting.APIUpdating.MovedFrom(true, sourceNamespace: "Hallucinate.AI", sourceAssembly: "Opsive.UltimateCharacterController")]
public class GeminiService : MonoBehaviour
{
public static GeminiService Instance { get; private set; }

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: a9e4195e8593cb94caf06dc47798a7d8
guid: 1f390a3d7b8c9eb49ac7d779c08ef5f5
folderAsset: yes
DefaultImporter:
externalObjects: {}

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 873cd6296aed2e7468f9f46127b19e9b
guid: 962e9e0d2b8d78d4fbb25fb03224f618
folderAsset: yes
DefaultImporter:
externalObjects: {}

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: bf12c234e065e734fbf54c17a3e71540
guid: 1a38893b1d8574b45bce269c39824bd6
folderAsset: yes
DefaultImporter:
externalObjects: {}

View File

@@ -1,8 +1,9 @@
using Fusion;
namespace Hallucinate.Game
namespace Baba_yaga.Game
{
[System.Serializable]
[UnityEngine.Scripting.APIUpdating.MovedFrom(true, sourceNamespace: "Hallucinate.Game", sourceAssembly: "Opsive.UltimateCharacterController")]
public struct PlayerEloData
{
public int Rating;
@@ -17,6 +18,7 @@ namespace Hallucinate.Game
public static PlayerEloData Default => new PlayerEloData(1000, 0);
}
[UnityEngine.Scripting.APIUpdating.MovedFrom(true, sourceNamespace: "Hallucinate.Game", sourceAssembly: "Opsive.UltimateCharacterController")]
public struct EloResult : INetworkStruct
{
public int NewRatingA;

View File

@@ -1,6 +1,6 @@
using UnityEngine;
namespace Hallucinate.Game
namespace Baba_yaga.Game
{
/// <summary>
/// Pure logic for Elo rating calculations.

View File

@@ -1,16 +1,17 @@
using Fusion;
using Hallucinate.Game;
using Hallucinate.UI;
using Baba_yaga.Game;
using Baba_yaga.UI;
using System.Collections.Generic;
using System.Threading.Tasks;
using UnityEngine;
namespace Hallucinate.Network
namespace Baba_yaga.Network
{
/// <summary>
/// Orchestrates the Elo calculation and persistence on the Host.
/// Broadcasts results to all clients.
/// </summary>
[UnityEngine.Scripting.APIUpdating.MovedFrom(true, sourceNamespace: "Hallucinate.Network", sourceAssembly: "Opsive.UltimateCharacterController")]
public class MatchEloManager : NetworkBehaviour
{
[Networked] public EloResult LastMatchResult { get; set; }
@@ -18,6 +19,25 @@ namespace Hallucinate.Network
private Dictionary<PlayerRef, string> _playerUsernames = new Dictionary<PlayerRef, string>();
// Simulating the database locally instead of Firebase
private static Dictionary<string, PlayerEloData> _localEloDatabase = new Dictionary<string, PlayerEloData>();
private Task<PlayerEloData> GetLocalPlayerData(string username)
{
if (!_localEloDatabase.TryGetValue(username, out var data))
{
data = PlayerEloData.Default;
_localEloDatabase[username] = data;
}
return Task.FromResult(data);
}
private Task SaveLocalPlayerData(string username, PlayerEloData data)
{
_localEloDatabase[username] = data;
return Task.CompletedTask;
}
public override void Spawned()
{
if (Object.HasStateAuthority)
@@ -53,9 +73,9 @@ namespace Hallucinate.Network
string nameA = _playerUsernames.GetValueOrDefault(winner, "Unknown_A");
string nameB = _playerUsernames.GetValueOrDefault(loser, "Unknown_B");
// 1. Fetch from Firebase
var dataA = await FirebaseService.GetPlayerData(nameA);
var dataB = await FirebaseService.GetPlayerData(nameB);
// 1. Fetch from local simulated database
var dataA = await GetLocalPlayerData(nameA);
var dataB = await GetLocalPlayerData(nameB);
// 2. Calculate
float resultA = isDraw ? 0.5f : 1.0f;
@@ -68,10 +88,10 @@ namespace Hallucinate.Network
dataB.Rating = result.NewRatingB;
dataB.GamesPlayed++;
// 4. Save to Firebase
// 4. Save to local simulated database
await Task.WhenAll(
FirebaseService.SavePlayerData(nameA, dataA),
FirebaseService.SavePlayerData(nameB, dataB)
SaveLocalPlayerData(nameA, dataA),
SaveLocalPlayerData(nameB, dataB)
);
// 5. Broadcast

View File

@@ -1,9 +1,10 @@
using UnityEngine;
using System.Text;
namespace OnlyScove.Scripts.GameSetup
namespace Baba_yaga.GameSetup
{
[RequireComponent(typeof(CharacterController))]
[UnityEngine.Scripting.APIUpdating.MovedFrom(true, sourceNamespace: "OnlyScove.Scripts.GameSetup", sourceAssembly: "Opsive.UltimateCharacterController")]
public class CharacterAutoSetup : MonoBehaviour
{
[Header("Manual Overrides (If Detection Fails)")]

View File

@@ -1,8 +1,9 @@
using UnityEngine;
namespace OnlyScove.Scripts.GameSetup
namespace Baba_yaga.GameSetup
{
[CreateAssetMenu(fileName = "CharacterSetupSettings", menuName = "BABA_YAGA/Setup/Character Setup Settings")]
[UnityEngine.Scripting.APIUpdating.MovedFrom(true, sourceNamespace: "OnlyScove.Scripts.GameSetup", sourceAssembly: "Opsive.UltimateCharacterController")]
public class CharacterSetupSettings : ScriptableObject
{
[Header("Movement Constraints")]

View File

@@ -1,9 +1,10 @@
using Sirenix.OdinInspector;
using UnityEngine;
namespace OnlyScove.Scripts
namespace Baba_yaga
{
[CreateAssetMenu(fileName = "GameSettings", menuName = "BABA_YAGA/Settings/GameSettings")]
[UnityEngine.Scripting.APIUpdating.MovedFrom(true, sourceNamespace: "OnlyScove.Scripts", sourceAssembly: "Opsive.UltimateCharacterController")]
public class GameSettings : ScriptableObject
{
[BoxGroup("Camera")]

View File

@@ -1,8 +1,9 @@
using System.Collections;
using UnityEngine;
namespace Hallucinate.GameSetup.Maze
namespace Baba_yaga.GameSetup.Maze
{
[UnityEngine.Scripting.APIUpdating.MovedFrom(true, sourceNamespace: "Hallucinate.GameSetup.Maze", sourceAssembly: "Opsive.UltimateCharacterController")]
public class CrawlerAlgorithm : IMazeAlgorithm
{
private const int CrawlChance = 50;

View File

@@ -1,6 +1,6 @@
using System.Collections.Generic;
namespace Hallucinate.GameSetup.Maze.Extensions
namespace Baba_yaga.GameSetup.Maze.Extensions
{
public static class ListExtensions
{

View File

@@ -1,9 +1,10 @@
namespace Hallucinate.GameSetup.Maze
namespace Baba_yaga.GameSetup.Maze
{
/// <summary>
/// Interface for all maze generation algorithms.
/// Supports both immediate and step-by-step (animated) generation.
/// </summary>
[UnityEngine.Scripting.APIUpdating.MovedFrom(true, sourceNamespace: "Hallucinate.GameSetup.Maze", sourceAssembly: "Opsive.UltimateCharacterController")]
public interface IMazeAlgorithm
{
/// <summary>

View File

@@ -1,4 +1,4 @@
namespace Hallucinate.GameSetup.Maze
namespace Baba_yaga.GameSetup.Maze
{
/// <summary>
/// Represents a 2D coordinate on the maze grid.

View File

@@ -1,11 +1,12 @@
using UnityEngine;
namespace Hallucinate.GameSetup.Maze
namespace Baba_yaga.GameSetup.Maze
{
/// <summary>
/// Defines the state of each cell in the maze.
/// Used to replace magic numbers and drive visual changes.
/// </summary>
[UnityEngine.Scripting.APIUpdating.MovedFrom(true, sourceNamespace: "Hallucinate.GameSetup.Maze", sourceAssembly: "Opsive.UltimateCharacterController")]
public enum MazeCellType
{
Wall, // Solid block
@@ -18,6 +19,7 @@ namespace Hallucinate.GameSetup.Maze
StairsDown,
Room
}
[UnityEngine.Scripting.APIUpdating.MovedFrom(true, sourceNamespace: "Hallucinate.GameSetup.Maze", sourceAssembly: "Opsive.UltimateCharacterController")]
public enum PieceType
{
None,
@@ -30,6 +32,7 @@ namespace Hallucinate.GameSetup.Maze
Stairs,
StairsUp// Cầu thang (Điểm nối)
}
[UnityEngine.Scripting.APIUpdating.MovedFrom(true, sourceNamespace: "Hallucinate.GameSetup.Maze", sourceAssembly: "Opsive.UltimateCharacterController")]
public struct MazePieceData
{
public PieceType piece; // Hình dạng mảnh ghép

View File

@@ -1,13 +1,14 @@
using System;
using UnityEngine;
namespace Hallucinate.GameSetup.Maze
namespace Baba_yaga.GameSetup.Maze
{
/// <summary>
/// Holds the logical state of the maze grid.
/// Notifies listeners whenever a cell changes to trigger visual updates.
/// </summary>
[Serializable]
[UnityEngine.Scripting.APIUpdating.MovedFrom(true, sourceNamespace: "Hallucinate.GameSetup.Maze", sourceAssembly: "Opsive.UltimateCharacterController")]
public class MazeGrid
{
public int Width { get; set; }

View File

@@ -3,15 +3,17 @@ using System.Collections.Generic;
using Sirenix.OdinInspector;
using UnityEngine;
namespace Hallucinate.GameSetup.Maze
namespace Baba_yaga.GameSetup.Maze
{
/// <summary>
/// Central controller for the Maze system.
/// Manages algorithm selection, debug speed, and regeneration.
/// </summary>
[UnityEngine.Scripting.APIUpdating.MovedFrom(true, sourceNamespace: "Hallucinate.GameSetup.Maze", sourceAssembly: "Opsive.UltimateCharacterController")]
public class MazeManager : MonoBehaviour
{
public enum AlgorithmType { Recursive, Wilsons, Prims, Crawler, NoiseRecursive }
[UnityEngine.Scripting.APIUpdating.MovedFrom(true, sourceNamespace: "Hallucinate.GameSetup.Maze", sourceAssembly: "Opsive.UltimateCharacterController")]
public enum AlgorithmType { Recursive, Wilsons, Prims, Crawler, NoiseRecursive }
[BoxGroup("Generation")]
[InfoBox("Set the array size to control how many maze floors are generated. Runtime grid data is rebuilt when Regenerate runs.")]

View File

@@ -3,12 +3,13 @@ using System.Collections.Generic;
using Sirenix.OdinInspector;
using UnityEngine;
namespace Hallucinate.GameSetup.Maze
namespace Baba_yaga.GameSetup.Maze
{
/// <summary>
/// Responsible for the visual representation of the maze.
/// Handles spawning, pooling, and animations with safety checks.
/// </summary>
[UnityEngine.Scripting.APIUpdating.MovedFrom(true, sourceNamespace: "Hallucinate.GameSetup.Maze", sourceAssembly: "Opsive.UltimateCharacterController")]
public class MazeRenderer : MonoBehaviour
{
[BoxGroup("Visuals")]
@@ -22,7 +23,8 @@ namespace Hallucinate.GameSetup.Maze
public float Scale => visualProfile != null ? visualProfile.scale : 1f;
public enum CellAnimationType { None, ScaleUp, DropDown, SpinIn }
[UnityEngine.Scripting.APIUpdating.MovedFrom(true, sourceNamespace: "Hallucinate.GameSetup.Maze", sourceAssembly: "Opsive.UltimateCharacterController")]
public enum CellAnimationType { None, ScaleUp, DropDown, SpinIn }
[HideInInspector]
public CellAnimationType currentAnimationType = CellAnimationType.ScaleUp;

View File

@@ -1,9 +1,10 @@
using Sirenix.OdinInspector;
using UnityEngine;
namespace Hallucinate.GameSetup.Maze
namespace Baba_yaga.GameSetup.Maze
{
[CreateAssetMenu(fileName = "MazeVisualProfile", menuName = "BABA_YAGA/Maze/Visual Profile")]
[UnityEngine.Scripting.APIUpdating.MovedFrom(true, sourceNamespace: "Hallucinate.GameSetup.Maze", sourceAssembly: "Opsive.UltimateCharacterController")]
public class MazeVisualProfile : ScriptableObject
{
[BoxGroup("Rotation Offsets")]

View File

@@ -2,8 +2,9 @@ using System;
using System.Runtime.InteropServices;
using UnityEngine;
namespace Hallucinate.GameSetup.Maze.Native
namespace Baba_yaga.GameSetup.Maze.Native
{
[UnityEngine.Scripting.APIUpdating.MovedFrom(true, sourceNamespace: "Hallucinate.GameSetup.Maze.Native", sourceAssembly: "Opsive.UltimateCharacterController")]
public class NativeNoiseProvider : IDisposable
{
private const string DLL_NAME = "BackroomsNoise";

View File

@@ -1,15 +1,16 @@
using System.Collections;
using System.Collections.Generic;
using Hallucinate.GameSetup.Maze.Extensions;
using Hallucinate.GameSetup.Maze.Native;
using Baba_yaga.GameSetup.Maze.Extensions;
using Baba_yaga.GameSetup.Maze.Native;
using UnityEngine;
namespace Hallucinate.GameSetup.Maze
namespace Baba_yaga.GameSetup.Maze
{
/// <summary>
/// Advanced generator that combines C++ Native Noise with a Recursive Backtracking algorithm.
/// Creates a hybrid layout of large rooms and chaotic corridors.
/// </summary>
[UnityEngine.Scripting.APIUpdating.MovedFrom(true, sourceNamespace: "Hallucinate.GameSetup.Maze", sourceAssembly: "Opsive.UltimateCharacterController")]
public class NoiseRecursiveGenerator : IMazeAlgorithm
{
private readonly List<MapLocation> _directions = MapLocation.Directions;

View File

@@ -2,8 +2,9 @@ using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Hallucinate.GameSetup.Maze
namespace Baba_yaga.GameSetup.Maze
{
[UnityEngine.Scripting.APIUpdating.MovedFrom(true, sourceNamespace: "Hallucinate.GameSetup.Maze", sourceAssembly: "Opsive.UltimateCharacterController")]
public class PrimsAlgorithm : IMazeAlgorithm
{
private const int InitialX = 2;

View File

@@ -1,10 +1,11 @@
using System.Collections;
using System.Collections.Generic;
using Hallucinate.GameSetup.Maze.Extensions;
using Baba_yaga.GameSetup.Maze.Extensions;
using UnityEngine;
namespace Hallucinate.GameSetup.Maze
namespace Baba_yaga.GameSetup.Maze
{
[UnityEngine.Scripting.APIUpdating.MovedFrom(true, sourceNamespace: "Hallucinate.GameSetup.Maze", sourceAssembly: "Opsive.UltimateCharacterController")]
public class RecursiveAlgorithm : IMazeAlgorithm
{
private const int StartX = 5;

View File

@@ -2,12 +2,13 @@ using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Hallucinate.GameSetup.Maze
namespace Baba_yaga.GameSetup.Maze
{
/// <summary>
/// Wilson's Algorithm implementation based on the original provided logic.
/// Ensures paths are sparse and correctly finalized using specific neighbor constraints.
/// </summary>
[UnityEngine.Scripting.APIUpdating.MovedFrom(true, sourceNamespace: "Hallucinate.GameSetup.Maze", sourceAssembly: "Opsive.UltimateCharacterController")]
public class WilsonsAlgorithm : IMazeAlgorithm
{
private const int MinBoundary = 2;

View File

@@ -1,8 +1,9 @@
using Sirenix.OdinInspector;
using UnityEngine;
namespace OnlyScove.Scripts
namespace Baba_yaga
{
[UnityEngine.Scripting.APIUpdating.MovedFrom(true, sourceNamespace: "OnlyScove.Scripts", sourceAssembly: "Opsive.UltimateCharacterController")]
public class SettingsManager : MonoBehaviour
{
public static SettingsManager Instance { get; private set; }

View File

@@ -18,7 +18,7 @@ public class GameManager : NetworkBehaviour
}
}
[SerializeField] private Hallucinate.Network.MatchEloManager eloManager;
[SerializeField] private Baba_yaga.Network.MatchEloManager eloManager;
public void TriggerGameOver(PlayerRef winner, PlayerRef loser, bool isDraw = false) {
if (!isGameOver) {

View File

@@ -5,10 +5,11 @@ using System.Threading.Tasks;
using Fusion;
using Fusion.Sockets;
using UnityEngine;
using OnlyScove.Scripts;
using Baba_yaga;
namespace Hallucinate.UI
namespace Baba_yaga.UI
{
[UnityEngine.Scripting.APIUpdating.MovedFrom(true, sourceNamespace: "Hallucinate.UI", sourceAssembly: "Opsive.UltimateCharacterController")]
public class BasicSpawner : MonoBehaviour, INetworkRunnerCallbacks
{
private static BasicSpawner _instance;
@@ -400,9 +401,9 @@ namespace Hallucinate.UI
public void OnInput(NetworkRunner runner, NetworkInput input)
{
var data = new PlayerInputData();
if (Hallucinate.Network.FusionClientMovementBridge.Local != null)
if (Baba_yaga.Network.FusionClientMovementBridge.Local != null)
{
data = Hallucinate.Network.FusionClientMovementBridge.Local.GetLocalInputData();
data = Baba_yaga.Network.FusionClientMovementBridge.Local.GetLocalInputData();
}
input.Set(data);
}

View File

@@ -8,12 +8,13 @@ using Opsive.UltimateCharacterController.Character.Abilities;
using Opsive.UltimateCharacterController.Character.Abilities.Items;
using Opsive.UltimateCharacterController.Camera;
using Opsive.UltimateCharacterController.Input;
using OnlyScove.Scripts;
using Baba_yaga;
using Opsive.UltimateCharacterController.Game;
namespace Hallucinate.Network
namespace Baba_yaga.Network
{
// Ensure Opsive components load before this
[DefaultExecutionOrder(100)]
[UnityEngine.Scripting.APIUpdating.MovedFrom(true, sourceNamespace: "Hallucinate.Network", sourceAssembly: "Opsive.UltimateCharacterController")]
public class FusionClientMovementBridge : NetworkBehaviour, INetworkInfo, INetworkCharacter, ILookSource
{
public static FusionClientMovementBridge Local { get; private set; }

View File

@@ -1,11 +1,12 @@
using Fusion;
using UnityEngine;
using Hallucinate.Game;
using Hallucinate.UI;
using Baba_yaga.Game;
using Baba_yaga.UI;
using System.Linq;
namespace Hallucinate.Network
namespace Baba_yaga.Network
{
[UnityEngine.Scripting.APIUpdating.MovedFrom(true, sourceNamespace: "Hallucinate.Network", sourceAssembly: "Opsive.UltimateCharacterController")]
public class MatchResultManager : NetworkBehaviour
{
public static MatchResultManager Instance { get; private set; }
@@ -33,19 +34,15 @@ namespace Hallucinate.Network
private void ShowResultUI(bool isWin, int delta, int newRating)
{
var hud = FindFirstObjectByType<HUDController>();
if (hud != null)
{
// In a real scenario, we might push a new Result screen
// For now, let's assume HUD has a result panel
Debug.Log($"RESULT: {(isWin ? "WIN" : "LOSS")} | Delta: {delta} | New Rating: {newRating}");
// Save to PlayerPrefs as a dummy "Server" persistence
PlayerPrefs.SetInt("EloRating", newRating);
int gamesPlayed = PlayerPrefs.GetInt("GamesPlayed", 0);
PlayerPrefs.SetInt("GamesPlayed", gamesPlayed + 1);
PlayerPrefs.Save();
}
// In a real scenario, we might push a new Result screen
// For now, let's assume HUD has a result panel
Debug.Log($"RESULT: {(isWin ? "WIN" : "LOSS")} | Delta: {delta} | New Rating: {newRating}");
// Save to PlayerPrefs as a dummy "Server" persistence
PlayerPrefs.SetInt("EloRating", newRating);
int gamesPlayed = PlayerPrefs.GetInt("GamesPlayed", 0);
PlayerPrefs.SetInt("GamesPlayed", gamesPlayed + 1);
PlayerPrefs.Save();
}
public void ProcessMatchEnd(PlayerRef winner)

View File

@@ -2,8 +2,9 @@
using Fusion;
using UnityEngine;
namespace OnlyScove.Scripts
namespace Baba_yaga
{
[UnityEngine.Scripting.APIUpdating.MovedFrom(true, sourceNamespace: "OnlyScove.Scripts", sourceAssembly: "Opsive.UltimateCharacterController")]
public struct PlayerInputData : INetworkInput, INetworkStruct
{
// Di chuyển (thường là Vector2 cho X/Y hoặc WASD)

3
Assets/Baba_yaga/UI.meta Normal file
View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 91b95b0bf23143b68483f912b558e6f0
timeCreated: 1773383929

View File

@@ -6,7 +6,7 @@ using DG.Tweening;
using Tween = PrimeTween.Tween;
using Ease = PrimeTween.Ease;
namespace Hallucinate.UI
namespace Baba_yaga.UI
{
public abstract class BaseUIController : ScriptableObject
{

Some files were not shown because too many files have changed in this diff Show More