Compare commits
2 commits
9f2e4c1063
...
4b8d6108b9
| Author | SHA1 | Date | |
|---|---|---|---|
| 4b8d6108b9 | |||
| c9a83bebe3 |
245 changed files with 0 additions and 6171 deletions
BIN
.DS_Store
vendored
BIN
.DS_Store
vendored
Binary file not shown.
BIN
Assets/.DS_Store
vendored
BIN
Assets/.DS_Store
vendored
Binary file not shown.
BIN
Assets/StreamingAssets/.DS_Store
vendored
BIN
Assets/StreamingAssets/.DS_Store
vendored
Binary file not shown.
BIN
Assets/_/.DS_Store
vendored
BIN
Assets/_/.DS_Store
vendored
Binary file not shown.
BIN
Assets/_/Content/.DS_Store
vendored
BIN
Assets/_/Content/.DS_Store
vendored
Binary file not shown.
BIN
Assets/_/Content/Classic_RPG_GUI/.DS_Store
vendored
BIN
Assets/_/Content/Classic_RPG_GUI/.DS_Store
vendored
Binary file not shown.
BIN
Assets/_/Content/PixelItems/.DS_Store
vendored
BIN
Assets/_/Content/PixelItems/.DS_Store
vendored
Binary file not shown.
BIN
Assets/_/Content/PixelItems/Armory/Singles/.DS_Store
vendored
BIN
Assets/_/Content/PixelItems/Armory/Singles/.DS_Store
vendored
Binary file not shown.
BIN
Assets/_/Content/PixelItems/Jewelry/.DS_Store
vendored
BIN
Assets/_/Content/PixelItems/Jewelry/.DS_Store
vendored
Binary file not shown.
BIN
Assets/_/Database/.DS_Store
vendored
BIN
Assets/_/Database/.DS_Store
vendored
Binary file not shown.
BIN
Assets/_/Features/.DS_Store
vendored
BIN
Assets/_/Features/.DS_Store
vendored
Binary file not shown.
|
|
@ -1,8 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: c1584711ee7174b37838a0fd28e8e28e
|
|
||||||
folderAsset: yes
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
BIN
Assets/_/Features/Adventurers/.DS_Store
vendored
BIN
Assets/_/Features/Adventurers/.DS_Store
vendored
Binary file not shown.
|
|
@ -1,8 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: 8ec7f67c68b3d4cc2a0d89d90062a79f
|
|
||||||
folderAsset: yes
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
|
|
@ -1,17 +0,0 @@
|
||||||
{
|
|
||||||
"name": "Adventurer.Runtime",
|
|
||||||
"rootNamespace": "Adventurer.Runtime",
|
|
||||||
"references": [
|
|
||||||
"GUID:2ca720bbf8aa349608caa5ce4acaa603",
|
|
||||||
"GUID:6055be8ebefd69e48b49212b09b47b2f"
|
|
||||||
],
|
|
||||||
"includePlatforms": [],
|
|
||||||
"excludePlatforms": [],
|
|
||||||
"allowUnsafeCode": false,
|
|
||||||
"overrideReferences": false,
|
|
||||||
"precompiledReferences": [],
|
|
||||||
"autoReferenced": true,
|
|
||||||
"defineConstraints": [],
|
|
||||||
"versionDefines": [],
|
|
||||||
"noEngineReferences": false
|
|
||||||
}
|
|
||||||
|
|
@ -1,7 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: d01b71ecbce444a299cc1623f29e9d35
|
|
||||||
AssemblyDefinitionImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
|
|
@ -1,211 +0,0 @@
|
||||||
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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: e46147717be340f99310b7ca71940eb1
|
|
||||||
timeCreated: 1753475759
|
|
||||||
|
|
@ -1,13 +0,0 @@
|
||||||
namespace Adventurer.Runtime
|
|
||||||
{
|
|
||||||
public enum AdventurerClassEnum
|
|
||||||
{
|
|
||||||
Thief,
|
|
||||||
Warrior,
|
|
||||||
Archer,
|
|
||||||
Paladin,
|
|
||||||
Priest,
|
|
||||||
Mage,
|
|
||||||
Barbarian,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: 54b4d05cd4924762ab71f0aa436dfa0c
|
|
||||||
timeCreated: 1753475959
|
|
||||||
|
|
@ -1,99 +0,0 @@
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: 4c824ea52e0c4c33bd42fdbb00a0b5a7
|
|
||||||
timeCreated: 1753476587
|
|
||||||
|
|
@ -1,8 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: 73a43a84340ff44929dfa709cce4bf76
|
|
||||||
folderAsset: yes
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
|
|
@ -1,8 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: 581d807ac8f474e31a0f18f5f4f0ad27
|
|
||||||
folderAsset: yes
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
|
|
@ -1,168 +0,0 @@
|
||||||
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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: bf71e6ed782e4713b95188fa52438cd0
|
|
||||||
timeCreated: 1751220977
|
|
||||||
|
|
@ -1,80 +0,0 @@
|
||||||
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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: b6d9171f0555419780642bfda5037221
|
|
||||||
timeCreated: 1751223652
|
|
||||||
|
|
@ -1,8 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: 7c0ce0a4373dc0bb2ab714d658b005ad
|
|
||||||
folderAsset: yes
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
|
|
@ -1,8 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: 734f74e705aeba678b18ee566d42d540
|
|
||||||
folderAsset: yes
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
|
|
@ -1,17 +0,0 @@
|
||||||
{
|
|
||||||
"name": "Cheat.Runtime",
|
|
||||||
"rootNamespace": "Cheat.Runtime",
|
|
||||||
"references": [
|
|
||||||
"GUID:2ca720bbf8aa349608caa5ce4acaa603",
|
|
||||||
"GUID:6055be8ebefd69e48b49212b09b47b2f"
|
|
||||||
],
|
|
||||||
"includePlatforms": [],
|
|
||||||
"excludePlatforms": [],
|
|
||||||
"allowUnsafeCode": false,
|
|
||||||
"overrideReferences": false,
|
|
||||||
"precompiledReferences": [],
|
|
||||||
"autoReferenced": true,
|
|
||||||
"defineConstraints": [],
|
|
||||||
"versionDefines": [],
|
|
||||||
"noEngineReferences": false
|
|
||||||
}
|
|
||||||
|
|
@ -1,7 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: 5b013ac9c9f0c7681877b2ae2d0aaf36
|
|
||||||
AssemblyDefinitionImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
|
|
@ -1,230 +0,0 @@
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using Core.Runtime;
|
|
||||||
using TMPro;
|
|
||||||
using UnityEngine;
|
|
||||||
using UnityEngine.SceneManagement;
|
|
||||||
|
|
||||||
namespace Cheat.Runtime
|
|
||||||
{
|
|
||||||
public class Cheat : BaseMonobehaviour
|
|
||||||
{
|
|
||||||
|
|
||||||
#region Publics
|
|
||||||
|
|
||||||
//
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
#region Unity API
|
|
||||||
|
|
||||||
void OnValidate()
|
|
||||||
{
|
|
||||||
# if UNITY_EDITOR
|
|
||||||
|
|
||||||
if (!Application.isPlaying)
|
|
||||||
{
|
|
||||||
GetComponentInChildren<Canvas>().enabled = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
# endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void Awake()
|
|
||||||
{
|
|
||||||
// Liste des actions possibles
|
|
||||||
_commands.Add("quit", args => Application.Quit());
|
|
||||||
_commands.Add("add money", args =>
|
|
||||||
{
|
|
||||||
if (args.Length == 0)
|
|
||||||
{
|
|
||||||
Warning("Usage: add money <amount>");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!int.TryParse(args[0], out int amount))
|
|
||||||
{
|
|
||||||
Warning($"Invalid amount: {args[0]}");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
AddMoney(amount);
|
|
||||||
});
|
|
||||||
|
|
||||||
_commands.Add("help", args => CommandsList());
|
|
||||||
|
|
||||||
_canvas = GetComponentInChildren<Canvas>();
|
|
||||||
_canvas.enabled = false;
|
|
||||||
_historyZone = GetComponentInChildren<TMP_Text>();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Start()
|
|
||||||
{
|
|
||||||
//
|
|
||||||
}
|
|
||||||
|
|
||||||
void Update()
|
|
||||||
{
|
|
||||||
if (Input.GetKeyDown(KeyCode.Tab))
|
|
||||||
{
|
|
||||||
ToggleConsole();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_consoleOpen)
|
|
||||||
{
|
|
||||||
foreach (char c in Input.inputString)
|
|
||||||
{
|
|
||||||
if (c == '\b') // Backspace
|
|
||||||
{
|
|
||||||
if (_input.Length > 0)
|
|
||||||
_input = _input.Substring(0, _input.Length - 1);
|
|
||||||
}
|
|
||||||
else if (c == '\n' || c == '\r') // Entrée
|
|
||||||
{
|
|
||||||
ProcessCommand(_input);
|
|
||||||
_input = string.Empty;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_input += c;
|
|
||||||
}
|
|
||||||
RefreshUI();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
#region Main Methods
|
|
||||||
|
|
||||||
//
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
#region Utils
|
|
||||||
|
|
||||||
/* Fonctions privées utiles */
|
|
||||||
|
|
||||||
void RefreshUI()
|
|
||||||
{
|
|
||||||
if (_historyZone == null) return;
|
|
||||||
_historyZone.text = string.Join("\n", _history.ToArray());
|
|
||||||
}
|
|
||||||
|
|
||||||
void CommandsList()
|
|
||||||
{
|
|
||||||
AppendHistory("Rappel des commandes ");
|
|
||||||
foreach (var cmd in _commands)
|
|
||||||
{
|
|
||||||
AppendHistory(cmd.Key);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Ajoute une ligne d'historique et limite à _historyMaxLines
|
|
||||||
void AppendHistory(string line)
|
|
||||||
{
|
|
||||||
if (string.IsNullOrEmpty(line)) return;
|
|
||||||
|
|
||||||
_history.Enqueue(line);
|
|
||||||
while (_history.Count > _historyMaxLines)
|
|
||||||
_history.Dequeue();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ProcessCommand(string input)
|
|
||||||
{
|
|
||||||
if (string.IsNullOrWhiteSpace(input)) return;
|
|
||||||
string raw = input.Trim();
|
|
||||||
string lower = raw.ToLower();
|
|
||||||
|
|
||||||
// Find the longest matching command key at the start of the input
|
|
||||||
string matchedKey = _commands.Keys
|
|
||||||
.OrderByDescending(k => k.Length)
|
|
||||||
.FirstOrDefault(k => lower.StartsWith(k));
|
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(matchedKey))
|
|
||||||
{
|
|
||||||
string argString = lower.Substring(matchedKey.Length).Trim();
|
|
||||||
string[] args = string.IsNullOrEmpty(argString)
|
|
||||||
? Array.Empty<string>()
|
|
||||||
: argString.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
|
|
||||||
|
|
||||||
AppendHistory(raw);
|
|
||||||
try
|
|
||||||
{
|
|
||||||
_commands[matchedKey].Invoke(args);
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
Warning($"Error executing '{matchedKey}': {e.Message}");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Warning($"🚨‼️ Command '{lower}' not found");
|
|
||||||
}
|
|
||||||
|
|
||||||
_input = string.Empty;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ToggleConsole()
|
|
||||||
{
|
|
||||||
_consoleOpen = !_consoleOpen;
|
|
||||||
_canvas.enabled = _consoleOpen;
|
|
||||||
GameManager.Instance.IsOnPause = _consoleOpen;
|
|
||||||
|
|
||||||
if (_consoleOpen)
|
|
||||||
{
|
|
||||||
TextCaptured();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void TextCaptured()
|
|
||||||
{
|
|
||||||
foreach (char c in Input.inputString)
|
|
||||||
{
|
|
||||||
_input += c;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Commands Console
|
|
||||||
|
|
||||||
void AddMoney(int amount)
|
|
||||||
{
|
|
||||||
// Update or create a Money fact
|
|
||||||
int current;
|
|
||||||
bool hasMoney = true;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
current = GetFact<int>("Money");
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
current = 0;
|
|
||||||
hasMoney = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
int newValue = current + amount;
|
|
||||||
SetFact("Money", newValue, FactPersistence.Persistent);
|
|
||||||
AppendHistory($"Money set to {newValue}");
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Privates and Protected
|
|
||||||
|
|
||||||
// Variables privées
|
|
||||||
bool _consoleOpen = false;
|
|
||||||
Canvas _canvas;
|
|
||||||
string _input = string.Empty;
|
|
||||||
Dictionary<string, Action<string[]>> _commands = new Dictionary<string, Action<string[]>>();
|
|
||||||
Queue<string> _history = new Queue<string>();
|
|
||||||
const int _historyMaxLines = 5;
|
|
||||||
TMP_Text _historyZone;
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,2 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: 3d81aa295d15c46f5b729d9afa859acb
|
|
||||||
BIN
Assets/_/Features/Core/.DS_Store
vendored
BIN
Assets/_/Features/Core/.DS_Store
vendored
Binary file not shown.
BIN
Assets/_/Features/Core/Runtime/.DS_Store
vendored
BIN
Assets/_/Features/Core/Runtime/.DS_Store
vendored
Binary file not shown.
|
|
@ -1,3 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: 2f78b835dfce4349ad7522d7b63084f1
|
|
||||||
timeCreated: 1754087596
|
|
||||||
BIN
Assets/_/Features/Decor/.DS_Store
vendored
BIN
Assets/_/Features/Decor/.DS_Store
vendored
Binary file not shown.
|
|
@ -1,8 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: 79112082853e24a739e574adbd07c748
|
|
||||||
folderAsset: yes
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
BIN
Assets/_/Features/Decor/Runtime/.DS_Store
vendored
BIN
Assets/_/Features/Decor/Runtime/.DS_Store
vendored
Binary file not shown.
|
|
@ -1,3 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: e82eea4c6be94d0bb12fda846a7eaf10
|
|
||||||
timeCreated: 1754301470
|
|
||||||
|
|
@ -1,43 +0,0 @@
|
||||||
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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: c255cd054d9a4063be4d44bce3a41fdb
|
|
||||||
timeCreated: 1754301480
|
|
||||||
|
|
@ -1,78 +0,0 @@
|
||||||
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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: d4245e562f224986b9ea19f4b0917793
|
|
||||||
timeCreated: 1754087745
|
|
||||||
|
|
@ -1,60 +0,0 @@
|
||||||
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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: 13ac9df85abf4e1686d9d9a345cc5758
|
|
||||||
timeCreated: 1754088153
|
|
||||||
|
|
@ -1,20 +0,0 @@
|
||||||
{
|
|
||||||
"name": "Decor.Runtime",
|
|
||||||
"rootNamespace": "",
|
|
||||||
"references": [
|
|
||||||
"GUID:2ca720bbf8aa349608caa5ce4acaa603",
|
|
||||||
"GUID:d01b71ecbce444a299cc1623f29e9d35",
|
|
||||||
"GUID:4a640bb60ad60478bba0cc41f9b80929",
|
|
||||||
"GUID:f5d0434d9e8c34eb1a16f4c57b172b85",
|
|
||||||
"GUID:239153993e9574192a1980e14075369e"
|
|
||||||
],
|
|
||||||
"includePlatforms": [],
|
|
||||||
"excludePlatforms": [],
|
|
||||||
"allowUnsafeCode": false,
|
|
||||||
"overrideReferences": false,
|
|
||||||
"precompiledReferences": [],
|
|
||||||
"autoReferenced": true,
|
|
||||||
"defineConstraints": [],
|
|
||||||
"versionDefines": [],
|
|
||||||
"noEngineReferences": false
|
|
||||||
}
|
|
||||||
|
|
@ -1,7 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: 796a630e69a1c47f2af3fab5e2bbe0de
|
|
||||||
AssemblyDefinitionImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: 17b019320dd2465ebce9f1a32399841e
|
|
||||||
timeCreated: 1754129237
|
|
||||||
|
|
@ -1,93 +0,0 @@
|
||||||
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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: 541e352eed3541beb25f9ba5966b080c
|
|
||||||
timeCreated: 1754125969
|
|
||||||
|
|
@ -1,72 +0,0 @@
|
||||||
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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: 8eea51d84fd74e8eb6707e41ae1e383e
|
|
||||||
timeCreated: 1754124846
|
|
||||||
|
|
@ -1,91 +0,0 @@
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using Core.Runtime;
|
|
||||||
using EventSystem.Runtime;
|
|
||||||
using Player.Runtime;
|
|
||||||
using Quests.Runtime;
|
|
||||||
using UnityEngine;
|
|
||||||
|
|
||||||
namespace Decor.Runtime
|
|
||||||
{
|
|
||||||
public class QuestSign: BaseMonobehaviour
|
|
||||||
{
|
|
||||||
#region private & protected
|
|
||||||
|
|
||||||
[SerializeField] GameObject _parchment;
|
|
||||||
int _quests;
|
|
||||||
PlayerClass _player;
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
#region Unity API
|
|
||||||
|
|
||||||
void Awake()
|
|
||||||
{
|
|
||||||
_player = GetFact<PlayerClass>(GameManager.Instance.Profile);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Start()
|
|
||||||
{
|
|
||||||
// Trigger an initial refresh
|
|
||||||
QuestManager.Instance.NotifyAvailableQuestsUpdated(_player.GuildLevel);
|
|
||||||
UpdateParchmentState();
|
|
||||||
}
|
|
||||||
|
|
||||||
void OnEnable()
|
|
||||||
{
|
|
||||||
QuestManager.OnAvailableQuestsUpdated += HandleAvailableChanged;
|
|
||||||
QuestManager.OnQuestCompleted += HandleQuestCompleted;
|
|
||||||
}
|
|
||||||
|
|
||||||
void OnDisable()
|
|
||||||
{
|
|
||||||
QuestManager.OnAvailableQuestsUpdated -= HandleAvailableChanged;
|
|
||||||
QuestManager.OnQuestCompleted -= HandleQuestCompleted;
|
|
||||||
}
|
|
||||||
|
|
||||||
void HandleAvailableChanged(System.Collections.Generic.List<QuestTemplate> _)
|
|
||||||
{
|
|
||||||
UpdateParchmentState();
|
|
||||||
}
|
|
||||||
|
|
||||||
void HandleQuestCompleted(QuestClass _)
|
|
||||||
{
|
|
||||||
UpdateParchmentState();
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Main Methods
|
|
||||||
|
|
||||||
//
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Utils
|
|
||||||
|
|
||||||
void UpdateParchmentState()
|
|
||||||
{
|
|
||||||
List<QuestTemplate> availableTemplates = QuestManager.Instance.GetAvailableQuests(_player.GuildLevel);
|
|
||||||
var allPossibleQuests = QuestManager.Instance.GetAvailableQuests(_player.GuildLevel);
|
|
||||||
|
|
||||||
// 2. Quêtes déjà démarrées (actives OU complétées)
|
|
||||||
var startedQuests = QuestManager.Instance.ActiveQuests
|
|
||||||
.Concat(QuestManager.Instance.CompletedQuests)
|
|
||||||
.ToList();
|
|
||||||
|
|
||||||
// 3. Quêtes vraiment disponibles = possibles - déjà démarrées
|
|
||||||
bool hasTrulyAvailableQuests = allPossibleQuests
|
|
||||||
.Any(possibleQuest =>
|
|
||||||
!startedQuests.Any(startedQuest =>
|
|
||||||
startedQuest.Name == possibleQuest.data.Name
|
|
||||||
)
|
|
||||||
);
|
|
||||||
_parchment.SetActive(hasTrulyAvailableQuests);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,2 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: ee4d7e155702f0836847d55f31276d2f
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: 4df74ca8c623491e993c524482db6054
|
|
||||||
timeCreated: 1754130690
|
|
||||||
BIN
Assets/_/Features/EventSystem/.DS_Store
vendored
BIN
Assets/_/Features/EventSystem/.DS_Store
vendored
Binary file not shown.
|
|
@ -1,8 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: f3517a0c29d3e412caca160313d0d986
|
|
||||||
folderAsset: yes
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
|
|
@ -1,53 +0,0 @@
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: f1abee8b62244c39b8ad5a2274687a39
|
|
||||||
timeCreated: 1754130783
|
|
||||||
|
|
@ -1,17 +0,0 @@
|
||||||
{
|
|
||||||
"name": "EventSystem.Runtime",
|
|
||||||
"rootNamespace": "",
|
|
||||||
"references": [
|
|
||||||
"GUID:d01b71ecbce444a299cc1623f29e9d35",
|
|
||||||
"GUID:239153993e9574192a1980e14075369e"
|
|
||||||
],
|
|
||||||
"includePlatforms": [],
|
|
||||||
"excludePlatforms": [],
|
|
||||||
"allowUnsafeCode": false,
|
|
||||||
"overrideReferences": false,
|
|
||||||
"precompiledReferences": [],
|
|
||||||
"autoReferenced": true,
|
|
||||||
"defineConstraints": [],
|
|
||||||
"versionDefines": [],
|
|
||||||
"noEngineReferences": false
|
|
||||||
}
|
|
||||||
|
|
@ -1,7 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: f5d0434d9e8c34eb1a16f4c57b172b85
|
|
||||||
AssemblyDefinitionImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
|
|
@ -1,29 +0,0 @@
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: 0c336ee078344ae8b087c3f878a86e17
|
|
||||||
timeCreated: 1754213587
|
|
||||||
|
|
@ -1,15 +0,0 @@
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: a13ce8bd705048828e3e4e72ca9912e8
|
|
||||||
timeCreated: 1754381771
|
|
||||||
|
|
@ -1,27 +0,0 @@
|
||||||
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 event Action OnNewQuestRegistered;
|
|
||||||
|
|
||||||
public static void RaiseInfoQuestPanel(QuestClass questClass)
|
|
||||||
{
|
|
||||||
OnInfoQuestPanel?.Invoke(questClass);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void RaiseRefreshQuests()
|
|
||||||
{
|
|
||||||
OnRefresh?.Invoke();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void RaiseNewQuestRegistered()
|
|
||||||
{
|
|
||||||
OnNewQuestRegistered?.Invoke();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: b68f58866a514267adc2229cc420e814
|
|
||||||
timeCreated: 1754316276
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
||||||
using System;
|
|
||||||
|
|
||||||
namespace EventSystem.Runtime
|
|
||||||
{
|
|
||||||
public class TimeSignals
|
|
||||||
{
|
|
||||||
public static event Action<int> OnTimeChanged;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: ed9d88020a2c4a76b587fee9b0d73714
|
|
||||||
timeCreated: 1754414418
|
|
||||||
|
|
@ -1,8 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: e867ab4f97bf43ab89b0b4f7f6503b20
|
|
||||||
folderAsset: yes
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
|
|
@ -1,8 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: 7a7650fbb70d408cae978feca3eadd29
|
|
||||||
folderAsset: yes
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
|
|
@ -1,84 +0,0 @@
|
||||||
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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: 8dea578de2274a129423ce5addd72022
|
|
||||||
timeCreated: 1752594095
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
||||||
namespace Goals.Runtime
|
|
||||||
{
|
|
||||||
public enum GoalState
|
|
||||||
{
|
|
||||||
Pending,
|
|
||||||
InProgress,
|
|
||||||
Completed,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: 1f8d8db08ba547039ee38622f24e4711
|
|
||||||
timeCreated: 1752594125
|
|
||||||
|
|
@ -1,16 +0,0 @@
|
||||||
{
|
|
||||||
"name": "Goals.Runtime",
|
|
||||||
"rootNamespace": "Goals.Runtime",
|
|
||||||
"references": [
|
|
||||||
"GUID:2ca720bbf8aa349608caa5ce4acaa603"
|
|
||||||
],
|
|
||||||
"includePlatforms": [],
|
|
||||||
"excludePlatforms": [],
|
|
||||||
"allowUnsafeCode": false,
|
|
||||||
"overrideReferences": false,
|
|
||||||
"precompiledReferences": [],
|
|
||||||
"autoReferenced": true,
|
|
||||||
"defineConstraints": [],
|
|
||||||
"versionDefines": [],
|
|
||||||
"noEngineReferences": false
|
|
||||||
}
|
|
||||||
|
|
@ -1,7 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: 18d0f817c4b724b5780374cf971d0724
|
|
||||||
AssemblyDefinitionImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
|
|
@ -1,64 +0,0 @@
|
||||||
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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: 0fcbd03cac2b48e08d757057b8bcc023
|
|
||||||
timeCreated: 1752593911
|
|
||||||
|
|
@ -1,8 +0,0 @@
|
||||||
namespace Goals.Runtime
|
|
||||||
{
|
|
||||||
public enum GoalType
|
|
||||||
{
|
|
||||||
killEnemies,
|
|
||||||
collectItems,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: 266579ea5c494f9e8d019ee8408b2597
|
|
||||||
timeCreated: 1752596481
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: e20109c0f47d47e4bed712ec3e13ce37
|
|
||||||
timeCreated: 1754301684
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: 21757cdae3934530860918fd9e462f2b
|
|
||||||
timeCreated: 1754301691
|
|
||||||
|
|
@ -1,16 +0,0 @@
|
||||||
{
|
|
||||||
"name": "Item.Runtime",
|
|
||||||
"rootNamespace": "Item.Runtime",
|
|
||||||
"references": [
|
|
||||||
"GUID:2ca720bbf8aa349608caa5ce4acaa603"
|
|
||||||
],
|
|
||||||
"includePlatforms": [],
|
|
||||||
"excludePlatforms": [],
|
|
||||||
"allowUnsafeCode": false,
|
|
||||||
"overrideReferences": false,
|
|
||||||
"precompiledReferences": [],
|
|
||||||
"autoReferenced": true,
|
|
||||||
"defineConstraints": [],
|
|
||||||
"versionDefines": [],
|
|
||||||
"noEngineReferences": false
|
|
||||||
}
|
|
||||||
|
|
@ -1,7 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: 7a6677577d78940c08105c0284857640
|
|
||||||
AssemblyDefinitionImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
|
|
@ -1,55 +0,0 @@
|
||||||
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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: a3c7c28ba74e48599195313ae236b394
|
|
||||||
timeCreated: 1754301773
|
|
||||||
|
|
@ -1,12 +0,0 @@
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: fd6d5bd4844d4b1ba600841206a74c75
|
|
||||||
timeCreated: 1754302284
|
|
||||||
|
|
@ -1,10 +0,0 @@
|
||||||
namespace Item.Runtime
|
|
||||||
{
|
|
||||||
public enum ItemRarityEnum
|
|
||||||
{
|
|
||||||
Commun,
|
|
||||||
Rare,
|
|
||||||
Epic,
|
|
||||||
Legendary,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: a6ff93a7faa14703aaf443396da632f2
|
|
||||||
timeCreated: 1754302818
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
||||||
namespace Item.Runtime
|
|
||||||
{
|
|
||||||
[System.Serializable]
|
|
||||||
public class ItemReward
|
|
||||||
{
|
|
||||||
public ItemDefinitionSO m_itemDefinition;
|
|
||||||
public int m_quantity;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: a196415712e44226a632b5ebb42d9ebd
|
|
||||||
timeCreated: 1754304237
|
|
||||||
|
|
@ -1,11 +0,0 @@
|
||||||
namespace Item.Runtime
|
|
||||||
{
|
|
||||||
public enum ItemTypeEnum
|
|
||||||
{
|
|
||||||
Weapon,
|
|
||||||
Armor,
|
|
||||||
Accessory,
|
|
||||||
Consumable,
|
|
||||||
Gold,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: 1f1d5303ccf146b3ad9ec50a6f74e5cd
|
|
||||||
timeCreated: 1754302857
|
|
||||||
|
|
@ -1,8 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: 057e64abefea540979416afb01a361d5
|
|
||||||
folderAsset: yes
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
|
|
@ -1,8 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: db80233461c624322bd14998c9902819
|
|
||||||
folderAsset: yes
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
|
|
@ -1,10 +0,0 @@
|
||||||
using UnityEngine;
|
|
||||||
|
|
||||||
namespace MenuSystem.Runtime
|
|
||||||
{
|
|
||||||
public interface IMenuModule
|
|
||||||
{
|
|
||||||
string GetMenuName();
|
|
||||||
GameObject GetMenuPanel();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
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