Added door animation and fixed thugs movement
This commit is contained in:
parent
c991563aa4
commit
b408f0fbe4
@ -154,6 +154,7 @@
|
||||
<Compile Include="Assets\Scripts\MenuGUI.cs" />
|
||||
<Compile Include="Assets\Scripts\REFACTORING\Application\Dialogue\Panel\IPanel.cs" />
|
||||
<Compile Include="Assets\Scripts\SaveSystem.cs" />
|
||||
<Compile Include="Assets\Scripts\AnimatedDoorBehaviour.cs" />
|
||||
<Compile Include="Assets\Scripts\ProceduralGeneration\GraphNode.cs" />
|
||||
<Compile Include="Assets\Scripts\SceneManager\OnMapAppearanceMethod.cs" />
|
||||
<Compile Include="Assets\Scripts\NPCs' Scripts\NPCQuest.cs" />
|
||||
@ -223,6 +224,8 @@
|
||||
<Compile Include="Assets\Scripts\NPCs' Scripts\NPCDialogue.cs" />
|
||||
<Compile Include="Assets\Scripts\REFACTORING\Application\UI\Panel\TaskPanelController.cs" />
|
||||
<Compile Include="Assets\Scripts\Player.cs" />
|
||||
<Compile Include="Assets\Scripts\Door\DetectionZone.cs" />
|
||||
<Compile Include="Assets\Scripts\Door\TriggerDoor.cs" />
|
||||
<None Include="Assets\TextMesh Pro\Shaders\TMPro.cginc" />
|
||||
<None Include="Assets\TextMesh Pro\Shaders\TMP_SDF-Mobile Overlay.shader" />
|
||||
<None Include="Assets\TextMesh Pro\Shaders\TMP_Bitmap.shader" />
|
||||
|
@ -389,10 +389,6 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: 18149eba0830c174c9dcc882c0e77eba, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
ground: {fileID: 178967048}
|
||||
walls: {fileID: 1177818049}
|
||||
ground1: {fileID: 11400000, guid: 5b70fbf89fe74ba4899b6d05830a8340, type: 2}
|
||||
wall1: {fileID: 11400000, guid: 120f4295c33110c42ada777e171036d1, type: 2}
|
||||
--- !u!156049354 &1796128696
|
||||
Grid:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -466,14 +462,9 @@ MonoBehaviour:
|
||||
m_GameObject: {fileID: 1856799950}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: ef71482e4d2df8440a1117e181018706, type: 3}
|
||||
m_Script: {fileID: 11500000, guid: e069f5d1e3084101831c42a88d412f64, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
isNewGame: 1
|
||||
isContinued: 0
|
||||
MapName:
|
||||
ElementFolderName: InventoryItem
|
||||
ItemsListName: InventoryItemList
|
||||
--- !u!114 &1856799953
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -483,15 +474,13 @@ MonoBehaviour:
|
||||
m_GameObject: {fileID: 1856799950}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: b8a65f0b147a2e44e8f244301ff0de57, type: 3}
|
||||
m_Script: {fileID: 11500000, guid: 16a738463a5a474dac5fa29bccecbf43, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
TaskElements: []
|
||||
isNewGame: 1
|
||||
isContinued: 0
|
||||
MapName:
|
||||
ElementFolderName: Quest
|
||||
ItemsListName: QuestsList
|
||||
ground: {fileID: 178967048}
|
||||
walls: {fileID: 1177818049}
|
||||
ground1: {fileID: 11400000, guid: daff8503ea910584aa0c0bcaea47c1f3, type: 2}
|
||||
wall1: {fileID: 11400000, guid: 3856c657f18141d448e0f4386818d808, type: 2}
|
||||
--- !u!114 &1856799954
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -506,8 +495,6 @@ MonoBehaviour:
|
||||
m_EditorClassIdentifier:
|
||||
StaticElements: []
|
||||
DynamicElements: []
|
||||
isNewGame: 1
|
||||
isContinued: 0
|
||||
MapName:
|
||||
ElementFolderName: EquippableItem
|
||||
ItemsListName: EquippableItemList
|
||||
|
File diff suppressed because it is too large
Load Diff
68
Assets/Scripts/AnimatedDoorBehaviour.cs
Normal file
68
Assets/Scripts/AnimatedDoorBehaviour.cs
Normal file
@ -0,0 +1,68 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
public class AnimatedDoorBehaviour : TriggerDoor
|
||||
{
|
||||
public GameObject SaveController;
|
||||
|
||||
[SerializeField]
|
||||
public Gateway gateway;
|
||||
|
||||
public string DoorOpenAnimatorParamName = "DoorOpen";
|
||||
|
||||
Animator animator;
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
animator = GetComponent<Animator>();
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private IEnumerator coroutine;
|
||||
|
||||
|
||||
private IEnumerator Wait(float waitTime)
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
yield return new WaitForSeconds(waitTime);
|
||||
}
|
||||
}
|
||||
|
||||
public void ScenetToMoveTo()
|
||||
{
|
||||
//coroutine = Wait(2.0f);
|
||||
//StartCoroutine(coroutine);
|
||||
animator.SetBool(DoorOpenAnimatorParamName, true);
|
||||
|
||||
|
||||
//saving info about used gate/door/teleport
|
||||
OnMapAppearanceMethod.SetTeleportedStatus();
|
||||
|
||||
PlayerPrefs.SetString("gateway.sourceMapName", gateway.currentMapName);
|
||||
PlayerPrefs.SetString("gateway.nextMapName", gateway.nextMapName);
|
||||
|
||||
PlayerPrefs.SetFloat("gateway.respawnCoords.x", gateway.respawnCoords.x);
|
||||
PlayerPrefs.SetFloat("gateway.respawnCoords.y", gateway.respawnCoords.y);
|
||||
PlayerPrefs.SetFloat("gateway.respawnCoords.z", gateway.respawnCoords.z);
|
||||
|
||||
// 1. Save all before change scene
|
||||
SaveController.GetComponent<SaveController>().SavePlayerEquipmentItems();
|
||||
SaveController.GetComponent<SaveController>().SavePlayerQuests();
|
||||
SaveController.GetComponent<SaveController>().SavePlayerInventory();
|
||||
SaveController.GetComponent<SaveController>().SaveHealth();
|
||||
|
||||
SaveController.GetComponent<SaveController>().SaveChests();
|
||||
|
||||
// 2. Change scene
|
||||
SceneManager.LoadScene(gateway.nextMapName);
|
||||
}
|
||||
}
|
11
Assets/Scripts/AnimatedDoorBehaviour.cs.meta
Normal file
11
Assets/Scripts/AnimatedDoorBehaviour.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f4ca3abed00eafc479003570f0bdb940
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -7,13 +7,27 @@ using System;
|
||||
public class ChangeScene : MonoBehaviour
|
||||
{
|
||||
float x, y, z;
|
||||
|
||||
|
||||
public void MoveToScene(int sceneID)
|
||||
{
|
||||
SceneManager.LoadScene(sceneID);
|
||||
}
|
||||
|
||||
void Start(){
|
||||
|
||||
}
|
||||
|
||||
private IEnumerator WaitForAnimationAndMoveToScene(float waitTime, Collision2D collision)
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
yield return new WaitForSeconds(waitTime);
|
||||
collision.gameObject.GetComponent<DoorBehaviour>().ScenetToMoveTo();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// method is invoked only when script is assign to the player prefab object
|
||||
public void OnCollisionEnter2D(Collision2D collision)
|
||||
{
|
||||
@ -21,5 +35,10 @@ public class ChangeScene : MonoBehaviour
|
||||
{
|
||||
collision.gameObject.GetComponent<DoorBehaviour>().ScenetToMoveTo();
|
||||
}
|
||||
if(collision.gameObject.tag == "AnimatedDoorSceneTransition")
|
||||
{
|
||||
Debug.Log("Starting coroutine");
|
||||
StartCoroutine(WaitForAnimationAndMoveToScene(0.3f, collision));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
3
Assets/Scripts/Door.meta
Normal file
3
Assets/Scripts/Door.meta
Normal file
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7790e17a38c94ead9e481fc94ee73eb3
|
||||
timeCreated: 1670611468
|
26
Assets/Scripts/Door/DetectionZone.cs
Normal file
26
Assets/Scripts/Door/DetectionZone.cs
Normal file
@ -0,0 +1,26 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class DetectionZone : MonoBehaviour
|
||||
{
|
||||
public string tagTarget = "Player";
|
||||
|
||||
// When object is detected, it is added to the list of actively detected objects
|
||||
public List<Collider2D> detectedObjs = new List<Collider2D>();
|
||||
|
||||
|
||||
// Detect when object enters range
|
||||
void OnTriggerEnter2D(Collider2D collider) {
|
||||
if(collider.gameObject.tag == tagTarget) {
|
||||
detectedObjs.Add(collider);
|
||||
}
|
||||
}
|
||||
|
||||
// Detect when object leaves range
|
||||
void OnTriggerExit2D(Collider2D collider) {
|
||||
if(collider.gameObject.tag == tagTarget) {
|
||||
detectedObjs.Remove(collider);
|
||||
}
|
||||
}
|
||||
}
|
11
Assets/Scripts/Door/DetectionZone.cs.meta
Normal file
11
Assets/Scripts/Door/DetectionZone.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a98fb2ba87024f445939e9fa104b4959
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
31
Assets/Scripts/Door/TriggerDoor.cs
Normal file
31
Assets/Scripts/Door/TriggerDoor.cs
Normal file
@ -0,0 +1,31 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class TriggerDoor : DetectionZone
|
||||
{
|
||||
public string DoorOpenAnimatorParamName = "DoorOpen";
|
||||
|
||||
Animator animator;
|
||||
|
||||
void Start(){
|
||||
animator = GetComponent<Animator>();
|
||||
}
|
||||
|
||||
void Update() {
|
||||
if(detectedObjs.Count > 0) {
|
||||
animator.SetBool(DoorOpenAnimatorParamName, true);
|
||||
} else {
|
||||
animator.SetBool(DoorOpenAnimatorParamName, false);
|
||||
}
|
||||
}
|
||||
|
||||
public void triggerDoor()
|
||||
{
|
||||
animator = GetComponent<Animator>();
|
||||
|
||||
animator.SetBool(DoorOpenAnimatorParamName, true);
|
||||
}
|
||||
|
||||
|
||||
}
|
11
Assets/Scripts/Door/TriggerDoor.cs.meta
Normal file
11
Assets/Scripts/Door/TriggerDoor.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 81a26447692d7f64db815aa455bb438a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -22,6 +22,12 @@ public class DoorBehaviour : MonoBehaviour
|
||||
|
||||
}
|
||||
|
||||
public static IEnumerator Wait()
|
||||
{
|
||||
yield return new WaitForSeconds(2);
|
||||
}
|
||||
|
||||
|
||||
public void ScenetToMoveTo()
|
||||
{
|
||||
//saving info about used gate/door/teleport
|
||||
@ -41,7 +47,6 @@ public class DoorBehaviour : MonoBehaviour
|
||||
SaveController.GetComponent<SaveController>().SaveHealth();
|
||||
|
||||
SaveController.GetComponent<SaveController>().SaveChests();
|
||||
|
||||
// 2. Change scene
|
||||
SceneManager.LoadScene(gateway.nextMapName);
|
||||
}
|
||||
|
@ -18,9 +18,9 @@ public class TileMapGenerator : MonoBehaviour
|
||||
Map map = new Map(new Vector2Int(100, 100));
|
||||
List<FloodFill> fillers = new List<FloodFill>();
|
||||
|
||||
for (int i = 0; i < 50; i++)
|
||||
for (int i = 0; i < 70; i++)
|
||||
{
|
||||
FloodFill filler = new FloodFill(map, 1, new Vector2Int(Random.Range(0, 50), Random.Range(0, 50)));
|
||||
FloodFill filler = new FloodFill(map, 1, new Vector2Int(Random.Range(0, 70), Random.Range(0, 70)));
|
||||
fillers.Add(filler);
|
||||
}
|
||||
map.Fill(fillers);
|
||||
|
@ -15,6 +15,8 @@ TagManager:
|
||||
- EnemyCollection
|
||||
- NPCCollection
|
||||
- UIPanel
|
||||
- AnimatedDoorSceneTransition
|
||||
- Test
|
||||
layers:
|
||||
- Default
|
||||
- TransparentFX
|
||||
|
@ -12,25 +12,25 @@ EditorUserSettings:
|
||||
value: 22424703114646680e0b0227036c68190c160a2e042733232867083debf42d
|
||||
flags: 0
|
||||
RecentlyUsedScenePath-2:
|
||||
value: 22424703114646680e0b0227036c70050204112e291f2f2a2c3b1920caef212be7a923e7ee2e26
|
||||
flags: 0
|
||||
RecentlyUsedScenePath-3:
|
||||
value: 22424703114646680e0b0227036c72111f19352f223d667d6d0a1532f0e1372ce7f518e8ea3f7129370bfb25
|
||||
flags: 0
|
||||
RecentlyUsedScenePath-4:
|
||||
RecentlyUsedScenePath-3:
|
||||
value: 22424703114646680e0b0227036c72111f19352f223d667d6d1a1226ece42776f7e93ffdfe
|
||||
flags: 0
|
||||
RecentlyUsedScenePath-5:
|
||||
RecentlyUsedScenePath-4:
|
||||
value: 22424703114646680e0b0227036c71150130192729686b700e261335ebf23939f6ee39e7a92f31352d1b
|
||||
flags: 0
|
||||
RecentlyUsedScenePath-5:
|
||||
value: 22424703114646680e0b0227036c72111f1958072926337e38271427fb
|
||||
flags: 0
|
||||
RecentlyUsedScenePath-6:
|
||||
value: 22424703114646680e0b0227036c7b0518101d252266333e243d04
|
||||
flags: 0
|
||||
RecentlyUsedScenePath-7:
|
||||
value: 22424703114646680e0b0227036c6c111b07142f1f2b233e2867083debf42d
|
||||
value: 22424703114646680e0b0227036c70050204112e291f2f2a2c3b1920caef212be7a923e7ee2e26
|
||||
flags: 0
|
||||
RecentlyUsedScenePath-8:
|
||||
value: 22424703114646680e0b0227036c72111f1958072926337e38271427fb
|
||||
value: 22424703114646680e0b0227036c6c111b07142f1f2b233e2867083debf42d
|
||||
flags: 0
|
||||
vcSharedLogLevel:
|
||||
value: 0d5e400f0650
|
||||
|
Loading…
Reference in New Issue
Block a user