wastland cont..
This commit is contained in:
@@ -1321,6 +1321,20 @@ MonoBehaviour:
|
||||
value:
|
||||
type: 0
|
||||
typeString: CustomFieldType_Text
|
||||
- id: 26
|
||||
fields:
|
||||
- title: Name
|
||||
value: ProgressVar
|
||||
type: 0
|
||||
typeString: CustomFieldType_Text
|
||||
- title: Initial Value
|
||||
value: 0
|
||||
type: 1
|
||||
typeString: CustomFieldType_Number
|
||||
- title: Description
|
||||
value:
|
||||
type: 0
|
||||
typeString: CustomFieldType_Text
|
||||
conversations:
|
||||
- id: 1
|
||||
fields:
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 61ec7c4f6dddd45d79badd4944a7ff81
|
||||
guid: cae7c4d68cbab4962b9ae397731a5038
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
|
||||
@@ -1321,6 +1321,20 @@ MonoBehaviour:
|
||||
value:
|
||||
type: 0
|
||||
typeString: CustomFieldType_Text
|
||||
- id: 26
|
||||
fields:
|
||||
- title: Name
|
||||
value: ProgressVar
|
||||
type: 0
|
||||
typeString: CustomFieldType_Text
|
||||
- title: Initial Value
|
||||
value: 0
|
||||
type: 1
|
||||
typeString: CustomFieldType_Number
|
||||
- title: Description
|
||||
value:
|
||||
type: 0
|
||||
typeString: CustomFieldType_Text
|
||||
conversations:
|
||||
- id: 1
|
||||
fields:
|
||||
@@ -38328,6 +38342,200 @@ MonoBehaviour:
|
||||
height: 30
|
||||
canvasScrollPosition: {x: 0, y: 0}
|
||||
canvasZoom: 1
|
||||
- id: 136
|
||||
fields:
|
||||
- title: Title
|
||||
value: CH01/WASTELAND/CH01_EPXLORE_MORE
|
||||
type: 0
|
||||
typeString: CustomFieldType_Text
|
||||
- title: Pictures
|
||||
value: '[]'
|
||||
type: 3
|
||||
typeString: CustomFieldType_Files
|
||||
- title: Description
|
||||
value:
|
||||
type: 0
|
||||
typeString: CustomFieldType_Text
|
||||
- title: Actor
|
||||
value: 1
|
||||
type: 5
|
||||
typeString: CustomFieldType_Actor
|
||||
- title: Conversant
|
||||
value: 2
|
||||
type: 5
|
||||
typeString: CustomFieldType_Actor
|
||||
overrideSettings:
|
||||
useOverrides: 0
|
||||
overrideSubtitleSettings: 0
|
||||
showNPCSubtitlesDuringLine: 1
|
||||
showNPCSubtitlesWithResponses: 1
|
||||
showPCSubtitlesDuringLine: 0
|
||||
skipPCSubtitleAfterResponseMenu: 0
|
||||
subtitleCharsPerSecond: 30
|
||||
minSubtitleSeconds: 2
|
||||
continueButton: 0
|
||||
overrideSequenceSettings: 0
|
||||
defaultSequence:
|
||||
defaultPlayerSequence:
|
||||
defaultResponseMenuSequence:
|
||||
overrideInputSettings: 0
|
||||
alwaysForceResponseMenu: 1
|
||||
includeInvalidEntries: 0
|
||||
responseTimeout: 0
|
||||
cancelSubtitle:
|
||||
key: 27
|
||||
buttonName:
|
||||
cancelConversation:
|
||||
key: 27
|
||||
buttonName:
|
||||
nodeColor:
|
||||
dialogueEntries:
|
||||
- id: 0
|
||||
fields:
|
||||
- title: Title
|
||||
value: START
|
||||
type: 0
|
||||
typeString:
|
||||
- title: Pictures
|
||||
value: '[]'
|
||||
type: 3
|
||||
typeString: CustomFieldType_Files
|
||||
- title: Description
|
||||
value:
|
||||
type: 0
|
||||
typeString:
|
||||
- title: Actor
|
||||
value: 1
|
||||
type: 5
|
||||
typeString: CustomFieldType_Actor
|
||||
- title: Conversant
|
||||
value: 2
|
||||
type: 5
|
||||
typeString: CustomFieldType_Actor
|
||||
- title: Menu Text
|
||||
value:
|
||||
type: 0
|
||||
typeString:
|
||||
- title: Dialogue Text
|
||||
value:
|
||||
type: 0
|
||||
typeString:
|
||||
- title: Parenthetical
|
||||
value:
|
||||
type: 0
|
||||
typeString:
|
||||
- title: Audio Files
|
||||
value: '[]'
|
||||
type: 3
|
||||
typeString: CustomFieldType_Files
|
||||
- title: Video File
|
||||
value:
|
||||
type: 0
|
||||
typeString:
|
||||
- title: Sequence
|
||||
value: None()
|
||||
type: 0
|
||||
typeString:
|
||||
- title: pl
|
||||
value:
|
||||
type: 4
|
||||
typeString: CustomFieldType_Localization
|
||||
conversationID: 136
|
||||
isRoot: 0
|
||||
isGroup: 0
|
||||
nodeColor:
|
||||
delaySimStatus: 0
|
||||
falseConditionAction:
|
||||
conditionPriority: 2
|
||||
outgoingLinks:
|
||||
- originConversationID: 136
|
||||
originDialogueID: 0
|
||||
destinationConversationID: 136
|
||||
destinationDialogueID: 1
|
||||
isConnector: 0
|
||||
priority: 2
|
||||
conditionsString:
|
||||
userScript:
|
||||
onExecute:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
canvasRect:
|
||||
serializedVersion: 2
|
||||
x: 20
|
||||
y: 30
|
||||
width: 160
|
||||
height: 30
|
||||
- id: 1
|
||||
fields:
|
||||
- title: Title
|
||||
value:
|
||||
type: 0
|
||||
typeString: CustomFieldType_Text
|
||||
- title: Pictures
|
||||
value: '[]'
|
||||
type: 3
|
||||
typeString: CustomFieldType_Files
|
||||
- title: Description
|
||||
value:
|
||||
type: 0
|
||||
typeString: CustomFieldType_Text
|
||||
- title: Actor
|
||||
value: 2
|
||||
type: 5
|
||||
typeString: CustomFieldType_Actor
|
||||
- title: Conversant
|
||||
value: 1
|
||||
type: 5
|
||||
typeString: CustomFieldType_Actor
|
||||
- title: Menu Text
|
||||
value:
|
||||
type: 0
|
||||
typeString: CustomFieldType_Text
|
||||
- title: Dialogue Text
|
||||
value: I should explore the rest of this valley before moving on...
|
||||
type: 0
|
||||
typeString: CustomFieldType_Text
|
||||
- title: Parenthetical
|
||||
value:
|
||||
type: 0
|
||||
typeString: CustomFieldType_Text
|
||||
- title: Audio Files
|
||||
value: '[]'
|
||||
type: 3
|
||||
typeString: CustomFieldType_Files
|
||||
- title: Video File
|
||||
value:
|
||||
type: 0
|
||||
typeString: CustomFieldType_Text
|
||||
- title: Sequence
|
||||
value:
|
||||
type: 0
|
||||
typeString: CustomFieldType_Text
|
||||
- title: pl
|
||||
value:
|
||||
type: 4
|
||||
typeString: CustomFieldType_Localization
|
||||
conversationID: 136
|
||||
isRoot: 0
|
||||
isGroup: 0
|
||||
nodeColor:
|
||||
delaySimStatus: 0
|
||||
falseConditionAction: Block
|
||||
conditionPriority: 2
|
||||
outgoingLinks: []
|
||||
conditionsString:
|
||||
userScript:
|
||||
onExecute:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
canvasRect:
|
||||
serializedVersion: 2
|
||||
x: 20
|
||||
y: 80
|
||||
width: 160
|
||||
height: 30
|
||||
canvasScrollPosition: {x: 0, y: 0}
|
||||
canvasZoom: 1
|
||||
syncInfo:
|
||||
syncActors: 0
|
||||
syncItems: 0
|
||||
|
||||
@@ -394,6 +394,19 @@ MonoBehaviour:
|
||||
m_valueType: 0
|
||||
m_intValue: 0
|
||||
m_stringValue:
|
||||
--- !u!114 &-3053733007833842217
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 1
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: c94e8fb3b9b54114cbe8185003729c1b, type: 3}
|
||||
m_Name: SceneEventQuestAction
|
||||
m_EditorClassIdentifier:
|
||||
m_guid: 24732f88-b3f5-4cc5-9d4f-cd41fe6828e0
|
||||
--- !u!114 &-2514152293805480620
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 1
|
||||
@@ -433,6 +446,45 @@ MonoBehaviour:
|
||||
m_valueType: 0
|
||||
m_intValue: 0
|
||||
m_stringValue:
|
||||
--- !u!114 &-2409317944521142324
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 1
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 5682394e55a192147a020b9edf624e51, type: 3}
|
||||
m_Name: MessageQuestCondition
|
||||
m_EditorClassIdentifier:
|
||||
m_alreadyTrue: 0
|
||||
m_senderSpecifier: 0
|
||||
m_senderID:
|
||||
m_text:
|
||||
m_stringAsset: {fileID: 0}
|
||||
m_textTable: {fileID: 0}
|
||||
m_textTableFieldID: 0
|
||||
m_targetSpecifier: 0
|
||||
m_targetID:
|
||||
m_text:
|
||||
m_stringAsset: {fileID: 0}
|
||||
m_textTable: {fileID: 0}
|
||||
m_textTableFieldID: 0
|
||||
m_message:
|
||||
m_text: Leavers
|
||||
m_stringAsset: {fileID: 0}
|
||||
m_textTable: {fileID: 0}
|
||||
m_textTableFieldID: 0
|
||||
m_parameter:
|
||||
m_text: Found
|
||||
m_stringAsset: {fileID: 0}
|
||||
m_textTable: {fileID: 0}
|
||||
m_textTableFieldID: 0
|
||||
m_value:
|
||||
m_valueType: 0
|
||||
m_intValue: 0
|
||||
m_stringValue:
|
||||
--- !u!114 &-2335882159848285810
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 1
|
||||
@@ -453,7 +505,7 @@ MonoBehaviour:
|
||||
m_textTable: {fileID: 0}
|
||||
m_textTableFieldID: 0
|
||||
m_headingLevel: 1
|
||||
--- !u!114 &-1490342762534449749
|
||||
--- !u!114 &-1549627911573821701
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 1
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
@@ -462,16 +514,10 @@ MonoBehaviour:
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: f29ce8549d5fa7646a7d6a4dcea6fa81, type: 3}
|
||||
m_Name: LuaVariableQuestCondition
|
||||
m_Script: {fileID: 11500000, guid: c94e8fb3b9b54114cbe8185003729c1b, type: 3}
|
||||
m_Name: SceneEventQuestAction
|
||||
m_EditorClassIdentifier:
|
||||
m_alreadyTrue: 0
|
||||
variable:
|
||||
value:
|
||||
m_valueType: 0
|
||||
m_intValue: 0
|
||||
m_stringValue:
|
||||
frequencyToCheck: 1
|
||||
m_guid: 1c45b8c4-59eb-4dba-beb5-31e5adff8344
|
||||
--- !u!114 &-1455733162200562574
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 1
|
||||
@@ -749,7 +795,6 @@ MonoBehaviour:
|
||||
m_conditionSet:
|
||||
m_conditionList:
|
||||
- {fileID: -498264784325874142}
|
||||
- {fileID: -1490342762534449749}
|
||||
m_conditionCountMode: 0
|
||||
m_minConditionCount: 0
|
||||
m_numTrueConditions: 0
|
||||
@@ -805,7 +850,7 @@ MonoBehaviour:
|
||||
m_childIndexList: 04000000
|
||||
m_canvasRect:
|
||||
serializedVersion: 2
|
||||
x: 206.15062
|
||||
x: 207.20515
|
||||
y: 202.39818
|
||||
width: 120
|
||||
height: 48
|
||||
@@ -900,7 +945,7 @@ MonoBehaviour:
|
||||
m_childIndexList: 05000000
|
||||
m_canvasRect:
|
||||
serializedVersion: 2
|
||||
x: 204.45099
|
||||
x: 206.45099
|
||||
y: 312.5349
|
||||
width: 120
|
||||
height: 48
|
||||
@@ -928,7 +973,8 @@ MonoBehaviour:
|
||||
- m_contentList: []
|
||||
- m_contentList: []
|
||||
- m_contentList: []
|
||||
- m_actionList: []
|
||||
- m_actionList:
|
||||
- {fileID: -1549627911573821701}
|
||||
m_categorizedContentList:
|
||||
- m_contentList: []
|
||||
- m_contentList: []
|
||||
@@ -941,7 +987,7 @@ MonoBehaviour:
|
||||
- m_contentList: []
|
||||
m_conditionSet:
|
||||
m_conditionList:
|
||||
- {fileID: 5290278893685337209}
|
||||
- {fileID: -2409317944521142324}
|
||||
m_conditionCountMode: 1
|
||||
m_minConditionCount: 0
|
||||
m_numTrueConditions: 0
|
||||
@@ -976,7 +1022,8 @@ MonoBehaviour:
|
||||
- m_contentList: []
|
||||
- m_contentList: []
|
||||
- m_contentList: []
|
||||
- m_actionList: []
|
||||
- m_actionList:
|
||||
- {fileID: 6599176254940311028}
|
||||
m_categorizedContentList:
|
||||
- m_contentList: []
|
||||
- m_contentList: []
|
||||
@@ -1024,7 +1071,8 @@ MonoBehaviour:
|
||||
- m_contentList: []
|
||||
- m_contentList: []
|
||||
- m_contentList: []
|
||||
- m_actionList: []
|
||||
- m_actionList:
|
||||
- {fileID: -3053733007833842217}
|
||||
m_categorizedContentList:
|
||||
- m_contentList: []
|
||||
- m_contentList: []
|
||||
@@ -1628,12 +1676,12 @@ MonoBehaviour:
|
||||
m_textTable: {fileID: 0}
|
||||
m_textTableFieldID: 0
|
||||
m_message:
|
||||
m_text: Leavers
|
||||
m_text: Puzzle
|
||||
m_stringAsset: {fileID: 0}
|
||||
m_textTable: {fileID: 0}
|
||||
m_textTableFieldID: 0
|
||||
m_parameter:
|
||||
m_text: Pulled
|
||||
m_text: Solved
|
||||
m_stringAsset: {fileID: 0}
|
||||
m_textTable: {fileID: 0}
|
||||
m_textTableFieldID: 0
|
||||
@@ -1739,45 +1787,6 @@ MonoBehaviour:
|
||||
m_valueType: 0
|
||||
m_intValue: 0
|
||||
m_stringValue:
|
||||
--- !u!114 &5290278893685337209
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 1
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 5682394e55a192147a020b9edf624e51, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_alreadyTrue: 0
|
||||
m_senderSpecifier: 0
|
||||
m_senderID:
|
||||
m_text:
|
||||
m_stringAsset: {fileID: 0}
|
||||
m_textTable: {fileID: 0}
|
||||
m_textTableFieldID: 0
|
||||
m_targetSpecifier: 0
|
||||
m_targetID:
|
||||
m_text:
|
||||
m_stringAsset: {fileID: 0}
|
||||
m_textTable: {fileID: 0}
|
||||
m_textTableFieldID: 0
|
||||
m_message:
|
||||
m_text: Seed
|
||||
m_stringAsset: {fileID: 0}
|
||||
m_textTable: {fileID: 0}
|
||||
m_textTableFieldID: 0
|
||||
m_parameter:
|
||||
m_text: Found
|
||||
m_stringAsset: {fileID: 0}
|
||||
m_textTable: {fileID: 0}
|
||||
m_textTableFieldID: 0
|
||||
m_value:
|
||||
m_valueType: 0
|
||||
m_intValue: 0
|
||||
m_stringValue:
|
||||
--- !u!114 &5657305176670203493
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 1
|
||||
@@ -1818,6 +1827,19 @@ MonoBehaviour:
|
||||
m_textTable: {fileID: 0}
|
||||
m_textTableFieldID: 0
|
||||
m_headingLevel: 1
|
||||
--- !u!114 &6599176254940311028
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 1
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: c94e8fb3b9b54114cbe8185003729c1b, type: 3}
|
||||
m_Name: SceneEventQuestAction
|
||||
m_EditorClassIdentifier:
|
||||
m_guid: ba7b126c-32b3-4580-a4a2-989a78500bcc
|
||||
--- !u!114 &7083521629110602899
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 1
|
||||
|
||||
@@ -446,7 +446,7 @@ MonoBehaviour:
|
||||
m_canvasRect:
|
||||
serializedVersion: 2
|
||||
x: 218
|
||||
y: 464
|
||||
y: 463.07864
|
||||
width: 120
|
||||
height: 48
|
||||
- m_id:
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,173 +1,216 @@
|
||||
using System.Collections;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Events;
|
||||
|
||||
namespace Beyond
|
||||
{
|
||||
[RequireComponent(typeof(Collider))]
|
||||
public class DestinationPoint : MonoBehaviour
|
||||
{
|
||||
[Header("References")]
|
||||
[SerializeField] private DestinationPoint nextPoint; // Nast<EFBFBD>pny punkt docelowy
|
||||
[SerializeField] private Collider triggerCollider; // Collider, kt<6B>ry wyzwala zmian<61> punktu
|
||||
[SerializeField] private AudioClip destinationSound; // D<>wi<77>k do odtworzenia
|
||||
[SerializeField] private AudioSource audioSource; // <20>r<EFBFBD>d<EFBFBD>o d<>wi<77>ku
|
||||
[SerializeField] private UnityEvent onTriggerEnter;
|
||||
[SerializeField] private DestinationPoint nextPoint; // Następny punkt
|
||||
[SerializeField] private Collider triggerCollider;
|
||||
[SerializeField] private AudioSource audioSource;
|
||||
[SerializeField] private AudioClip destinationSound;
|
||||
|
||||
[Header("Settings")]
|
||||
[Header("Events")]
|
||||
[SerializeField] private UnityEvent onPointReached;
|
||||
|
||||
[Header("Detection Settings")]
|
||||
[SerializeField] private LayerMask playerLayer; // Lepsze niż Tag
|
||||
[Tooltip("Jeśli true: zalicza punkt natychmiast, jeśli gracz już w nim stoi w momencie aktywacji.")]
|
||||
[SerializeField] private bool autoSkipIfInside = false;
|
||||
[Tooltip("Jeśli true: punkt nie włączy się, dopóki gracz nie oddali się na bezpieczną odległość.")]
|
||||
[SerializeField] private bool waitForExitIfInside = true;
|
||||
[SerializeField] private float minActivationDistance = 5.0f; // Dystans wymagany do uzbrojenia punktu
|
||||
|
||||
[Header("General Settings")]
|
||||
[SerializeField] private bool activateOnStart = true;
|
||||
[SerializeField] private bool switchOnParentDeactivation = false; // Czy prze<7A><65>cza<7A> na nast<73>pny punkt, gdy obiekt nadrz<72>dny jest dezaktywowany
|
||||
|
||||
private bool isActive = false; // Czy punkt jest aktywny
|
||||
private bool isDestroyed = false;
|
||||
private bool wasParentActive = true;
|
||||
|
||||
//private void OnEnable()
|
||||
//{
|
||||
// Upewnij si<73>, <20>e widoczno<6E><6F> jest poprawnie ustawiona zanim wszystko si<73> zainicjalizuje
|
||||
// UpdateVisibility();
|
||||
//}
|
||||
private bool isActive = false; // Czy punkt logicznie jest "tym aktualnym"
|
||||
private bool isArmed = false; // Czy punkt jest fizycznie włączony (collider + marker)
|
||||
private Transform playerTransform;
|
||||
private Coroutine activationCoroutine;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
// Upewnij si<73>, <20>e collider jest ustawiony jako trigger
|
||||
if (triggerCollider != null)
|
||||
{
|
||||
triggerCollider.isTrigger = true;
|
||||
}
|
||||
if (triggerCollider == null) triggerCollider = GetComponent<Collider>();
|
||||
if (triggerCollider != null) triggerCollider.isTrigger = true;
|
||||
|
||||
// Upewnij si<73>, <20>e audioSource jest przypisany
|
||||
if (audioSource == null)
|
||||
{
|
||||
audioSource = gameObject.AddComponent<AudioSource>();
|
||||
}
|
||||
|
||||
// Sprawd<77>, czy obiekt nadrz<72>dny jest aktywny na pocz<63>tku
|
||||
if (switchOnParentDeactivation && transform.parent != null)
|
||||
{
|
||||
wasParentActive = transform.parent.gameObject.activeInHierarchy;
|
||||
}
|
||||
if (audioSource == null) audioSource = GetComponent<AudioSource>();
|
||||
if (audioSource == null && destinationSound != null) audioSource = gameObject.AddComponent<AudioSource>();
|
||||
}
|
||||
/*
|
||||
|
||||
private void Update()
|
||||
private void Start()
|
||||
{
|
||||
// Sprawd<77>, czy obiekt nadrz<72>dny zmieni<6E> sw<73>j stan
|
||||
if (switchOnParentDeactivation && transform.parent != null)
|
||||
GameObject playerObj = GameObject.FindGameObjectWithTag("Player");
|
||||
if (playerObj) playerTransform = playerObj.transform;
|
||||
|
||||
if (activateOnStart)
|
||||
{
|
||||
bool isParentActive = transform.parent.gameObject.activeInHierarchy;
|
||||
if (wasParentActive && !isParentActive)
|
||||
{
|
||||
// Obiekt nadrz<72>dny zosta<74> dezaktywowany
|
||||
HandleParentDeactivated();
|
||||
}
|
||||
wasParentActive = isParentActive;
|
||||
Activate();
|
||||
}
|
||||
else
|
||||
{
|
||||
// Upewnij się, że na starcie jest wyłączony, jeśli nie ma być aktywny
|
||||
UpdateVisualState(false);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
private void OnTriggerEnter(Collider other)
|
||||
{
|
||||
// Zak<61>adamy, <20>e gracz ma tag "Player"
|
||||
if (isActive && other.CompareTag("Player"))
|
||||
{
|
||||
// Odtw<74>rz d<>wi<77>k, je<6A>li jest przypisany
|
||||
if (destinationSound != null && audioSource != null)
|
||||
{
|
||||
audioSource.PlayOneShot(destinationSound);
|
||||
}
|
||||
|
||||
// Prze<7A><65>cz na nast<73>pny punkt
|
||||
//DestinationTargetManager.Instance.SwitchToNextPoint(nextPoint);
|
||||
|
||||
// Dezaktywuj ten punkt
|
||||
Deactivate();
|
||||
onTriggerEnter?.Invoke();
|
||||
}
|
||||
}
|
||||
// --- Logika Włączania/Wyłączania (Unity Lifecycle) ---
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
// Aktywuj punkt, gdy skrypt jest w<><77>czony
|
||||
if (activateOnStart)
|
||||
Activate();
|
||||
// Jeśli obiekt został włączony ponownie (np. po dezaktywacji rodzica),
|
||||
// a logicznie ten punkt nadal powinien być aktywny -> wznów działanie.
|
||||
if (isActive)
|
||||
{
|
||||
TryArmPoint();
|
||||
}
|
||||
}
|
||||
|
||||
private void OnDisable()
|
||||
{
|
||||
|
||||
// Dezaktywuj punkt, gdy skrypt jest wy<77><79>czony
|
||||
Deactivate();
|
||||
}
|
||||
/*
|
||||
// Funkcja sprawdzaj<61>ca, czy obiekt nadrz<72>dny jest aktywny i czy wska<6B>nik powinien by<62> widoczny
|
||||
private void UpdateVisibility()
|
||||
{
|
||||
if (isActive && IsParentActive() && DestinationTargetManager.Instance != null)
|
||||
{
|
||||
DestinationTargetManager.Instance.SetTargetVisibility(true);
|
||||
}
|
||||
else if (DestinationTargetManager.Instance != null)
|
||||
{
|
||||
DestinationTargetManager.Instance.SetTargetVisibility(false);
|
||||
}
|
||||
// Kiedy obiekt jest wyłączany, zawsze chowamy marker i wyłączamy logikę
|
||||
// Ale NIE zmieniamy 'isActive', bo quest nadal jest na tym etapie.
|
||||
if (activationCoroutine != null) StopCoroutine(activationCoroutine);
|
||||
UpdateVisualState(false);
|
||||
}
|
||||
|
||||
// Sprawdza, czy obiekt nadrz<72>dny jest aktywny
|
||||
private bool IsParentActive()
|
||||
{
|
||||
return transform.parent == null || transform.parent.gameObject.activeInHierarchy;
|
||||
}
|
||||
*/
|
||||
// --- Główna Logika ---
|
||||
|
||||
public void Activate()
|
||||
{
|
||||
if (!isActive)
|
||||
if (isActive) return; // Już jest aktywny
|
||||
isActive = true;
|
||||
|
||||
TryArmPoint();
|
||||
}
|
||||
|
||||
private void TryArmPoint()
|
||||
{
|
||||
// 1. Sprawdź, czy gracz jest w środku
|
||||
if (IsPlayerInsideOrTooClose())
|
||||
{
|
||||
isActive = true;
|
||||
if (triggerCollider != null)
|
||||
if (autoSkipIfInside)
|
||||
{
|
||||
triggerCollider.enabled = true;
|
||||
Debug.Log($"[DestinationPoint] Gracz wewnątrz {name}, automatyczne zaliczenie.");
|
||||
HandleDestinationReached();
|
||||
return;
|
||||
}
|
||||
else if (waitForExitIfInside)
|
||||
{
|
||||
Debug.Log($"[DestinationPoint] Gracz za blisko {name}, czekam na dystans...");
|
||||
if (activationCoroutine != null) StopCoroutine(activationCoroutine);
|
||||
activationCoroutine = StartCoroutine(WaitForSafeDistance());
|
||||
return;
|
||||
}
|
||||
Compass.Instance.AddQuestMarker(transform, null);
|
||||
}
|
||||
|
||||
// 2. Normalna aktywacja (Marker + Collider)
|
||||
UpdateVisualState(true);
|
||||
}
|
||||
|
||||
public void Deactivate()
|
||||
{
|
||||
if (isActive)
|
||||
{
|
||||
isActive = false;
|
||||
if (triggerCollider != null)
|
||||
{
|
||||
triggerCollider.enabled = false;
|
||||
}
|
||||
Compass.Instance.RemoveQuestMarker(transform);
|
||||
if (nextPoint)
|
||||
{
|
||||
nextPoint.Activate();
|
||||
}
|
||||
|
||||
// Ukryj wska<6B>nik, gdy skrypt jest wy<77><79>czony
|
||||
//if (DestinationTargetManager.Instance != null)
|
||||
//{
|
||||
// DestinationTargetManager.Instance.SetTargetVisibility(false);
|
||||
// DestinationTargetManager.Instance.SwitchToNextPoint(nextPoint);
|
||||
//}
|
||||
}
|
||||
isActive = false;
|
||||
UpdateVisualState(false);
|
||||
if (activationCoroutine != null) StopCoroutine(activationCoroutine);
|
||||
}
|
||||
|
||||
/*
|
||||
// Funkcja wywo<77>ywana, gdy obiekt nadrz<72>dny zostaje dezaktywowany
|
||||
private void HandleParentDeactivated()
|
||||
// Metoda pomocnicza do zarządzania stanem wizualnym/fizycznym
|
||||
private void UpdateVisualState(bool state)
|
||||
{
|
||||
if (switchOnParentDeactivation && !isDestroyed)
|
||||
isArmed = state;
|
||||
|
||||
if (triggerCollider != null)
|
||||
triggerCollider.enabled = state;
|
||||
|
||||
if (Compass.Instance != null)
|
||||
{
|
||||
isDestroyed = true;
|
||||
// Prze<7A><65>cz na nast<73>pny punkt, je<6A>li obiekt nadrz<72>dny zosta<74> dezaktywowany
|
||||
DestinationTargetManager.Instance.SwitchToNextPoint(nextPoint);
|
||||
// Dezaktywuj ten punkt
|
||||
Deactivate();
|
||||
if (state)
|
||||
Compass.Instance.AddQuestMarker(transform, null);
|
||||
else
|
||||
Compass.Instance.RemoveQuestMarker(transform);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnTriggerEnter(Collider other)
|
||||
{
|
||||
if (!isActive || !isArmed) return;
|
||||
|
||||
// Sprawdzamy LayerMask lub Tag
|
||||
if (IsInLayerMask(other.gameObject, playerLayer) || other.CompareTag("Player"))
|
||||
{
|
||||
HandleDestinationReached();
|
||||
}
|
||||
}
|
||||
|
||||
private void HandleDestinationReached()
|
||||
{
|
||||
// Dźwięk
|
||||
if (destinationSound != null && audioSource != null)
|
||||
audioSource.PlayOneShot(destinationSound);
|
||||
|
||||
// Eventy
|
||||
onPointReached?.Invoke();
|
||||
|
||||
// Logika następnego punktu
|
||||
// Najpierw wyłączamy obecny, żeby nie wywołał się dwa razy
|
||||
Deactivate();
|
||||
|
||||
if (nextPoint != null)
|
||||
{
|
||||
nextPoint.Activate();
|
||||
}
|
||||
}
|
||||
|
||||
// --- Pomocnicze (Dystans i Coroutine) ---
|
||||
|
||||
private bool IsPlayerInsideOrTooClose()
|
||||
{
|
||||
if (playerTransform == null) return false;
|
||||
|
||||
// Sprawdzenie 1: Czy jest fizycznie w Triggerze
|
||||
if (triggerCollider != null && triggerCollider.bounds.Contains(playerTransform.position))
|
||||
return true;
|
||||
|
||||
// Sprawdzenie 2: Czy jest za blisko (zabezpieczenie jeśli collider jest mały)
|
||||
return Vector3.Distance(transform.position, playerTransform.position) < 2.0f;
|
||||
}
|
||||
|
||||
private IEnumerator WaitForSafeDistance()
|
||||
{
|
||||
// Upewnij się, że marker i collider są wyłączone podczas czekania
|
||||
UpdateVisualState(false);
|
||||
|
||||
while (playerTransform != null &&
|
||||
Vector3.Distance(transform.position, playerTransform.position) < minActivationDistance)
|
||||
{
|
||||
yield return new WaitForSeconds(0.5f);
|
||||
}
|
||||
|
||||
// Gracz odszedł wystarczająco daleko -> włącz punkt
|
||||
UpdateVisualState(true);
|
||||
activationCoroutine = null;
|
||||
}
|
||||
|
||||
private bool IsInLayerMask(GameObject obj, LayerMask layerMask)
|
||||
{
|
||||
return (layerMask.value & (1 << obj.layer)) > 0;
|
||||
}
|
||||
|
||||
// --- Debug w Edytorze ---
|
||||
private void OnDrawGizmos()
|
||||
{
|
||||
Gizmos.color = isActive ? (isArmed ? Color.green : Color.yellow) : Color.gray;
|
||||
Gizmos.DrawWireSphere(transform.position, 0.5f);
|
||||
|
||||
if (nextPoint != null)
|
||||
{
|
||||
Gizmos.color = Color.white;
|
||||
Gizmos.DrawLine(transform.position, nextPoint.transform.position);
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13,7 +13,7 @@ Material:
|
||||
m_Parent: {fileID: 0}
|
||||
m_ModifiedSerializedProperties: 0
|
||||
m_ValidKeywords:
|
||||
- _LIGHTSOURCE_NONE
|
||||
- _LIGHTSOURCE_DIRECTIONAL
|
||||
- _NOISE_ON
|
||||
- _SURFACE_TYPE_TRANSPARENT
|
||||
m_InvalidKeywords: []
|
||||
|
||||
@@ -14,7 +14,7 @@ Material:
|
||||
m_ModifiedSerializedProperties: 0
|
||||
m_ValidKeywords:
|
||||
- _ALPHATEST_ON
|
||||
- _LIGHTSOURCE_NONE
|
||||
- _LIGHTSOURCE_DIRECTIONAL
|
||||
- _NOISE_ON
|
||||
- _SURFACE_TYPE_TRANSPARENT
|
||||
m_InvalidKeywords: []
|
||||
|
||||
Reference in New Issue
Block a user