uChema
4 年前
当前提交
f9f6593b
共有 15 个文件被更改,包括 326 次插入 和 11 次删除
-
2UOP1_Project/Assets/Art/Accessories/EarCurls/earCurls.mat
-
2UOP1_Project/Assets/Art/Accessories/Moustache/moustache.mat
-
13UOP1_Project/Assets/Scripts/Inventory/InventoryManager.cs
-
8UOP1_Project/Assets/AddressableAssetsData/Windows.meta
-
8UOP1_Project/Assets/Quests.meta
-
47UOP1_Project/Assets/Scripts/Inventory/ScriptableObjects/TaskSO.cs
-
11UOP1_Project/Assets/Scripts/Inventory/ScriptableObjects/TaskSO.cs.meta
-
100UOP1_Project/Assets/Quests/QuestManager.cs
-
11UOP1_Project/Assets/Quests/QuestManager.cs.meta
-
15UOP1_Project/Assets/Quests/QuestSO.cs
-
11UOP1_Project/Assets/Quests/QuestSO.cs.meta
-
90UOP1_Project/Assets/Quests/TaskManager.cs
-
11UOP1_Project/Assets/Quests/TaskManager.cs.meta
-
8UOP1_Project/Assets/Scenes/Skybox/ClearSky.meta
|
|||
fileFormatVersion: 2 |
|||
guid: 3ddc14681058dc44aa382f6dccfc6651 |
|||
folderAsset: yes |
|||
DefaultImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: f622e7b47973eeb43bd9b23e9bc65064 |
|||
folderAsset: yes |
|||
DefaultImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System.Collections.Generic; |
|||
using UnityEngine; |
|||
public enum taskType |
|||
{ |
|||
dialogue, |
|||
giveItem, |
|||
checkItem, |
|||
rewardItem |
|||
} |
|||
[CreateAssetMenu(fileName = "Task", menuName = "Missions/Task", order = 51)] |
|||
public class TaskSO : ScriptableObject |
|||
{ |
|||
[SerializeField] |
|||
private bool _isInstantanious; |
|||
[Tooltip("The Character this mission will need interaction with")] |
|||
[SerializeField] |
|||
private ActorSO _actor; |
|||
[SerializeField] |
|||
private List <DialogueLineSO> _dialogue; |
|||
[SerializeField] |
|||
private Item _item; |
|||
[SerializeField] |
|||
private taskType _type; |
|||
[SerializeField] |
|||
VoidEventChannelSO _startDialogue; |
|||
[SerializeField] |
|||
VoidEventChannelSO _endDialogue; |
|||
|
|||
bool _isDone=false; |
|||
public List<DialogueLineSO> Dialogue => _dialogue; |
|||
public Item Item => _item; |
|||
public taskType Type => _type; |
|||
public bool IsDone => _isDone; |
|||
public ActorSO Actor => _actor; |
|||
public bool IsInstantanious => _isInstantanious; |
|||
public VoidEventChannelSO StartDialogue => _startDialogue ; |
|||
public VoidEventChannelSO EndDialogue=> _endDialogue; |
|||
|
|||
public void FinishTask() |
|||
{ |
|||
|
|||
_isDone = true; |
|||
|
|||
} |
|||
|
|||
|
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 3c4c03cb18bdd224b898e0687da8d1ac |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System.Collections; |
|||
using System.Collections.Generic; |
|||
using UnityEngine; |
|||
|
|||
public class QuestManager : MonoBehaviour |
|||
{ |
|||
public List<QuestSO> Quests = new List<QuestSO>(); |
|||
public Inventory inventory; |
|||
|
|||
public ItemEventChannelSo GiveItemEvent; |
|||
public ItemEventChannelSo RewardItemEvent; |
|||
|
|||
QuestSO currentQuest; |
|||
TaskSO currentTask; |
|||
int currentQuestIndex=0; |
|||
int currentTaskIndex=0; |
|||
private void Start() |
|||
{ |
|||
EndTask(); |
|||
} |
|||
public void StartQuest() |
|||
{ |
|||
if( Quests.Count > currentQuestIndex) |
|||
{ |
|||
currentQuest = Quests[currentQuestIndex]; |
|||
StartTask(); |
|||
} |
|||
|
|||
} |
|||
|
|||
public void StartTask() |
|||
{ |
|||
if (currentQuest.Tasks.Count > currentTaskIndex) |
|||
{ |
|||
currentTask = currentQuest.Tasks[currentTaskIndex]; |
|||
switch (currentTask.Type) |
|||
{ |
|||
case taskType.checkItem: |
|||
if (inventory.Contains(currentTask.Item)) |
|||
{ |
|||
inventory.Contains(currentTask.Item); |
|||
EndTask(); |
|||
} |
|||
else |
|||
{ PlayDefaultDialogue(currentTask.Dialogue); } |
|||
break; |
|||
case taskType.giveItem: |
|||
if (inventory.Contains(currentTask.Item)) |
|||
{ |
|||
GiveItemEvent.RaiseEvent(currentTask.Item); |
|||
EndTask(); |
|||
} |
|||
else |
|||
{ PlayDefaultDialogue(currentTask.Dialogue); } |
|||
break; |
|||
case taskType.rewardItem: |
|||
RewardItemEvent.RaiseEvent(currentTask.Item); |
|||
EndTask(); |
|||
break; |
|||
case taskType.dialogue: |
|||
StartDialogue(currentTask.Dialogue); |
|||
break; |
|||
|
|||
|
|||
} |
|||
|
|||
} |
|||
|
|||
} |
|||
public void StartDialogue (List<DialogueLineSO> Dialogue) { |
|||
|
|||
//check location
|
|||
//find the actor
|
|||
//Add the dialogue on the actor
|
|||
//subscribe to the dialogue end event
|
|||
|
|||
} |
|||
public void PlayDefaultDialogue(List<DialogueLineSO> Dialogue) |
|||
{ |
|||
|
|||
//check location
|
|||
//find the actor
|
|||
//Add the dialogue on the actor
|
|||
//subscribe to the dialogue end event
|
|||
|
|||
} |
|||
public void EndTask() |
|||
{ |
|||
currentTask.FinishTask(); |
|||
Debug.Log(Quests[currentQuestIndex].Tasks[currentTaskIndex].IsDone); |
|||
|
|||
} |
|||
public void EndQuest() |
|||
{ |
|||
|
|||
|
|||
|
|||
|
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 10b246087f2d8d842b859e2b2f88078f |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System.Collections.Generic; |
|||
using UnityEngine; |
|||
|
|||
[CreateAssetMenu(fileName = "Quest", menuName = "Quests/Quest", order = 51)] |
|||
public class QuestSO : ScriptableObject |
|||
{ |
|||
[Tooltip("The collection of Tasks composing the Quest")] |
|||
|
|||
[SerializeField] |
|||
private List<TaskSO> _tasks = new List<TaskSO>(); |
|||
|
|||
public List<TaskSO> Tasks => _tasks; |
|||
|
|||
|
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 05c700bba7d21604586cb89ec5afdee0 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System.Collections; |
|||
using System.Collections.Generic; |
|||
using UnityEngine; |
|||
//this script needs to be put on the actor, and takes care of the current task to accomplish.
|
|||
//the task contains a dialogue and maybe an event.
|
|||
|
|||
public class TaskManager : MonoBehaviour |
|||
{ |
|||
public List<DialogueLineSO> DefaultDialogue; |
|||
|
|||
//check if character is actif. An actif character is the character concerned by the task.
|
|||
public bool hasActifTask; |
|||
|
|||
TaskSO currentTask; |
|||
|
|||
List<DialogueLineSO> currentDialogue; |
|||
|
|||
//play default dialogue if no task
|
|||
public void PlayDefaultDialogue() |
|||
{ |
|||
|
|||
|
|||
} |
|||
|
|||
//register a task
|
|||
public void RegisterTask(TaskSO task) |
|||
{ |
|||
currentTask = task; |
|||
hasActifTask = true; |
|||
if (currentTask.Dialogue != null) |
|||
{ |
|||
currentDialogue = currentTask.Dialogue; |
|||
|
|||
if(currentTask.IsInstantanious) |
|||
{ |
|||
|
|||
StartDialogue(); |
|||
|
|||
} |
|||
} |
|||
} |
|||
//start a dialogue when interaction
|
|||
//some tasks need to be instantanious. And do not need the interact button.
|
|||
//when interaction again, restart same dialogue.
|
|||
public void InteractWithCharacter() |
|||
{ |
|||
if(hasActifTask) |
|||
{ |
|||
AchieveTask(); |
|||
} |
|||
else |
|||
{ |
|||
PlayDefaultDialogue(); |
|||
} |
|||
|
|||
} |
|||
|
|||
public void AchieveTask() |
|||
{ |
|||
|
|||
|
|||
|
|||
} |
|||
public void StartDialogue() |
|||
{ |
|||
|
|||
|
|||
|
|||
} |
|||
//next line dialogue
|
|||
|
|||
//End dialogue
|
|||
public void EndDialogue() |
|||
{ |
|||
|
|||
|
|||
|
|||
} |
|||
|
|||
//unregister a task when it ends.
|
|||
public void UnregisterTask() |
|||
{ |
|||
currentTask = null; |
|||
hasActifTask = false; |
|||
|
|||
currentDialogue = null; |
|||
|
|||
|
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: b803c85ebca51c4499674adbe5ea4a21 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: b54dcdb53f77f3843ab02db68eaa42f6 |
|||
folderAsset: yes |
|||
DefaultImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
撰写
预览
正在加载...
取消
保存
Reference in new issue