migration from new repo
This commit is contained in:
commit
423134a840
26930 changed files with 3458568 additions and 0 deletions
BIN
Assets/_/Features/.DS_Store
vendored
Normal file
BIN
Assets/_/Features/.DS_Store
vendored
Normal file
Binary file not shown.
8
Assets/_/Features/Adventurers.meta
Normal file
8
Assets/_/Features/Adventurers.meta
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: c1584711ee7174b37838a0fd28e8e28e
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/_/Features/Adventurers/.DS_Store
vendored
Normal file
BIN
Assets/_/Features/Adventurers/.DS_Store
vendored
Normal file
Binary file not shown.
8
Assets/_/Features/Adventurers/Runtime.meta
Normal file
8
Assets/_/Features/Adventurers/Runtime.meta
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 8ec7f67c68b3d4cc2a0d89d90062a79f
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
"name": "Adventurer.Runtime",
|
||||
"rootNamespace": "Adventurer.Runtime",
|
||||
"references": [
|
||||
"GUID:2ca720bbf8aa349608caa5ce4acaa603",
|
||||
"GUID:6055be8ebefd69e48b49212b09b47b2f"
|
||||
],
|
||||
"includePlatforms": [],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": false,
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": true,
|
||||
"defineConstraints": [],
|
||||
"versionDefines": [],
|
||||
"noEngineReferences": false
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: d01b71ecbce444a299cc1623f29e9d35
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
211
Assets/_/Features/Adventurers/Runtime/AdventurerClass.cs
Normal file
211
Assets/_/Features/Adventurers/Runtime/AdventurerClass.cs
Normal file
|
|
@ -0,0 +1,211 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Adventurer.Runtime
|
||||
{
|
||||
public class AdventurerClass
|
||||
{
|
||||
|
||||
#region Getters and Setters
|
||||
|
||||
public Guid ID
|
||||
{
|
||||
get { return _id; }
|
||||
}
|
||||
|
||||
public string Name
|
||||
{
|
||||
get { return _name; }
|
||||
set { _name = value; }
|
||||
}
|
||||
|
||||
public AdventurerClassEnum AdventurerClassEnum
|
||||
{
|
||||
get { return _adventurerClassEnum; }
|
||||
}
|
||||
|
||||
public int Level
|
||||
{
|
||||
get { return _level; }
|
||||
set { _level = value; }
|
||||
}
|
||||
|
||||
public int Experience
|
||||
{
|
||||
get { return _experience; }
|
||||
set { _experience = value; }
|
||||
}
|
||||
|
||||
public int Health
|
||||
{
|
||||
get { return _health; }
|
||||
set { _health = value; }
|
||||
}
|
||||
|
||||
public int MaxHealth
|
||||
{
|
||||
get { return _maxHealth; }
|
||||
set { _maxHealth = value; }
|
||||
}
|
||||
|
||||
public int Strength
|
||||
{
|
||||
get { return _strength; }
|
||||
set { _strength = value; }
|
||||
}
|
||||
|
||||
public int Defense
|
||||
{
|
||||
get { return _defense; }
|
||||
set { _defense = value; }
|
||||
}
|
||||
|
||||
public int Intelligence
|
||||
{
|
||||
get { return _intelligence; }
|
||||
set { _intelligence = value; }
|
||||
}
|
||||
|
||||
public int Agility
|
||||
{
|
||||
get { return _agility; }
|
||||
set { _agility = value; }
|
||||
}
|
||||
|
||||
public bool IsAvailable
|
||||
{
|
||||
get { return _isAvailable; }
|
||||
set { _isAvailable = value; }
|
||||
}
|
||||
|
||||
public DateTime RecruitmentDate
|
||||
{
|
||||
get { return _recruitmentDate; }
|
||||
set { _recruitmentDate = value; }
|
||||
}
|
||||
|
||||
public Dictionary<string, string> Equipments
|
||||
{
|
||||
get { return _equipments; }
|
||||
set { _equipments = value; }
|
||||
}
|
||||
|
||||
public Dictionary<string, string> ModelParts { get; private set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region Parameters
|
||||
|
||||
Guid _id;
|
||||
string _name;
|
||||
AdventurerClassEnum _adventurerClassEnum;
|
||||
int _level;
|
||||
int _experience;
|
||||
|
||||
int _health;
|
||||
int _maxHealth;
|
||||
|
||||
int _strength;
|
||||
int _defense;
|
||||
int _intelligence;
|
||||
int _agility;
|
||||
|
||||
bool _isAvailable;
|
||||
DateTime _recruitmentDate;
|
||||
Dictionary<string, string> _equipments;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructor
|
||||
|
||||
public AdventurerClass(Guid id, string name, AdventurerClassEnum adventurerClassEnum, int level, int experience,
|
||||
int strength, int defense,
|
||||
int intelligence, int agility, Dictionary<string, string> modelParts, DateTime RecruitmentDate = default(DateTime))
|
||||
{
|
||||
_id = id;
|
||||
_name = name;
|
||||
_adventurerClassEnum = adventurerClassEnum;
|
||||
_level = level;
|
||||
_experience = experience;
|
||||
_strength = strength;
|
||||
_defense = defense;
|
||||
_intelligence = intelligence;
|
||||
_agility = agility;
|
||||
ModelParts = modelParts;
|
||||
_recruitmentDate = RecruitmentDate;
|
||||
_isAvailable = true;
|
||||
_equipments = new Dictionary<string, string>();
|
||||
|
||||
// Calcule de la vie Max
|
||||
_maxHealth = CalculateMaxHp();
|
||||
//Debug.Log($">>>>>>> {_name }[{_adventurerClassEnum}] | Niveau {_level} | {_experience} exp | {_strength} force | {_defense} def | {_agility} agi | {_intelligence} int | {_maxHealth} Hp Max <<<<<<<<<");
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
|
||||
public void SendOnMission()
|
||||
{
|
||||
_isAvailable = false;
|
||||
}
|
||||
|
||||
public void ReturnFromMission()
|
||||
{
|
||||
_isAvailable = true;
|
||||
}
|
||||
|
||||
public void ReceiveXP(int xp)
|
||||
{
|
||||
_experience += xp;
|
||||
}
|
||||
|
||||
private void TryLevelUp()
|
||||
{
|
||||
int requiredXP = _level * 100;
|
||||
if (_experience >= requiredXP)
|
||||
{
|
||||
_level++;
|
||||
_experience -= requiredXP;
|
||||
}
|
||||
}
|
||||
|
||||
int CalculateMaxHp()
|
||||
{
|
||||
float classMultiplier = GetClassMultiplier();
|
||||
return Mathf.RoundToInt((_strength + _defense + _level * 2) * classMultiplier);
|
||||
}
|
||||
|
||||
private float GetClassMultiplier()
|
||||
{
|
||||
switch (_adventurerClassEnum)
|
||||
{
|
||||
case AdventurerClassEnum.Barbarian: return 1.5f;
|
||||
case AdventurerClassEnum.Warrior: return 1.3f;
|
||||
case AdventurerClassEnum.Paladin: return 1.2f;
|
||||
case AdventurerClassEnum.Archer: return 1.0f;
|
||||
case AdventurerClassEnum.Thief: return 0.9f;
|
||||
case AdventurerClassEnum.Priest: return 0.8f;
|
||||
default: return 1.0f;
|
||||
}
|
||||
}
|
||||
|
||||
public void TakeDamage(int effectValue)
|
||||
{
|
||||
Debug.Log($"Taking damage: {effectValue}");
|
||||
}
|
||||
|
||||
public void Heal(int effectValue)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void ApplyBuff(int effectValue)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: e46147717be340f99310b7ca71940eb1
|
||||
timeCreated: 1753475759
|
||||
13
Assets/_/Features/Adventurers/Runtime/AdventurerClassEnum.cs
Normal file
13
Assets/_/Features/Adventurers/Runtime/AdventurerClassEnum.cs
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
namespace Adventurer.Runtime
|
||||
{
|
||||
public enum AdventurerClassEnum
|
||||
{
|
||||
Thief,
|
||||
Warrior,
|
||||
Archer,
|
||||
Paladin,
|
||||
Priest,
|
||||
Mage,
|
||||
Barbarian,
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 54b4d05cd4924762ab71f0aa436dfa0c
|
||||
timeCreated: 1753475959
|
||||
99
Assets/_/Features/Adventurers/Runtime/AdventurerFactorySO.cs
Normal file
99
Assets/_/Features/Adventurers/Runtime/AdventurerFactorySO.cs
Normal file
|
|
@ -0,0 +1,99 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using Random = UnityEngine.Random;
|
||||
|
||||
namespace Adventurer.Runtime
|
||||
{
|
||||
[CreateAssetMenu(fileName = "AdventurerClass Factory", menuName = "Guild Tycoon/Adventurers/Factory", order = 0)]
|
||||
public class AdventurerFactorySO : ScriptableObject
|
||||
{
|
||||
public List<string> m_names;
|
||||
public List<AdventurerClassEnum> m_classes;
|
||||
public int m_baseLevel;
|
||||
public int m_minStat;
|
||||
public int m_maxStat;
|
||||
|
||||
public AdventurerClass CreateAdventurer()
|
||||
{
|
||||
string name = m_names[Random.Range(0, m_names.Count)];
|
||||
AdventurerClassEnum chosenClassEnum = m_classes[Random.Range(0, m_classes.Count)];
|
||||
|
||||
int level = m_baseLevel;
|
||||
int xp = 0;
|
||||
|
||||
int strength = 0;
|
||||
int defense = 0;
|
||||
int agility = 0;
|
||||
int intelligence = 0;
|
||||
|
||||
switch (chosenClassEnum)
|
||||
{
|
||||
case AdventurerClassEnum.Warrior:
|
||||
strength = Random.Range(14, 20);
|
||||
defense = Random.Range(10, 16);
|
||||
agility = Random.Range(6, 14);
|
||||
intelligence = Random.Range(4, 8);
|
||||
break;
|
||||
case AdventurerClassEnum.Mage:
|
||||
strength = Random.Range(4, 8);
|
||||
defense = Random.Range(6, 10);
|
||||
agility = Random.Range(6, 10);
|
||||
intelligence = Random.Range(14, 20);
|
||||
break;
|
||||
case AdventurerClassEnum.Archer:
|
||||
strength = Random.Range(4, 8);
|
||||
defense = Random.Range(6, 10);
|
||||
agility = Random.Range(14, 20);
|
||||
intelligence = Random.Range(4, 8);
|
||||
break;
|
||||
case AdventurerClassEnum.Paladin:
|
||||
strength = Random.Range(10, 14);
|
||||
defense = Random.Range(14, 20);
|
||||
agility = Random.Range(4, 8);
|
||||
intelligence = Random.Range(8, 12);
|
||||
break;
|
||||
case AdventurerClassEnum.Priest:
|
||||
strength = Random.Range(6, 10);
|
||||
defense = Random.Range(8, 12);
|
||||
agility = Random.Range(8, 12);
|
||||
intelligence = Random.Range(14, 20);
|
||||
break;
|
||||
case AdventurerClassEnum.Thief:
|
||||
strength = Random.Range(8, 14);
|
||||
defense = Random.Range(8, 12);
|
||||
agility = Random.Range(14, 20);
|
||||
intelligence = Random.Range(4, 8);
|
||||
break;
|
||||
case AdventurerClassEnum.Barbarian:
|
||||
strength = Random.Range(16, 20);
|
||||
defense = Random.Range(10, 14);
|
||||
agility = Random.Range(6, 10);
|
||||
intelligence = Random.Range(2, 6);
|
||||
break;
|
||||
default:
|
||||
// Classe non gérée
|
||||
break;
|
||||
}
|
||||
|
||||
var modelParts = new Dictionary<string, string>();
|
||||
modelParts["Ears"] = $"EARS/Ears Type {Random.Range(1, 2)}";
|
||||
modelParts["Eyebrows"] = $"EYEBROWS/Eyebrow Type {Random.Range(1, 5)} Color {Random.Range(1, 5)}";
|
||||
modelParts["Eyes"] = $"EYES/Eyes Type {Random.Range(1, 5)} Color {Random.Range(1, 5)}";
|
||||
modelParts["Face Hair"] = $"FACE HAIRS/Face Hair Type {Random.Range(1, 5)} Color {Random.Range(1, 5)}";
|
||||
modelParts["Hair"] = $"HAIRS/Hair Type {Random.Range(1, 5)} Color {Random.Range(1, 5)}";
|
||||
modelParts["Nose"] = $"NOSES/Nose Type {Random.Range(1, 5)}";
|
||||
|
||||
modelParts["Feet Armor"] = $"FEETS/Feet Armor Type {Random.Range(1, 5)} Color {Random.Range(1, 3)}";
|
||||
modelParts["Legs Armor"] = $"LEGS/Legs Armor Type {Random.Range(1, 5)} Color {Random.Range(1, 3)}";
|
||||
modelParts["Belts Armor"] = $"BELTS/Belts Armor Type {Random.Range(1, 6)} Color {Random.Range(1, 3)}";
|
||||
modelParts["Arm Armor"] = $"ARMORS/Arm Armor Type {Random.Range(1, 5)} Color {Random.Range(1, 3)}";
|
||||
modelParts["Chest Armor"] = $"CHESTS/Chest Armor Type {Random.Range(1, 5)} Color {Random.Range(1, 3)}";
|
||||
modelParts["Head Armor"] = $"HEADS/Head Armor Type {Random.Range(1, 6)} Color {Random.Range(1, 3)}";
|
||||
|
||||
DateTime now = DateTime.Now;
|
||||
|
||||
return new AdventurerClass(Guid.NewGuid(), name, chosenClassEnum, level, xp, strength, defense, intelligence, agility, modelParts, now);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 4c824ea52e0c4c33bd42fdbb00a0b5a7
|
||||
timeCreated: 1753476587
|
||||
8
Assets/_/Features/AudioSystem.meta
Normal file
8
Assets/_/Features/AudioSystem.meta
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 73a43a84340ff44929dfa709cce4bf76
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/_/Features/AudioSystem/Runtime.meta
Normal file
8
Assets/_/Features/AudioSystem/Runtime.meta
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 581d807ac8f474e31a0f18f5f4f0ad27
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
168
Assets/_/Features/AudioSystem/Runtime/AudioManager.cs
Normal file
168
Assets/_/Features/AudioSystem/Runtime/AudioManager.cs
Normal file
|
|
@ -0,0 +1,168 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Core.Runtime;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Audio;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace AudioSystem.Runtime
|
||||
{
|
||||
public class AudioManager : BaseMonobehaviour
|
||||
{
|
||||
|
||||
#region Publics
|
||||
|
||||
public static AudioManager Instance { get; private set; }
|
||||
|
||||
public enum AudioChannel
|
||||
{
|
||||
Master,
|
||||
Music,
|
||||
SFX,
|
||||
Ambiance
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Unity API
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
if (Instance != null)
|
||||
{
|
||||
Destroy(gameObject);
|
||||
return;
|
||||
}
|
||||
Instance = this;
|
||||
DontDestroyOnLoad(gameObject);
|
||||
|
||||
_sfxSource = gameObject.AddComponent<AudioSource>();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Main Methods
|
||||
|
||||
public void PlayLevelMusic()
|
||||
{
|
||||
if (_levelMusic != null)
|
||||
{
|
||||
PlayMusic(_levelMusic, true);
|
||||
}
|
||||
}
|
||||
|
||||
public void PlaySFX(AudioClip clip)
|
||||
{
|
||||
if(clip == null) return;
|
||||
_sfxSource.PlayOneShot(clip);
|
||||
}
|
||||
|
||||
public void PlaySFXByName(string name)
|
||||
{
|
||||
AudioClip clip = _sfxLibrary.FirstOrDefault(c => c.name == name);
|
||||
if (clip != null)
|
||||
{
|
||||
PlaySFX(clip);
|
||||
}
|
||||
}
|
||||
|
||||
public void PlayMusic(AudioClip clip, bool loop = true)
|
||||
{
|
||||
if(clip == null) return;
|
||||
_musicSource.clip = clip;
|
||||
_musicSource.loop = loop;
|
||||
_musicSource.Play();
|
||||
}
|
||||
|
||||
public void PlayAmbiance(AudioClip clip, bool loop = true)
|
||||
{
|
||||
if(clip == null) return;
|
||||
_ambianceSource.clip = clip;
|
||||
_ambianceSource.loop = true;
|
||||
_ambianceSource.Play();
|
||||
}
|
||||
|
||||
public void SetMasterVolume(float value)
|
||||
{
|
||||
if (_audioMixer != null)
|
||||
{
|
||||
_audioMixer.SetFloat("MasterVolume", Mathf.Log10(Mathf.Clamp(value, 0.0001f, 1)) * 20);
|
||||
}
|
||||
}
|
||||
|
||||
public void SetMusicVolume(float value)
|
||||
{
|
||||
if (_audioMixer != null)
|
||||
{
|
||||
_audioMixer.SetFloat("MusicVolume", Mathf.Log10(Mathf.Clamp(value, 0.0001f, 1)) * 20);
|
||||
}
|
||||
}
|
||||
|
||||
public void SetSFXVolume(float value)
|
||||
{
|
||||
if (_audioMixer != null)
|
||||
{
|
||||
_audioMixer.SetFloat("SFXVolume", Mathf.Log10(Mathf.Clamp(value, 0.0001f, 1)) * 20);
|
||||
}
|
||||
}
|
||||
|
||||
public void SetAmbianceVolume(float value)
|
||||
{
|
||||
if (_audioMixer != null)
|
||||
{
|
||||
_audioMixer.SetFloat("AmbianceVolume", Mathf.Log10(Mathf.Clamp(value, 0.0001f, 1)) * 20);
|
||||
}
|
||||
}
|
||||
|
||||
public void BinderVolume(Slider slider, AudioChannel channel)
|
||||
{
|
||||
if(slider == null) return;
|
||||
|
||||
switch (channel)
|
||||
{
|
||||
case AudioChannel.Master:
|
||||
slider.onValueChanged.AddListener(SetMasterVolume);
|
||||
break;
|
||||
case AudioChannel.Music:
|
||||
slider.onValueChanged.AddListener(SetMusicVolume);
|
||||
break;
|
||||
case AudioChannel.SFX:
|
||||
slider.onValueChanged.AddListener(SetSFXVolume);
|
||||
break;
|
||||
case AudioChannel.Ambiance:
|
||||
slider.onValueChanged.AddListener(SetAmbianceVolume);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Utils
|
||||
|
||||
/* Fonctions privées utiles */
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Privates and Protected
|
||||
|
||||
[Header("Source audio du level")]
|
||||
[SerializeField] private AudioClip _levelMusic;
|
||||
|
||||
[Header("Audio Sources")]
|
||||
[SerializeField] private AudioSource _musicSource;
|
||||
[SerializeField] private AudioSource _ambianceSource;
|
||||
[SerializeField] private List<AudioClip> _sfxLibrary;
|
||||
|
||||
[Header("Mixer (Optional)")]
|
||||
[SerializeField] private AudioMixer _audioMixer;
|
||||
|
||||
private AudioSource _sfxSource;
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: bf71e6ed782e4713b95188fa52438cd0
|
||||
timeCreated: 1751220977
|
||||
80
Assets/_/Features/AudioSystem/Runtime/LevelAudioHandler.cs
Normal file
80
Assets/_/Features/AudioSystem/Runtime/LevelAudioHandler.cs
Normal file
|
|
@ -0,0 +1,80 @@
|
|||
using System;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
namespace Core.Runtime
|
||||
{
|
||||
public class SceneLoader : BaseMonobehaviour
|
||||
{
|
||||
|
||||
#region Publics
|
||||
|
||||
public static event Action<Scene> OnSceneLoaded;
|
||||
public static string CurrentSceneName => SceneManager.GetActiveScene().name;
|
||||
public static SceneLoader Instance { get; private set; }
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Unity API
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
if (Instance != null)
|
||||
{
|
||||
Destroy(gameObject);
|
||||
return;
|
||||
}
|
||||
Instance = this;
|
||||
DontDestroyOnLoad(gameObject);
|
||||
|
||||
SceneManager.sceneLoaded += HandleSceneLoaded;
|
||||
}
|
||||
|
||||
void OnDestroy()
|
||||
{
|
||||
SceneManager.sceneLoaded -= HandleSceneLoaded;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Main Methods
|
||||
|
||||
public void LoadScene(string sceneName)
|
||||
{
|
||||
SceneManager.LoadScene(sceneName);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Utils
|
||||
|
||||
private void HandleSceneLoaded(Scene scene, LoadSceneMode mode)
|
||||
{
|
||||
OnSceneLoaded?.Invoke(scene);
|
||||
}
|
||||
|
||||
private bool SceneExists(string sceneName)
|
||||
{
|
||||
for (int i = 0; i < SceneManager.sceneCountInBuildSettings; i++)
|
||||
{
|
||||
string path = SceneUtility.GetScenePathByBuildIndex(i);
|
||||
string name = System.IO.Path.GetFileNameWithoutExtension(path);
|
||||
if (name == sceneName)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Privates and Protected
|
||||
|
||||
//
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: b6d9171f0555419780642bfda5037221
|
||||
timeCreated: 1751223652
|
||||
1
Assets/_/Features/Contenu.txt
Executable file
1
Assets/_/Features/Contenu.txt
Executable file
|
|
@ -0,0 +1 @@
|
|||
LE CODE
|
||||
7
Assets/_/Features/Contenu.txt.meta
Executable file
7
Assets/_/Features/Contenu.txt.meta
Executable file
|
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 316f69e8b296f2045901b9fbc5e1a35c
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/_/Features/Core.meta
Normal file
8
Assets/_/Features/Core.meta
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 48cfbe4e898706c4dad037e29ac2342c
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/_/Features/Core/.DS_Store
vendored
Normal file
BIN
Assets/_/Features/Core/.DS_Store
vendored
Normal file
Binary file not shown.
8
Assets/_/Features/Core/Runtime.meta
Normal file
8
Assets/_/Features/Core/Runtime.meta
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 99b0b58844aa49643b4d7a4ba155fbef
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/_/Features/Core/Runtime/.DS_Store
vendored
Normal file
BIN
Assets/_/Features/Core/Runtime/.DS_Store
vendored
Normal file
Binary file not shown.
131
Assets/_/Features/Core/Runtime/BaseMonoBehaviour.cs
Normal file
131
Assets/_/Features/Core/Runtime/BaseMonoBehaviour.cs
Normal file
|
|
@ -0,0 +1,131 @@
|
|||
using System.Collections.Generic;
|
||||
using Core.Runtime.Interfaces;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Core.Runtime
|
||||
{
|
||||
public class BaseMonobehaviour : MonoBehaviour
|
||||
{
|
||||
#region Publics
|
||||
|
||||
[Header("Debug")]
|
||||
[SerializeField] protected bool m_isVerbose;
|
||||
|
||||
public enum FactPersistence
|
||||
{
|
||||
Normal,
|
||||
Persistent,
|
||||
}
|
||||
|
||||
public GameObject GameObject => _gameObject ? _gameObject : _gameObject = gameObject;
|
||||
public Rigidbody Rigidbody => _rigidbody ? _rigidbody : _rigidbody = GetComponent<Rigidbody>();
|
||||
public Transform Transform => _transform ? _transform : _transform = GetComponent<Transform>();
|
||||
|
||||
#endregion
|
||||
|
||||
#region Fact Dictionnary
|
||||
|
||||
protected bool FactExists<T>(string key, out T value)
|
||||
{
|
||||
GameFacts.FactExists<T>(key, out value);
|
||||
return value != null;
|
||||
}
|
||||
|
||||
protected T GetFact<T>(string key)
|
||||
{
|
||||
return GameFacts.GetFact<T>(key);
|
||||
}
|
||||
|
||||
protected Dictionary<string, IFact> GetAllFacts()
|
||||
{
|
||||
return GameFacts.GetAllFacts();
|
||||
}
|
||||
|
||||
protected List<T> GetAllFactsOfType<T>()
|
||||
{
|
||||
return GameFacts.GetAllFactsOfType<T>();
|
||||
}
|
||||
|
||||
protected void SetFact<T>(string key, T value, FactPersistence persistence = FactPersistence.Normal)
|
||||
{
|
||||
GameFacts.SetFact<T>(key, value, persistence);
|
||||
}
|
||||
|
||||
protected void RemoveFact<T>(string key)
|
||||
{
|
||||
GameFacts.RemoveFact<T>(key);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Save System
|
||||
|
||||
protected void GenerateProfile(string profileName)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
protected List<string> GetAllSaves()
|
||||
{
|
||||
return GameFacts.GetAllSaves();
|
||||
}
|
||||
|
||||
protected void SaveFacts(string slotName = "")
|
||||
{
|
||||
string slot = GameManager.Instance.Profile;
|
||||
if (slotName != "")
|
||||
{
|
||||
slot = slotName;
|
||||
}
|
||||
|
||||
GameFacts.SaveFacts(slot);
|
||||
}
|
||||
|
||||
protected void LoadFacts(string slotName = "")
|
||||
{
|
||||
string slot = GameManager.Instance.Profile;
|
||||
if (slotName != "")
|
||||
{
|
||||
slot = slotName;
|
||||
}
|
||||
|
||||
GameFacts.LoadFacts(slot);
|
||||
}
|
||||
|
||||
protected void DeleteSaveFile()
|
||||
{
|
||||
GameFacts.DeleteSaveFile(GameManager.Instance.Profile);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region DEBUG
|
||||
|
||||
protected void Info(string message)
|
||||
{
|
||||
Debug.Log(message);
|
||||
}
|
||||
|
||||
protected void Error(string message)
|
||||
{
|
||||
Debug.LogError(message);
|
||||
}
|
||||
|
||||
protected void Warning(string message)
|
||||
{
|
||||
Debug.LogWarning(message);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GETTERS
|
||||
|
||||
private GameObject _gameObject;
|
||||
private Rigidbody _rigidbody;
|
||||
private Transform _transform;
|
||||
|
||||
protected FactDictionnary GameFacts => GameManager.m_gameFacts;
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
2
Assets/_/Features/Core/Runtime/BaseMonoBehaviour.cs.meta
Normal file
2
Assets/_/Features/Core/Runtime/BaseMonoBehaviour.cs.meta
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 5a0991893b6c24954afe021de03614ad
|
||||
16
Assets/_/Features/Core/Runtime/Core.Runtime.asmdef
Normal file
16
Assets/_/Features/Core/Runtime/Core.Runtime.asmdef
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
{
|
||||
"name": "Core.Runtime",
|
||||
"rootNamespace": "Core.Runtime",
|
||||
"references": [
|
||||
"GUID:6055be8ebefd69e48b49212b09b47b2f"
|
||||
],
|
||||
"includePlatforms": [],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": false,
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": true,
|
||||
"defineConstraints": [],
|
||||
"versionDefines": [],
|
||||
"noEngineReferences": false
|
||||
}
|
||||
7
Assets/_/Features/Core/Runtime/Core.Runtime.asmdef.meta
Normal file
7
Assets/_/Features/Core/Runtime/Core.Runtime.asmdef.meta
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 2ca720bbf8aa349608caa5ce4acaa603
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/_/Features/Core/Runtime/FactsSystem.meta
Normal file
8
Assets/_/Features/Core/Runtime/FactsSystem.meta
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 50fff7e431d747439539a559d25219d3
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
42
Assets/_/Features/Core/Runtime/FactsSystem/Fact.cs
Normal file
42
Assets/_/Features/Core/Runtime/FactsSystem/Fact.cs
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
using System;
|
||||
using Core.Runtime.Interfaces;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Core.Runtime
|
||||
{
|
||||
public class Fact<T> : IFact
|
||||
{
|
||||
|
||||
#region Publics
|
||||
|
||||
public T Value;
|
||||
|
||||
public Fact(object value, bool isPersistent)
|
||||
{
|
||||
Value = (T) value;
|
||||
IsPersistent = isPersistent;
|
||||
}
|
||||
|
||||
public Type ValueType => typeof(T);
|
||||
|
||||
[JsonIgnore]
|
||||
public object GetObjectValue => Value;
|
||||
|
||||
public void SetObjectValue(object value)
|
||||
{
|
||||
if (value is T cast)
|
||||
{
|
||||
Value = cast;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new InvalidCastException("Cannot asign a value to a fact");
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsPersistent { get; set; }
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
3
Assets/_/Features/Core/Runtime/FactsSystem/Fact.cs.meta
Normal file
3
Assets/_/Features/Core/Runtime/FactsSystem/Fact.cs.meta
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: dbdaad04e901476ebafb6f2c0d22a257
|
||||
timeCreated: 1752132457
|
||||
214
Assets/_/Features/Core/Runtime/FactsSystem/FactDictionary.cs
Normal file
214
Assets/_/Features/Core/Runtime/FactsSystem/FactDictionary.cs
Normal file
|
|
@ -0,0 +1,214 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using Core.Runtime.Interfaces;
|
||||
using Newtonsoft.Json;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Core.Runtime
|
||||
{
|
||||
public class FactDictionnary
|
||||
{
|
||||
#region Publics
|
||||
|
||||
public Dictionary<string, IFact> AllFacts => _facts;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Main Methods
|
||||
|
||||
public bool FactExists<T>(string key, out T value)
|
||||
{
|
||||
if (_facts.TryGetValue(key, out var fact) && fact is Fact<T> typedFact)
|
||||
{
|
||||
value = typedFact.Value;
|
||||
return true;
|
||||
}
|
||||
|
||||
value = default;
|
||||
return false;
|
||||
}
|
||||
|
||||
public void SetFact<T>(string key, T value, BaseMonobehaviour.FactPersistence persistence)
|
||||
{
|
||||
if (_facts.TryGetValue(key, out var existingFact))
|
||||
{
|
||||
if (existingFact is Fact<T> typedFact)
|
||||
{
|
||||
typedFact.Value = value;
|
||||
typedFact.IsPersistent = persistence == BaseMonobehaviour.FactPersistence.Persistent;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new InvalidCastException("Fact exists but is a wrong type");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
bool isPersistent = persistence == BaseMonobehaviour.FactPersistence.Persistent;
|
||||
_facts[key] = new Fact<T>(value, isPersistent);
|
||||
}
|
||||
}
|
||||
|
||||
public T GetFact<T>(string key)
|
||||
{
|
||||
if (!_facts.TryGetValue(key, out var fact))
|
||||
{
|
||||
throw new InvalidCastException($"Fact {key} does not exist");
|
||||
}
|
||||
|
||||
if (_facts[key] is not Fact<T> typedFact)
|
||||
{
|
||||
throw new InvalidCastException($"Fact {key} is not of type {typeof(T)}");
|
||||
}
|
||||
|
||||
return typedFact.Value;
|
||||
}
|
||||
|
||||
public Dictionary<string, IFact> GetAllFacts()
|
||||
{
|
||||
return AllFacts;
|
||||
}
|
||||
|
||||
public List<T> GetAllFactsOfType<T>()
|
||||
{
|
||||
List<T> list = new();
|
||||
foreach (var fact in _facts.Values)
|
||||
{
|
||||
if (fact is Fact<T> typedFact)
|
||||
{
|
||||
list.Add(typedFact.Value);
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public void RemoveFact<T>(string key)
|
||||
{
|
||||
_facts.Remove(key);
|
||||
}
|
||||
|
||||
public List<string> GetAllSaves()
|
||||
{
|
||||
foreach (var slot in Directory.GetFiles(Application.persistentDataPath))
|
||||
{
|
||||
if (slot.Contains("_save.json") && (!slot.Contains("GeneralSettings") || !slot.Contains("continue")))
|
||||
{
|
||||
string fileName = Path.GetFileNameWithoutExtension(slot);
|
||||
if (fileName.EndsWith("_save"))
|
||||
{
|
||||
string slotName = fileName.Substring(0, fileName.Length - "_save".Length); // "Rom1"
|
||||
_saves.Add(slotName);
|
||||
}
|
||||
}
|
||||
}
|
||||
return _saves;
|
||||
}
|
||||
|
||||
public bool SaveFileExists(string slotName= "")
|
||||
{
|
||||
if (slotName != "")
|
||||
{
|
||||
string filename = Path.Combine(Application.persistentDataPath, $"{slotName}_save.json");
|
||||
return File.Exists(filename);
|
||||
}
|
||||
|
||||
int nbFiles = Directory.GetFiles(Application.persistentDataPath, "*.json").Length;
|
||||
string fileSettings = Path.Combine(Application.persistentDataPath, "GeneralSettings_save.json");
|
||||
string fileContinue = Path.Combine(Application.persistentDataPath, "continue_save.json");
|
||||
if (File.Exists(fileSettings)) nbFiles--; // On retire le fichier nommé GeneralSettings_save.json
|
||||
if (File.Exists(fileContinue)) nbFiles--; // On retire le fichier nommé continue_save.json
|
||||
|
||||
if(nbFiles <= 0) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool SaveFacts(string slotName)
|
||||
{
|
||||
Dictionary<string, IFact> persistentsFacts = GetPersistentsFacts();
|
||||
|
||||
// Permet à Newtonsoft de savoir quel type concret sérialiser via le champ $type
|
||||
JsonSerializerSettings settings = new JsonSerializerSettings
|
||||
{
|
||||
Formatting = Formatting.Indented,
|
||||
NullValueHandling = NullValueHandling.Ignore,
|
||||
DateFormatHandling = DateFormatHandling.IsoDateFormat,
|
||||
TypeNameHandling = TypeNameHandling.All // Ajout du type dans le JSON
|
||||
};
|
||||
|
||||
string json = JsonConvert.SerializeObject(persistentsFacts, settings);
|
||||
string filename = Path.Combine(Application.persistentDataPath, $"{slotName}_save.json");
|
||||
|
||||
Debug.Log($"Saving to {filename}");
|
||||
|
||||
try
|
||||
{
|
||||
File.WriteAllText(filename, json);
|
||||
_saves.Add(slotName);
|
||||
return true;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public bool LoadFacts(string slotName)
|
||||
{
|
||||
string file = Path.Combine(Application.persistentDataPath, $"{slotName}_save.json");
|
||||
if (File.Exists(file))
|
||||
{
|
||||
// Permet à Newtonsoft de savoir quel type concret désérialiser via le champ $type
|
||||
JsonSerializerSettings settings = new JsonSerializerSettings
|
||||
{
|
||||
TypeNameHandling = TypeNameHandling.All
|
||||
};
|
||||
|
||||
string json = File.ReadAllText(file);
|
||||
Dictionary<string, IFact> facts = JsonConvert.DeserializeObject<Dictionary<string, IFact>>(json, settings);
|
||||
|
||||
foreach (var fact in facts)
|
||||
{
|
||||
_facts[fact.Key] = fact.Value;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public void DeleteSaveFile(string slotName)
|
||||
{
|
||||
string file = Path.Combine(Application.persistentDataPath, $"{slotName}_save.json");
|
||||
File.Delete(file);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Utils
|
||||
|
||||
private Dictionary<string, IFact> GetPersistentsFacts()
|
||||
{
|
||||
Dictionary<string, IFact> persistentsFacts = new();
|
||||
|
||||
foreach (var fact in _facts)
|
||||
{
|
||||
if (fact.Value.IsPersistent)
|
||||
{
|
||||
persistentsFacts.Add(fact.Key, fact.Value);
|
||||
}
|
||||
}
|
||||
return persistentsFacts;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region private
|
||||
|
||||
private Dictionary<string, IFact> _facts = new();
|
||||
private List<string> _saves = new List<string>();
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: bb7f99aca4b5495aaecca229e21225ef
|
||||
timeCreated: 1752132416
|
||||
208
Assets/_/Features/Core/Runtime/GameManager.cs
Normal file
208
Assets/_/Features/Core/Runtime/GameManager.cs
Normal file
|
|
@ -0,0 +1,208 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
namespace Core.Runtime
|
||||
{
|
||||
public class GameManager: BaseMonobehaviour
|
||||
{
|
||||
|
||||
/*
|
||||
* Appel depuis ici
|
||||
* Localization => A FAIRE
|
||||
*/
|
||||
|
||||
#region Publics
|
||||
|
||||
public static GameManager Instance { get; private set; }
|
||||
|
||||
public static FactDictionnary m_gameFacts;
|
||||
|
||||
public bool IsOnPause
|
||||
{
|
||||
get => isOnPause;
|
||||
set => isOnPause = value;
|
||||
}
|
||||
|
||||
public FactDictionnary Fact
|
||||
{
|
||||
get
|
||||
{
|
||||
return _fact;
|
||||
}
|
||||
set
|
||||
{
|
||||
_fact = value;
|
||||
}
|
||||
}
|
||||
|
||||
public String Profile
|
||||
{
|
||||
get
|
||||
{
|
||||
return _profile;
|
||||
}
|
||||
set
|
||||
{
|
||||
_profile = value;
|
||||
}
|
||||
}
|
||||
|
||||
public bool SaveFileExist => m_gameFacts.SaveFileExists();
|
||||
|
||||
public bool CanPause
|
||||
{
|
||||
get => _canPause;
|
||||
set => _canPause = value;
|
||||
}
|
||||
|
||||
public string CurrentLanguage
|
||||
{
|
||||
get
|
||||
{
|
||||
return _currentLanguage;
|
||||
}
|
||||
set
|
||||
{
|
||||
_currentLanguage = value;
|
||||
}
|
||||
}
|
||||
|
||||
public Dictionary<string, string> GetLocalTexts
|
||||
{
|
||||
get
|
||||
{
|
||||
return _localTexts;
|
||||
}
|
||||
set
|
||||
{
|
||||
_localTexts = value;
|
||||
}
|
||||
}
|
||||
|
||||
public int CurrentGameTime
|
||||
{
|
||||
get
|
||||
{
|
||||
return _currentGameTime;
|
||||
}
|
||||
set
|
||||
{
|
||||
_currentGameTime = value;
|
||||
}
|
||||
}
|
||||
|
||||
public bool LaunchedTime
|
||||
{
|
||||
get
|
||||
{
|
||||
return _launchedTime;
|
||||
}
|
||||
set
|
||||
{
|
||||
_launchedTime = value;
|
||||
}
|
||||
}
|
||||
|
||||
public static event Action<int> OnTimeAdvanced;
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Unity API
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
_sceneLoader = GetComponent<SceneLoader>();
|
||||
// Si une instance existe déjà et que ce n’est pas celle-ci, détruire ce GameObject
|
||||
if (Instance != null && Instance != this)
|
||||
{
|
||||
Destroy(gameObject);
|
||||
return;
|
||||
}
|
||||
|
||||
// Sinon, cette instance devient l’instance unique
|
||||
Instance = this;
|
||||
DontDestroyOnLoad(gameObject);
|
||||
|
||||
m_gameFacts = new FactDictionnary();
|
||||
_localTexts = new Dictionary<string, string>();
|
||||
|
||||
LoadFacts("GeneralSettings");
|
||||
_fact = m_gameFacts;
|
||||
CurrentLanguage = m_gameFacts.GetFact<string>("language");
|
||||
|
||||
if (!m_gameFacts.FactExists<string>("language", out _))
|
||||
{
|
||||
m_gameFacts.SetFact("language", "fr", FactPersistence.Persistent);
|
||||
}
|
||||
LocalizationSystem.Instance.LoadLanguage();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Main Methods
|
||||
|
||||
public void ReloadScene()
|
||||
{
|
||||
string sceneName = SceneManager.GetActiveScene().name;
|
||||
_sceneLoader.LoadScene(sceneName);
|
||||
}
|
||||
|
||||
public void UpdateGameTime(GameTime gameTime)
|
||||
{
|
||||
_gameTime = gameTime;
|
||||
}
|
||||
|
||||
// Time Gestion
|
||||
public void AdvanceTime(int secondes)
|
||||
{
|
||||
_gameTime.Advance(secondes);
|
||||
OnTimeAdvanced?.Invoke(_gameTime.TotalSeconds);
|
||||
}
|
||||
|
||||
public void LaunchGameTime()
|
||||
{
|
||||
if (LaunchedTime) return;
|
||||
LaunchedTime = true;
|
||||
StartCoroutine(TimeTickLoop());
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Utils
|
||||
|
||||
/* Fonctions privées utiles */
|
||||
private IEnumerator TimeTickLoop()
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
yield return new WaitForSecondsRealtime(1f);
|
||||
AdvanceTime(1);
|
||||
_currentGameTime++;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Privates and Protected
|
||||
|
||||
private bool isOnPause = false;
|
||||
private SceneLoader _sceneLoader;
|
||||
private FactDictionnary _fact;
|
||||
private bool _canPause;
|
||||
private string _profile;
|
||||
private string _currentLanguage = "en";
|
||||
private Dictionary<string, string> _localTexts;
|
||||
bool _launchedTime;
|
||||
int _currentGameTime = 0;
|
||||
GameTime _gameTime;
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
11
Assets/_/Features/Core/Runtime/GameManager.cs.meta
Normal file
11
Assets/_/Features/Core/Runtime/GameManager.cs.meta
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 3664fb5e6bffa4a6cbfc8fce31b53be3
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 11
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
39
Assets/_/Features/Core/Runtime/GameTime.cs
Normal file
39
Assets/_/Features/Core/Runtime/GameTime.cs
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
using System;
|
||||
|
||||
namespace Core.Runtime
|
||||
{
|
||||
[Serializable]
|
||||
public class GameTime
|
||||
{
|
||||
public int Seconds { get; set; }
|
||||
public int Minutes { get; set; }
|
||||
public int Hours { get; set; }
|
||||
public int Days { get; set; }
|
||||
|
||||
public int TotalSeconds => Days * 86400 + Hours * 3600 + Minutes * 60 + Seconds;
|
||||
public int TotalMinutes => Days * 1440 + Hours * 60 + Minutes;
|
||||
public int TotalHours => Days * 24 + Hours;
|
||||
public int TotalDays => Days;
|
||||
|
||||
public GameTime()
|
||||
{
|
||||
Minutes = 0;
|
||||
Hours = 0;
|
||||
Days = 0;
|
||||
}
|
||||
|
||||
public void Advance(int seconds)
|
||||
{
|
||||
Seconds += seconds;
|
||||
|
||||
while (Seconds >= 60) { Seconds -= 60; Minutes++; }
|
||||
while (Minutes >= 60) { Minutes -= 60; Hours++; }
|
||||
while (Hours >= 24) { Hours -= 24; Days++; }
|
||||
}
|
||||
|
||||
public int SnapTime()
|
||||
{
|
||||
return TotalSeconds;
|
||||
}
|
||||
}
|
||||
}
|
||||
3
Assets/_/Features/Core/Runtime/GameTime.cs.meta
Normal file
3
Assets/_/Features/Core/Runtime/GameTime.cs.meta
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 6afd02148ba241d8ae8592ca5fb38d9f
|
||||
timeCreated: 1754390983
|
||||
8
Assets/_/Features/Core/Runtime/Interfaces.meta
Normal file
8
Assets/_/Features/Core/Runtime/Interfaces.meta
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: c2c2153ca77294f16adf4ecf6b122114
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
12
Assets/_/Features/Core/Runtime/Interfaces/IFact.cs
Normal file
12
Assets/_/Features/Core/Runtime/Interfaces/IFact.cs
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
using System;
|
||||
|
||||
namespace Core.Runtime.Interfaces
|
||||
{
|
||||
public interface IFact
|
||||
{
|
||||
Type ValueType { get; }
|
||||
object GetObjectValue { get; }
|
||||
void SetObjectValue(object value);
|
||||
bool IsPersistent { get; }
|
||||
}
|
||||
}
|
||||
3
Assets/_/Features/Core/Runtime/Interfaces/IFact.cs.meta
Normal file
3
Assets/_/Features/Core/Runtime/Interfaces/IFact.cs.meta
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 28d823c3a267436eaf00bf170c9669f9
|
||||
timeCreated: 1752132484
|
||||
107
Assets/_/Features/Core/Runtime/LocalizationSystem.cs
Normal file
107
Assets/_/Features/Core/Runtime/LocalizationSystem.cs
Normal file
|
|
@ -0,0 +1,107 @@
|
|||
using System.IO;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Core.Runtime
|
||||
{
|
||||
public class LocalizationSystem : BaseMonobehaviour
|
||||
{
|
||||
|
||||
#region Publics
|
||||
|
||||
public static LocalizationSystem Instance { get; private set; }
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Unity API
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
if (Instance != null && Instance != this)
|
||||
{
|
||||
Destroy(gameObject);
|
||||
return;
|
||||
}
|
||||
|
||||
Instance = this;
|
||||
DontDestroyOnLoad(gameObject);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Main Methods
|
||||
|
||||
public void LocalizeAllTextsIn(Transform root)
|
||||
{
|
||||
foreach (var txt in root.GetComponentsInChildren<TMP_Text>(true))
|
||||
{
|
||||
txt.text = GetLocalizedText(txt.text);
|
||||
}
|
||||
}
|
||||
|
||||
public string GetLocalizedText(string key)
|
||||
{
|
||||
if (GameManager.Instance.GetLocalTexts.TryGetValue(key, out var value))
|
||||
return value;
|
||||
|
||||
return $"{key}";
|
||||
}
|
||||
|
||||
public void SaveLanguage(string newLanguage)
|
||||
{
|
||||
if (FactExists<string>("language", out var language))
|
||||
{
|
||||
RemoveFact<string>("language");
|
||||
SetFact<string>("language", newLanguage, FactPersistence.Persistent);
|
||||
}
|
||||
SetFact<string>("language", newLanguage, FactPersistence.Persistent);
|
||||
}
|
||||
|
||||
public void LoadLanguage()
|
||||
{
|
||||
/*if (!FactExists<string>("language", out var language))
|
||||
{
|
||||
SetFact("language", language, FactPersistence.Persistent);
|
||||
}*/
|
||||
|
||||
string lang = GetLanguage();
|
||||
GameManager.Instance.CurrentLanguage = lang;
|
||||
|
||||
string langFile = GetLanguageFile();
|
||||
if (!string.IsNullOrEmpty(langFile))
|
||||
{
|
||||
GameManager.Instance.GetLocalTexts = XmlLoader.LoadDictionary(GetLanguageFile());
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Utils
|
||||
|
||||
private string GetLanguage()
|
||||
{
|
||||
string file = GetLanguageFile();
|
||||
|
||||
return file.Split('/')[file.Split('/').Length - 1].Split('.')[0];
|
||||
}
|
||||
|
||||
private string GetLanguageFile()
|
||||
{
|
||||
string filename = Application.dataPath + "/_/Database/Localization/" + GetFact<string>("language") + ".xml";
|
||||
|
||||
if (File.Exists(filename))
|
||||
{
|
||||
return filename;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 02c5410883674e91875167d2ef34abe5
|
||||
timeCreated: 1752475493
|
||||
111
Assets/_/Features/Core/Runtime/SceneLoader.cs
Normal file
111
Assets/_/Features/Core/Runtime/SceneLoader.cs
Normal file
|
|
@ -0,0 +1,111 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
using Random = UnityEngine.Random;
|
||||
|
||||
namespace Core.Runtime
|
||||
{
|
||||
public class SceneLoader : BaseMonobehaviour
|
||||
{
|
||||
|
||||
#region Publics
|
||||
|
||||
public static event Action<Scene> OnSceneLoaded;
|
||||
public static string CurrentSceneName => SceneManager.GetActiveScene().name;
|
||||
public static SceneLoader Instance { get; private set; }
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Unity API
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
if (Instance != null)
|
||||
{
|
||||
Destroy(gameObject);
|
||||
return;
|
||||
}
|
||||
Instance = this;
|
||||
DontDestroyOnLoad(gameObject);
|
||||
|
||||
SceneManager.sceneLoaded += HandleSceneLoaded;
|
||||
}
|
||||
|
||||
void OnDestroy()
|
||||
{
|
||||
SceneManager.sceneLoaded -= HandleSceneLoaded;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Main Methods
|
||||
|
||||
public void LoadScene(string sceneName)
|
||||
{
|
||||
SceneManager.LoadScene(sceneName);
|
||||
}
|
||||
|
||||
public void FakeLoading(string nextSceneName)
|
||||
{
|
||||
if (SceneExists("Loading"))
|
||||
{
|
||||
LoadScene("Loading");
|
||||
StartCoroutine(WaitingLoading(nextSceneName));
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Utils
|
||||
|
||||
private IEnumerator WaitingLoading(string nextSceneName)
|
||||
{
|
||||
int time = Random.Range(3, 6);
|
||||
yield return new WaitForSeconds(time);
|
||||
LoadScene(nextSceneName);
|
||||
}
|
||||
|
||||
private void HandleSceneLoaded(Scene scene, LoadSceneMode mode)
|
||||
{
|
||||
if (FactExists<GameTime>("game_time", out _))
|
||||
{
|
||||
GameTime gameTime = GetFact<GameTime>("game_time");
|
||||
GameManager.Instance.UpdateGameTime(gameTime);
|
||||
GameManager.Instance.CurrentGameTime = gameTime.TotalSeconds;
|
||||
GameManager.Instance.LaunchGameTime();
|
||||
}
|
||||
else
|
||||
{
|
||||
// Debug supprimé
|
||||
}
|
||||
|
||||
OnSceneLoaded?.Invoke(scene);
|
||||
}
|
||||
|
||||
private bool SceneExists(string sceneName)
|
||||
{
|
||||
for (int i = 0; i < SceneManager.sceneCountInBuildSettings; i++)
|
||||
{
|
||||
string path = SceneUtility.GetScenePathByBuildIndex(i);
|
||||
string name = System.IO.Path.GetFileNameWithoutExtension(path);
|
||||
if (name == sceneName)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Privates and Protected
|
||||
|
||||
//
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
3
Assets/_/Features/Core/Runtime/SceneLoader.cs.meta
Normal file
3
Assets/_/Features/Core/Runtime/SceneLoader.cs.meta
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 9a4bd386e20d414fb3e91c510e890143
|
||||
timeCreated: 1751130958
|
||||
53
Assets/_/Features/Core/Runtime/UIManager.cs
Normal file
53
Assets/_/Features/Core/Runtime/UIManager.cs
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Core.Runtime
|
||||
{
|
||||
public class UIManager : BaseMonobehaviour
|
||||
{
|
||||
|
||||
#region Publics
|
||||
|
||||
public void ShowPanel(GameObject panel)
|
||||
{
|
||||
panel.SetActive(true);
|
||||
}
|
||||
|
||||
public void HideAllPanels()
|
||||
{
|
||||
foreach (var p in panels)
|
||||
p.SetActive(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Unity API
|
||||
|
||||
//
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Main Methods
|
||||
|
||||
//
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Utils
|
||||
|
||||
/* Fonctions privées utiles */
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Privates and Protected
|
||||
|
||||
[SerializeField] private List<GameObject> panels;
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
3
Assets/_/Features/Core/Runtime/UIManager.cs.meta
Normal file
3
Assets/_/Features/Core/Runtime/UIManager.cs.meta
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 1ae1264b4c494dc9b3afa715fe5100e0
|
||||
timeCreated: 1754230913
|
||||
21
Assets/_/Features/Core/Runtime/XmlLoader.cs
Normal file
21
Assets/_/Features/Core/Runtime/XmlLoader.cs
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace Core.Runtime
|
||||
{
|
||||
public class XmlLoader
|
||||
{
|
||||
public static Dictionary<string, string> LoadDictionary(string filepath)
|
||||
{
|
||||
XDocument xmlDoc = XDocument.Load(filepath);
|
||||
return xmlDoc.Root
|
||||
.Elements()
|
||||
.ToDictionary(
|
||||
e => e.Name.LocalName,
|
||||
e => e.Value
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
3
Assets/_/Features/Core/Runtime/XmlLoader.cs.meta
Normal file
3
Assets/_/Features/Core/Runtime/XmlLoader.cs.meta
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: f0170f390842426a826731a88149968e
|
||||
timeCreated: 1752483882
|
||||
3
Assets/_/Features/Decor.meta
Normal file
3
Assets/_/Features/Decor.meta
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 2f78b835dfce4349ad7522d7b63084f1
|
||||
timeCreated: 1754087596
|
||||
BIN
Assets/_/Features/Decor/.DS_Store
vendored
Normal file
BIN
Assets/_/Features/Decor/.DS_Store
vendored
Normal file
Binary file not shown.
8
Assets/_/Features/Decor/Runtime.meta
Normal file
8
Assets/_/Features/Decor/Runtime.meta
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 79112082853e24a739e574adbd07c748
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/_/Features/Decor/Runtime/.DS_Store
vendored
Normal file
BIN
Assets/_/Features/Decor/Runtime/.DS_Store
vendored
Normal file
Binary file not shown.
3
Assets/_/Features/Decor/Runtime/Adventurer.meta
Normal file
3
Assets/_/Features/Decor/Runtime/Adventurer.meta
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: e82eea4c6be94d0bb12fda846a7eaf10
|
||||
timeCreated: 1754301470
|
||||
43
Assets/_/Features/Decor/Runtime/Adventurer/InfoAdventurer.cs
Normal file
43
Assets/_/Features/Decor/Runtime/Adventurer/InfoAdventurer.cs
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
using UnityEngine;
|
||||
|
||||
namespace Decor.Runtime
|
||||
{
|
||||
public class InfoAdventurer : MonoBehaviour
|
||||
{
|
||||
|
||||
#region Publics
|
||||
|
||||
//
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Unity API
|
||||
|
||||
//
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Main Methods
|
||||
|
||||
//
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Utils
|
||||
|
||||
/* Fonctions privées utiles */
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Privates and Protected
|
||||
|
||||
// Variables privées
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: c255cd054d9a4063be4d44bce3a41fdb
|
||||
timeCreated: 1754301480
|
||||
|
|
@ -0,0 +1,78 @@
|
|||
using System.Collections.Generic;
|
||||
using Adventurer.Runtime;
|
||||
using Core.Runtime;
|
||||
using EventSystem.Runtime;
|
||||
using Player.Runtime;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Decor.Runtime
|
||||
{
|
||||
public class AdventurerApearanceSpawner : BaseMonobehaviour
|
||||
{
|
||||
|
||||
#region Publics
|
||||
|
||||
//
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Unity API
|
||||
|
||||
void Start()
|
||||
{
|
||||
AdventurerSignals.OnAdventurerSpawnRequested += OnSpawnAdventurerModel;
|
||||
|
||||
List<AdventurerClass> allAdventurers = GetFact<List<AdventurerClass>>("my_adventurers");
|
||||
|
||||
foreach (AdventurerClass adventurer in allAdventurers)
|
||||
{
|
||||
OnSpawnAdventurerModel(adventurer);
|
||||
_countAdventurers++;
|
||||
}
|
||||
|
||||
StartCoroutine(WaitAndDeactivatePortraitGenerator());
|
||||
}
|
||||
|
||||
void OnDestroy()
|
||||
{
|
||||
AdventurerSignals.OnAdventurerSpawnRequested -= OnSpawnAdventurerModel;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Main Methods
|
||||
|
||||
void OnSpawnAdventurerModel(AdventurerClass adventurerClass)
|
||||
{
|
||||
GameObject model = Instantiate(_adventurerPrefab, transform);
|
||||
model.GetComponent<AdventurerModelBinder>().SetupFromAdventurer(adventurerClass);
|
||||
_portraitGenerator.GeneratePortrait(adventurerClass, _adventurerPrefab);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Utils
|
||||
|
||||
System.Collections.IEnumerator WaitAndDeactivatePortraitGenerator()
|
||||
{
|
||||
yield return new WaitUntil(() => _countAdventurers == GetFact<PlayerClass>(GameManager.Instance.Profile).AdventurersCount);
|
||||
yield return new WaitForSeconds(1f);
|
||||
_portraitGenerator.GameObject.SetActive(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Privates and Protected
|
||||
|
||||
[SerializeField] GameObject _adventurerPrefab;
|
||||
[SerializeField] PortraitGenerator _portraitGenerator;
|
||||
|
||||
int _countAdventurers = 0;
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: d4245e562f224986b9ea19f4b0917793
|
||||
timeCreated: 1754087745
|
||||
60
Assets/_/Features/Decor/Runtime/AdventurerModelBinder.cs
Normal file
60
Assets/_/Features/Decor/Runtime/AdventurerModelBinder.cs
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
using Adventurer.Runtime;
|
||||
using Core.Runtime;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Decor.Runtime
|
||||
{
|
||||
public class AdventurerModelBinder : BaseMonobehaviour
|
||||
{
|
||||
|
||||
#region Publics
|
||||
|
||||
//
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Unity API
|
||||
|
||||
//
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Main Methods
|
||||
|
||||
public void SetupFromAdventurer(AdventurerClass adventurerClass)
|
||||
{
|
||||
foreach (Transform part in partsRoot)
|
||||
{
|
||||
part.gameObject.SetActive(true);
|
||||
}
|
||||
|
||||
foreach (string partName in adventurerClass.ModelParts.Values)
|
||||
{
|
||||
Transform target = partsRoot.Find(partName);
|
||||
if (target != null)
|
||||
{
|
||||
target.gameObject.SetActive(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Utils
|
||||
|
||||
/* Fonctions privées utiles */
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Privates and Protected
|
||||
|
||||
[SerializeField] private Transform partsRoot;
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 13ac9df85abf4e1686d9d9a345cc5758
|
||||
timeCreated: 1754088153
|
||||
19
Assets/_/Features/Decor/Runtime/Decor.Runtime.asmdef
Normal file
19
Assets/_/Features/Decor/Runtime/Decor.Runtime.asmdef
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
{
|
||||
"name": "Decor.Runtime",
|
||||
"rootNamespace": "",
|
||||
"references": [
|
||||
"GUID:2ca720bbf8aa349608caa5ce4acaa603",
|
||||
"GUID:d01b71ecbce444a299cc1623f29e9d35",
|
||||
"GUID:4a640bb60ad60478bba0cc41f9b80929",
|
||||
"GUID:f5d0434d9e8c34eb1a16f4c57b172b85"
|
||||
],
|
||||
"includePlatforms": [],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": false,
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": true,
|
||||
"defineConstraints": [],
|
||||
"versionDefines": [],
|
||||
"noEngineReferences": false
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 796a630e69a1c47f2af3fab5e2bbe0de
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
3
Assets/_/Features/Decor/Runtime/Portrait.meta
Normal file
3
Assets/_/Features/Decor/Runtime/Portrait.meta
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 17b019320dd2465ebce9f1a32399841e
|
||||
timeCreated: 1754129237
|
||||
|
|
@ -0,0 +1,93 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using _.Features.Decor.Runtime;
|
||||
using Adventurer.Runtime;
|
||||
using Core.Runtime;
|
||||
using Player.Runtime;
|
||||
using UnityEngine;
|
||||
using UnityEngine.AI;
|
||||
|
||||
namespace Decor.Runtime
|
||||
{
|
||||
public class PortraitGenerator : BaseMonobehaviour
|
||||
{
|
||||
|
||||
#region Publics
|
||||
|
||||
//
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Unity API
|
||||
|
||||
//
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Main Methods
|
||||
|
||||
Queue<(AdventurerClass, GameObject)> _queue = new();
|
||||
bool _isProcessing = false;
|
||||
|
||||
public void GeneratePortrait(AdventurerClass adventurerClass, GameObject prefab)
|
||||
{
|
||||
if (!gameObject.activeInHierarchy)
|
||||
{
|
||||
return;
|
||||
}
|
||||
_queue.Enqueue((adventurerClass, prefab));
|
||||
if (!_isProcessing)
|
||||
{
|
||||
StartCoroutine(ProcessQueue());
|
||||
}
|
||||
}
|
||||
|
||||
IEnumerator ProcessQueue()
|
||||
{
|
||||
_isProcessing = true;
|
||||
|
||||
while (_queue.Count > 0)
|
||||
{
|
||||
var (adventurerClass, prefab) = _queue.Dequeue();
|
||||
|
||||
_currentAdventurerModel = Instantiate(prefab, transform);
|
||||
_currentAdventurerModel.GetComponent<AdventurerModelBinder>().SetupFromAdventurer(adventurerClass);
|
||||
_currentAdventurerModel.GetComponent<NavMeshAgent>().enabled = false;
|
||||
_currentAdventurerModel.GetComponent<Deplacements>().enabled = false;
|
||||
|
||||
var photo = GetComponentInChildren<TakePhoto>();
|
||||
if (photo != null)
|
||||
{
|
||||
yield return StartCoroutine(photo.CaptureRoutine(adventurerClass));
|
||||
}
|
||||
|
||||
Destroy(_currentAdventurerModel);
|
||||
yield return new WaitForEndOfFrame();
|
||||
_currentAdventurerModel = null;
|
||||
|
||||
yield return new WaitForSeconds(0.1f); // courte pause pour laisser respirer Unity
|
||||
}
|
||||
|
||||
_isProcessing = false;
|
||||
gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Utils
|
||||
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Privates and Protected
|
||||
|
||||
GameObject _currentAdventurerModel;
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 541e352eed3541beb25f9ba5966b080c
|
||||
timeCreated: 1754125969
|
||||
72
Assets/_/Features/Decor/Runtime/Portrait/TakePhoto.cs
Normal file
72
Assets/_/Features/Decor/Runtime/Portrait/TakePhoto.cs
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
using System.Collections;
|
||||
using Adventurer.Runtime;
|
||||
using Core.Runtime;
|
||||
using EventSystem.Runtime;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace _.Features.Decor.Runtime
|
||||
{
|
||||
public class TakePhoto : BaseMonobehaviour
|
||||
{
|
||||
|
||||
#region Publics
|
||||
|
||||
public Image m_targetImage;
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Unity API
|
||||
|
||||
//
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Main Methods
|
||||
|
||||
// Coroutine to capture the portrait asynchronously
|
||||
public IEnumerator CaptureRoutine(AdventurerClass adventurer)
|
||||
{
|
||||
yield return new WaitForEndOfFrame(); // attendre le rendu de la frame
|
||||
|
||||
_camera.Render();
|
||||
RenderTexture renderTexture = _camera.targetTexture;
|
||||
|
||||
RenderTexture currentRT = RenderTexture.active;
|
||||
RenderTexture.active = renderTexture;
|
||||
Texture2D image = new Texture2D(renderTexture.width, renderTexture.height, TextureFormat.RGB24, false);
|
||||
image.ReadPixels(new Rect(0, 0, renderTexture.width, renderTexture.height), 0, 0);
|
||||
image.Apply();
|
||||
RenderTexture.active = currentRT;
|
||||
|
||||
Sprite portraitSprite = Sprite.Create(image, new Rect(0, 0, image.width, image.height), new Vector2(0.5f, 0.5f));
|
||||
AdventurerSignals.RaisePortraitCaptured(adventurer, portraitSprite);
|
||||
|
||||
if (m_targetImage != null)
|
||||
{
|
||||
m_targetImage.sprite = portraitSprite;
|
||||
}
|
||||
|
||||
yield return new WaitForSeconds(0.1f); // attendre un court instant avant de lever l'événement final
|
||||
AdventurerSignals.RaisePhotoCaptured(adventurer);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Utils
|
||||
|
||||
//
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Privates and Protected
|
||||
|
||||
[SerializeField] Camera _camera;
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 8eea51d84fd74e8eb6707e41ae1e383e
|
||||
timeCreated: 1754124846
|
||||
3
Assets/_/Features/EventSystem.meta
Normal file
3
Assets/_/Features/EventSystem.meta
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 4df74ca8c623491e993c524482db6054
|
||||
timeCreated: 1754130690
|
||||
BIN
Assets/_/Features/EventSystem/.DS_Store
vendored
Normal file
BIN
Assets/_/Features/EventSystem/.DS_Store
vendored
Normal file
Binary file not shown.
8
Assets/_/Features/EventSystem/Runtime.meta
Normal file
8
Assets/_/Features/EventSystem/Runtime.meta
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: f3517a0c29d3e412caca160313d0d986
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
53
Assets/_/Features/EventSystem/Runtime/AdventurerSignals.cs
Normal file
53
Assets/_/Features/EventSystem/Runtime/AdventurerSignals.cs
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
using System;
|
||||
using Adventurer.Runtime;
|
||||
using UnityEngine;
|
||||
|
||||
namespace EventSystem.Runtime
|
||||
{
|
||||
public static class AdventurerSignals
|
||||
{
|
||||
public static event Action<AdventurerClass> OnAdventurerSpawnRequested;
|
||||
public static event Action OnRefresh;
|
||||
public static event Action<AdventurerClass, Sprite> OnPortraitCaptured;
|
||||
public static event Action<AdventurerClass> OnPhotoCaptured;
|
||||
public static event Action<AdventurerClass> OnInfoAdventurerPanel;
|
||||
public static event Action<AdventurerClass> OnAdventurerSelected;
|
||||
public static event Action<AdventurerClass> OnAdventurerUnselected;
|
||||
|
||||
public static void RaiseSpawnRequested(AdventurerClass adventurerClass)
|
||||
{
|
||||
OnAdventurerSpawnRequested?.Invoke(adventurerClass);
|
||||
}
|
||||
|
||||
public static void RaiseRefreshAdventurers()
|
||||
{
|
||||
OnRefresh?.Invoke();
|
||||
}
|
||||
|
||||
public static void RaisePortraitCaptured(AdventurerClass adventurerClass, Sprite portrait)
|
||||
{
|
||||
OnPortraitCaptured?.Invoke(adventurerClass, portrait);
|
||||
}
|
||||
|
||||
public static void RaisePhotoCaptured(AdventurerClass adventurerClass)
|
||||
{
|
||||
OnPhotoCaptured?.Invoke(adventurerClass);
|
||||
}
|
||||
|
||||
public static void RaiseInfoAdventurerPanel(AdventurerClass adventurerClass)
|
||||
{
|
||||
OnInfoAdventurerPanel?.Invoke(adventurerClass);
|
||||
}
|
||||
|
||||
public static void RaiseAdventurerSelected(AdventurerClass adventurerClass)
|
||||
{
|
||||
OnAdventurerSelected?.Invoke(adventurerClass);
|
||||
}
|
||||
|
||||
public static void RaiseAdventurerUnselected(AdventurerClass adventurerClass)
|
||||
{
|
||||
OnAdventurerUnselected?.Invoke(adventurerClass);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: f1abee8b62244c39b8ad5a2274687a39
|
||||
timeCreated: 1754130783
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
"name": "EventSystem.Runtime",
|
||||
"rootNamespace": "",
|
||||
"references": [
|
||||
"GUID:d01b71ecbce444a299cc1623f29e9d35",
|
||||
"GUID:239153993e9574192a1980e14075369e"
|
||||
],
|
||||
"includePlatforms": [],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": false,
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": true,
|
||||
"defineConstraints": [],
|
||||
"versionDefines": [],
|
||||
"noEngineReferences": false
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: f5d0434d9e8c34eb1a16f4c57b172b85
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
using System;
|
||||
using Adventurer.Runtime;
|
||||
using UnityEngine;
|
||||
|
||||
namespace EventSystem.Runtime
|
||||
{
|
||||
public class LegacyRecruitementEvents : MonoBehaviour
|
||||
{
|
||||
public static event Action<AdventurerClass> OnHeroRecruited;
|
||||
public static event Action<AdventurerClass> OnSpawnAdventurerModel;
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
AdventurerSignals.OnAdventurerSpawnRequested += RelaySpawn;
|
||||
}
|
||||
|
||||
private void OnDisable()
|
||||
{
|
||||
AdventurerSignals.OnAdventurerSpawnRequested -= RelaySpawn;
|
||||
}
|
||||
|
||||
private void RelaySpawn(AdventurerClass adventurer)
|
||||
{
|
||||
OnHeroRecruited?.Invoke(adventurer);
|
||||
OnSpawnAdventurerModel?.Invoke(adventurer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 0c336ee078344ae8b087c3f878a86e17
|
||||
timeCreated: 1754213587
|
||||
15
Assets/_/Features/EventSystem/Runtime/PanelSignals.cs
Normal file
15
Assets/_/Features/EventSystem/Runtime/PanelSignals.cs
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
using UnityEngine;
|
||||
|
||||
namespace EventSystem.Runtime
|
||||
{
|
||||
public static class PanelSignals
|
||||
{
|
||||
public static event System.Action<string> OnRefresh;
|
||||
|
||||
public static void RaiseRefresh(string panelName)
|
||||
{
|
||||
OnRefresh?.Invoke(panelName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: a13ce8bd705048828e3e4e72ca9912e8
|
||||
timeCreated: 1754381771
|
||||
21
Assets/_/Features/EventSystem/Runtime/QuestSignals.cs
Normal file
21
Assets/_/Features/EventSystem/Runtime/QuestSignals.cs
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
using System;
|
||||
using Quests.Runtime;
|
||||
|
||||
namespace EventSystem.Runtime
|
||||
{
|
||||
public static class QuestSignals
|
||||
{
|
||||
public static event Action<QuestClass> OnInfoQuestPanel;
|
||||
public static event Action OnRefresh;
|
||||
|
||||
public static void RaiseInfoQuestPanel(QuestClass questClass)
|
||||
{
|
||||
OnInfoQuestPanel?.Invoke(questClass);
|
||||
}
|
||||
|
||||
public static void RaiseRefreshQuests()
|
||||
{
|
||||
OnRefresh?.Invoke();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: b68f58866a514267adc2229cc420e814
|
||||
timeCreated: 1754316276
|
||||
9
Assets/_/Features/EventSystem/Runtime/TimeSignals.cs
Normal file
9
Assets/_/Features/EventSystem/Runtime/TimeSignals.cs
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
using System;
|
||||
|
||||
namespace EventSystem.Runtime
|
||||
{
|
||||
public class TimeSignals
|
||||
{
|
||||
public static event Action<int> OnTimeChanged;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: ed9d88020a2c4a76b587fee9b0d73714
|
||||
timeCreated: 1754414418
|
||||
8
Assets/_/Features/GoalSystem.meta
Normal file
8
Assets/_/Features/GoalSystem.meta
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: e867ab4f97bf43ab89b0b4f7f6503b20
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/_/Features/GoalSystem/Runtime.meta
Normal file
8
Assets/_/Features/GoalSystem/Runtime.meta
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 7a7650fbb70d408cae978feca3eadd29
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
84
Assets/_/Features/GoalSystem/Runtime/Goal.cs
Normal file
84
Assets/_/Features/GoalSystem/Runtime/Goal.cs
Normal file
|
|
@ -0,0 +1,84 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Goals.Runtime
|
||||
{
|
||||
public class Goal
|
||||
{
|
||||
|
||||
#region Publics
|
||||
|
||||
public string Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string Description { get; set; }
|
||||
public string[] RequiredFacts { get; set; }
|
||||
public GoalType Type { get; set; }
|
||||
public GoalState State { get; set; }
|
||||
public bool IsCompleted { get; set; }
|
||||
public List<Goal> SubGoals { get; set; } = new List<Goal>();
|
||||
|
||||
public Goal(string name, string description, string[] requiredFacts, GoalType type)
|
||||
{
|
||||
Id = $"{name}_{Time.deltaTime}";
|
||||
Name = name;
|
||||
Description = description;
|
||||
RequiredFacts = requiredFacts;
|
||||
Type = type;
|
||||
State = GoalState.Pending;
|
||||
IsCompleted = false;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Main Methods
|
||||
|
||||
public bool Evaluate()
|
||||
{
|
||||
if (SubGoals.Any())
|
||||
{
|
||||
if (SubGoals.All(goal => goal.IsCompleted))
|
||||
{
|
||||
CompleteGoal();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return State == GoalState.Completed;
|
||||
}
|
||||
|
||||
public void StartGoal()
|
||||
{
|
||||
if (State == GoalState.Pending)
|
||||
{
|
||||
State = GoalState.InProgress;
|
||||
foreach (Goal goal in SubGoals)
|
||||
{
|
||||
goal.StartGoal();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool CompleteGoal()
|
||||
{
|
||||
// Vérifie si l'objectif peut être complété (par exemple, toutes les conditions sont remplies)
|
||||
// Dans une implémentation réelle, on ajouterait ici plus de validation
|
||||
if (State != GoalState.Completed)
|
||||
{
|
||||
State = GoalState.Completed;
|
||||
IsCompleted = true;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void AddSubGoal(Goal goal)
|
||||
{
|
||||
SubGoals.Add(goal);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
3
Assets/_/Features/GoalSystem/Runtime/Goal.cs.meta
Normal file
3
Assets/_/Features/GoalSystem/Runtime/Goal.cs.meta
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 8dea578de2274a129423ce5addd72022
|
||||
timeCreated: 1752594095
|
||||
9
Assets/_/Features/GoalSystem/Runtime/GoalState.cs
Normal file
9
Assets/_/Features/GoalSystem/Runtime/GoalState.cs
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
namespace Goals.Runtime
|
||||
{
|
||||
public enum GoalState
|
||||
{
|
||||
Pending,
|
||||
InProgress,
|
||||
Completed,
|
||||
}
|
||||
}
|
||||
3
Assets/_/Features/GoalSystem/Runtime/GoalState.cs.meta
Normal file
3
Assets/_/Features/GoalSystem/Runtime/GoalState.cs.meta
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 1f8d8db08ba547039ee38622f24e4711
|
||||
timeCreated: 1752594125
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
{
|
||||
"name": "Goals.Runtime",
|
||||
"rootNamespace": "Goals.Runtime",
|
||||
"references": [
|
||||
"GUID:2ca720bbf8aa349608caa5ce4acaa603"
|
||||
],
|
||||
"includePlatforms": [],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": false,
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": true,
|
||||
"defineConstraints": [],
|
||||
"versionDefines": [],
|
||||
"noEngineReferences": false
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 18d0f817c4b724b5780374cf971d0724
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
64
Assets/_/Features/GoalSystem/Runtime/GoalSystem.cs
Normal file
64
Assets/_/Features/GoalSystem/Runtime/GoalSystem.cs
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
using System.Collections.Generic;
|
||||
using Core.Runtime;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Goals.Runtime
|
||||
{
|
||||
public class GoalSystem : BaseMonobehaviour
|
||||
{
|
||||
|
||||
#region Publics
|
||||
|
||||
List<Goal> AllGoals { get; set; } = new List<Goal>();
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Unity API
|
||||
|
||||
//
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Main Methods
|
||||
|
||||
public void AddGoal(Goal goal)
|
||||
{
|
||||
SetFact<Goal>(goal.Id, goal, FactPersistence.Persistent);
|
||||
AllGoals.Add(goal);
|
||||
}
|
||||
|
||||
public void EvaluateGoals(FactDictionnary goalsFacts)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
public List<Goal> GetGoalsByState(GoalState state)
|
||||
{
|
||||
return AllGoals != null ? AllGoals.FindAll(goal => goal.State == state) : new List<Goal>();
|
||||
}
|
||||
|
||||
public bool AreAllGoalsCompleted()
|
||||
{
|
||||
return AllGoals != null && AllGoals.TrueForAll(goal => goal.State == GoalState.Completed);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Utils
|
||||
|
||||
/* Fonctions privées utiles */
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Privates and Protected
|
||||
|
||||
// Variables privées
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
3
Assets/_/Features/GoalSystem/Runtime/GoalSystem.cs.meta
Normal file
3
Assets/_/Features/GoalSystem/Runtime/GoalSystem.cs.meta
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 0fcbd03cac2b48e08d757057b8bcc023
|
||||
timeCreated: 1752593911
|
||||
8
Assets/_/Features/GoalSystem/Runtime/GoalType.cs
Normal file
8
Assets/_/Features/GoalSystem/Runtime/GoalType.cs
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
namespace Goals.Runtime
|
||||
{
|
||||
public enum GoalType
|
||||
{
|
||||
killEnemies,
|
||||
collectItems,
|
||||
}
|
||||
}
|
||||
3
Assets/_/Features/GoalSystem/Runtime/GoalType.cs.meta
Normal file
3
Assets/_/Features/GoalSystem/Runtime/GoalType.cs.meta
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 266579ea5c494f9e8d019ee8408b2597
|
||||
timeCreated: 1752596481
|
||||
3
Assets/_/Features/Items.meta
Normal file
3
Assets/_/Features/Items.meta
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: e20109c0f47d47e4bed712ec3e13ce37
|
||||
timeCreated: 1754301684
|
||||
3
Assets/_/Features/Items/Runtime.meta
Normal file
3
Assets/_/Features/Items/Runtime.meta
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 21757cdae3934530860918fd9e462f2b
|
||||
timeCreated: 1754301691
|
||||
16
Assets/_/Features/Items/Runtime/Item.Runtime.asmdef
Normal file
16
Assets/_/Features/Items/Runtime/Item.Runtime.asmdef
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
{
|
||||
"name": "Item.Runtime",
|
||||
"rootNamespace": "Item.Runtime",
|
||||
"references": [
|
||||
"GUID:2ca720bbf8aa349608caa5ce4acaa603"
|
||||
],
|
||||
"includePlatforms": [],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": false,
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": true,
|
||||
"defineConstraints": [],
|
||||
"versionDefines": [],
|
||||
"noEngineReferences": false
|
||||
}
|
||||
7
Assets/_/Features/Items/Runtime/Item.Runtime.asmdef.meta
Normal file
7
Assets/_/Features/Items/Runtime/Item.Runtime.asmdef.meta
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 7a6677577d78940c08105c0284857640
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
55
Assets/_/Features/Items/Runtime/Item.cs
Normal file
55
Assets/_/Features/Items/Runtime/Item.cs
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
using System;
|
||||
|
||||
namespace Item.Runtime
|
||||
{
|
||||
public class Item
|
||||
{
|
||||
#region Getters and Setters
|
||||
|
||||
public Guid ID
|
||||
{
|
||||
get { return _id; }
|
||||
}
|
||||
|
||||
public ItemDefinitionSO Definition
|
||||
{
|
||||
get { return _definition; }
|
||||
set { _definition = value; }
|
||||
}
|
||||
|
||||
public int Quantity
|
||||
{
|
||||
get { return _quantity; }
|
||||
set { _quantity = value; }
|
||||
}
|
||||
|
||||
public float EffectValue
|
||||
{
|
||||
get { return _effectValue; }
|
||||
set { _effectValue = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Parameters
|
||||
|
||||
Guid _id;
|
||||
ItemDefinitionSO _definition;
|
||||
int _quantity;
|
||||
float _effectValue;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructor
|
||||
|
||||
public Item(Guid id, ItemDefinitionSO definition, int quantity, float effectValue)
|
||||
{
|
||||
_id = id;
|
||||
_definition = definition;
|
||||
_quantity = quantity;
|
||||
_effectValue = effectValue;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
3
Assets/_/Features/Items/Runtime/Item.cs.meta
Normal file
3
Assets/_/Features/Items/Runtime/Item.cs.meta
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: a3c7c28ba74e48599195313ae236b394
|
||||
timeCreated: 1754301773
|
||||
12
Assets/_/Features/Items/Runtime/ItemDefinitionSO.cs
Normal file
12
Assets/_/Features/Items/Runtime/ItemDefinitionSO.cs
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
using UnityEngine;
|
||||
|
||||
namespace Item.Runtime
|
||||
{
|
||||
[CreateAssetMenu(fileName = "New Item Definition", menuName = "Guild Tycoon/Items/Generation", order = 0)]
|
||||
public class ItemDefinitionSO : ScriptableObject
|
||||
{
|
||||
[SerializeField] Item _data;
|
||||
|
||||
public string DisplayNameKey;
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue