Main plot - wizard letter

This commit is contained in:
kabix09 2023-01-14 10:58:04 +01:00
parent 48832ab428
commit 0c8542ef64
12 changed files with 5431 additions and 40 deletions

View File

@ -0,0 +1,380 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &8636999769331509921
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 8636999769331509920}
- component: {fileID: 8636999769331509922}
- component: {fileID: 8636999769331509923}
m_Layer: 5
m_Name: WizardLetter
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &8636999769331509920
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8636999769331509921}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0.4999999, y: 0.8499999, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 8636999770180588553}
- {fileID: 8636999770381369110}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: -180.00002}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &8636999769331509922
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8636999769331509921}
m_CullTransparentMesh: 1
--- !u!114 &8636999769331509923
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8636999769331509921}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 21300000, guid: bb6d69d159de99e469018e593172730d, type: 3}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!1 &8636999769497434758
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 8636999769497434753}
- component: {fileID: 8636999769497434755}
- component: {fileID: 8636999769497434752}
- component: {fileID: 8636999769497434754}
m_Layer: 5
m_Name: Text
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &8636999769497434753
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8636999769497434758}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 2.8, y: 2, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 8636999770381369110}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: -24.2, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &8636999769497434755
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8636999769497434758}
m_CullTransparentMesh: 1
--- !u!114 &8636999769497434752
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8636999769497434758}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_FontData:
m_Font: {fileID: 12800000, guid: 884c49ec4abfe5a42b334668d8c1d9aa, type: 2}
m_FontSize: 0
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 0
m_MaxSize: 40
m_Alignment: 4
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text:
--- !u!114 &8636999769497434754
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8636999769497434758}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: a7c996be5c675ec4eb062e7ae1509118, type: 3}
m_Name:
m_EditorClassIdentifier:
textEnglish: << CLOSE >>
textPolish: << ZAMKNIJ >>
displayText: {fileID: 8636999769497434752}
--- !u!1 &8636999770180588558
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 8636999770180588553}
- component: {fileID: 8636999770180588555}
- component: {fileID: 8636999770180588552}
- component: {fileID: 1706033179266946092}
m_Layer: 5
m_Name: RestOfTheLetter
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &8636999770180588553
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8636999770180588558}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 3.5, y: 3, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 8636999769331509920}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0.00000095367, y: -17.181303}
m_SizeDelta: {x: 180, y: 60}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &8636999770180588555
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8636999770180588558}
m_CullTransparentMesh: 1
--- !u!114 &8636999770180588552
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8636999770180588558}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_FontData:
m_Font: {fileID: 12800000, guid: 884c49ec4abfe5a42b334668d8c1d9aa, type: 2}
m_FontSize: 0
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 0
m_MaxSize: 40
m_Alignment: 0
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text:
--- !u!114 &1706033179266946092
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8636999770180588558}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 056be10e6b61407438101baa8dcdcd32, type: 3}
m_Name:
m_EditorClassIdentifier:
Content:
InstanceTemplates:
- Key: 0
Value: Najemniku, udalem sie w gore rzeki. Podazaj moim sladem.
- Key: 1
Value: Mercenary, go north from the village. You'll find me in a familiar cave.
displayedValue: {fileID: 0}
displayedTextValue: {fileID: 8636999770180588552}
--- !u!1 &8636999770381369111
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 8636999770381369110}
- component: {fileID: 8636999770381369107}
- component: {fileID: 8636999770381369104}
m_Layer: 5
m_Name: Button
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &8636999770381369110
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8636999770381369111}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 8636999769497434753}
m_Father: {fileID: 8636999769331509920}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 276, y: -75}
m_SizeDelta: {x: 160, y: 30}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &8636999770381369107
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8636999770381369111}
m_CullTransparentMesh: 1
--- !u!114 &8636999770381369104
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8636999770381369111}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Navigation:
m_Mode: 3
m_WrapAround: 0
m_SelectOnUp: {fileID: 0}
m_SelectOnDown: {fileID: 0}
m_SelectOnLeft: {fileID: 0}
m_SelectOnRight: {fileID: 0}
m_Transition: 1
m_Colors:
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
m_ColorMultiplier: 1
m_FadeDuration: 0.1
m_SpriteState:
m_HighlightedSprite: {fileID: 0}
m_PressedSprite: {fileID: 0}
m_SelectedSprite: {fileID: 0}
m_DisabledSprite: {fileID: 0}
m_AnimationTriggers:
m_NormalTrigger: Normal
m_HighlightedTrigger: Highlighted
m_PressedTrigger: Pressed
m_SelectedTrigger: Selected
m_DisabledTrigger: Disabled
m_Interactable: 1
m_TargetGraphic: {fileID: 0}
m_OnClick:
m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 8636999769331509921}
m_TargetAssemblyTypeName:
m_MethodName:
m_Mode: 1
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName:
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: a81e66c5403bcfa47a6c663570849c07
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@ -50,9 +50,8 @@ public class ChangeScene : MonoBehaviour
while (true)
{
yield return new WaitForSeconds(waitTime);
Debug.Log("BEFORE");
collision.gameObject.GetComponent<DoorBehaviour>().ScenetToMoveTo();
Debug.Log("AFTER");
}
}
@ -60,25 +59,24 @@ public class ChangeScene : MonoBehaviour
// method is invoked only when script is assign to the player prefab object
public void OnCollisionEnter2D(Collision2D collision)
{
if(collision.gameObject.tag == "SceneTransition")
if(collision.gameObject.tag == "SceneTransition" || collision.gameObject.tag == "AnimatedDoorSceneTransition")
{
if(collision.gameObject.GetComponent<DoorBehaviour>() != null && !collision.gameObject.GetComponent<DoorBehaviour>().isEnabled)
if (collision.gameObject.GetComponent<DoorBehaviour>() != null && !collision.gameObject.GetComponent<DoorBehaviour>().isEnabled)
{
Debug.Log("Door are not enabled");
return;
}
else if (collision.gameObject.GetComponent<AnimatedDoorBehaviour>() != null && !collision.gameObject.GetComponent<AnimatedDoorBehaviour>().isEnabled)
if (collision.gameObject.GetComponent<AnimatedDoorBehaviour>() != null && !collision.gameObject.GetComponent<AnimatedDoorBehaviour>().isEnabled)
{
Debug.Log("Door are not enabled");
TriggerDoor.ableToOpen = false;
return;
}
collision.gameObject.GetComponent<DoorBehaviour>().ScenetToMoveTo();
}
if(collision.gameObject.tag == "AnimatedDoorSceneTransition")
{
Debug.Log("Starting coroutine");
Debug.Log(TriggerDoor.ableToOpen);
if (TriggerDoor.ableToOpen)
{
StartCoroutine(WaitForAnimationAndMoveToScene(0.3f, collision));

View File

@ -6,6 +6,8 @@ public class DetectionZone : MonoBehaviour
{
public string tagTarget = "Player";
public static bool ableToOpen = false;
// When object is detected, it is added to the list of actively detected objects
public List<Collider2D> detectedObjs = new List<Collider2D>();
@ -13,6 +15,7 @@ public class DetectionZone : MonoBehaviour
// Detect when object enters range
void OnTriggerEnter2D(Collider2D collider) {
if(collider.gameObject.tag == tagTarget) {
ableToOpen = true;
detectedObjs.Add(collider);
}
}
@ -22,5 +25,10 @@ public class DetectionZone : MonoBehaviour
if(collider.gameObject.tag == tagTarget) {
detectedObjs.Remove(collider);
}
if(detectedObjs.Count == 0)
{
ableToOpen = false;
}
}
}

View File

@ -5,7 +5,6 @@ using UnityEngine;
public class TriggerDoor : DetectionZone
{
public string DoorOpenAnimatorParamName = "DoorOpen";
public static bool ableToOpen = false;
public static Animator animator;
void Start(){
@ -13,15 +12,13 @@ public class TriggerDoor : DetectionZone
}
void Update() {
if(detectedObjs.Count > 0) {
if(detectedObjs.Count > 0 && ableToOpen) {
//if (Input.GetKeyDown(KeyCode.E))
//{
animator.SetBool(DoorOpenAnimatorParamName, true);
ableToOpen = true;
//}
} else {
animator.SetBool(DoorOpenAnimatorParamName, false);
ableToOpen = false;
}
}

View File

@ -0,0 +1,66 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;
// Overwrite ControlsletterManager & PrologueLetterMoanager
// to extend this
public class WindowController : MonoBehaviour, IOpenable
{
public virtual string PANEL_NAME => "Wizard.Letter";
public GameObject Window;
public GameObject _panel;
// Start is called before the first frame update
void Start()
{
}
public void OpenPanel()
{
_panel = Instantiate(Window, GameObject.FindGameObjectWithTag("GUI").transform);
_panel.transform.Find("Button").GetComponent<UnityEngine.UI.Button>().onClick.AddListener(DestroyPanel);
}
public void DestroyPanelWithSaving()
{
Destroy(_panel);
PlayerPrefs.SetInt(GetKeyName(), 1);
}
public void DestroyPanel()
{
Destroy(_panel);
}
// true if is opened
public bool IsOpened()
{
return _panel != null;
}
public bool WasDisplayed()
{
return PlayerPrefs.HasKey(GetKeyName()) ? Convert.ToBoolean(PlayerPrefs.GetInt(GetKeyName())) : false;
}
public string GetKeyName()
{
return PANEL_NAME + ".WhereDisplayed";
}
}
public interface IOpenable
{
public void OpenPanel();
public void DestroyPanel();
public bool IsOpened();
public bool WasDisplayed();
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: b303fbc7638fcd040837e36c67c94d6a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,29 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
// copy of PanelHeaderController
class WindowText : MonoBehaviour
{
public LanguageDetector<string> Content = new LanguageDetector<string>();
[Header("Content")]
[SerializeField] public TextMeshProUGUI displayedValue;
// alternative component - in some places ther is used plain Text component no TextMeshProUGUI... - trash soltuion, mess in project fonts :)
[SerializeField] public Text displayedTextValue;
private void Start()
{
// Set Panel Header value
if (displayedValue != null)
displayedValue.text = Content.DetectInstanceBasedOnLanguage();
if (displayedTextValue != null)
displayedTextValue.text = Content.DetectInstanceBasedOnLanguage();
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 056be10e6b61407438101baa8dcdcd32
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -7,6 +7,7 @@ using TMPro;
using UnityEngine;
using UnityEngine.UI;
// copy of WindowText
class PanelHeaderController : MonoBehaviour
{
[SerializeField]

View File

@ -9,10 +9,10 @@ public class DoorBlocking : MonoBehaviour
{
if (InventoryUIManager.Instance.FindItemInWarehouseByName("ScrollOfDarkness").Count > 0)
{
Debug.Log("xd");
if (gameObject.GetComponent<DoorBehaviour>())
gameObject.GetComponent<DoorBehaviour>().isEnabled = false;
else if (gameObject.GetComponent<AnimatedDoorBehaviour>())
if (gameObject.GetComponent<AnimatedDoorBehaviour>())
gameObject.GetComponent<AnimatedDoorBehaviour>().isEnabled = false;
}