Skip to content

Commit d70c826

Browse files
committed
Added FallCatcher script for water areas
1 parent c11dbb0 commit d70c826

File tree

6 files changed

+60
-3
lines changed

6 files changed

+60
-3
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
%YAML 1.1
2+
%TAG !u! tag:unity3d.com,2011:
3+
--- !u!114 &11400000
4+
MonoBehaviour:
5+
m_ObjectHideFlags: 0
6+
m_CorrespondingSourceObject: {fileID: 0}
7+
m_PrefabInstance: {fileID: 0}
8+
m_PrefabAsset: {fileID: 0}
9+
m_GameObject: {fileID: 0}
10+
m_Enabled: 1
11+
m_EditorHideFlags: 0
12+
m_Script: {fileID: 11500000, guid: fedb6eda6181441209c70ac00d6e7cc8, type: 3}
13+
m_Name: TownMarket_LakeFall
14+
m_EditorClassIdentifier:

UOP1_Project/Assets/ScriptableObjects/Paths/TownMarket_LakeFall.asset.meta

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

UOP1_Project/Assets/Scripts/Characters/Damageable.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ private void Awake()
2626
_currentHealth = _healthConfigSO.MaxHealth;
2727
}
2828

29+
public void Kill()
30+
{
31+
ReceiveAnAttack(_currentHealth);
32+
}
33+
2934
public void ReceiveAnAttack(int damage)
3035
{
3136
if (IsDead)
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
using System.Collections;
2+
using System.Collections.Generic;
3+
using UnityEngine;
4+
5+
public class FallCatcher : MonoBehaviour
6+
{
7+
[SerializeField] private PathSO _leadsToPath = default;
8+
[SerializeField] private PathStorageSO _pathStorage = default;
9+
10+
private void OnTriggerEnter(Collider other)
11+
{
12+
if (other.CompareTag("Player"))
13+
{
14+
_pathStorage.lastPathTaken = _leadsToPath;
15+
16+
other.GetComponent<Damageable>().Kill();
17+
}
18+
}
19+
}

UOP1_Project/Assets/Scripts/SceneManagement/FallCatcher.cs.meta

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

UOP1_Project/Assets/Scripts/SceneManagement/LocationExit.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,7 @@ private void OnTriggerEnter(Collider other)
1717
{
1818
if (other.CompareTag("Player"))
1919
{
20-
if (_pathStorage != null)
21-
_pathStorage.lastPathTaken = _leadsToPath;
22-
20+
_pathStorage.lastPathTaken = _leadsToPath;
2321
_locationExitLoadChannel.RaiseEvent(_locationToLoad, false, true);
2422
}
2523
}

0 commit comments

Comments
 (0)