migration from new repo
This commit is contained in:
commit
423134a840
26930 changed files with 3458568 additions and 0 deletions
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
|
||||
Loading…
Add table
Add a link
Reference in a new issue