Implemented basic room rewards triggering mechanism.
This commit is contained in:
parent
9a8077021a
commit
90b9e2689a
5 changed files with 1060 additions and 2 deletions
|
|
@ -85,6 +85,7 @@ GameObject:
|
||||||
m_Component:
|
m_Component:
|
||||||
- component: {fileID: 9187907134033443523}
|
- component: {fileID: 9187907134033443523}
|
||||||
- component: {fileID: 3406749035128918688}
|
- component: {fileID: 3406749035128918688}
|
||||||
|
- component: {fileID: 4547043864789539458}
|
||||||
- component: {fileID: 1770509300873928573}
|
- component: {fileID: 1770509300873928573}
|
||||||
- component: {fileID: 4019891345885281529}
|
- component: {fileID: 4019891345885281529}
|
||||||
- component: {fileID: -1465197196826248026}
|
- component: {fileID: -1465197196826248026}
|
||||||
|
|
@ -128,6 +129,21 @@ MonoBehaviour:
|
||||||
numberTextObject: {fileID: 8119019481281764985}
|
numberTextObject: {fileID: 8119019481281764985}
|
||||||
healthTickObject: {fileID: 2885337975627474754}
|
healthTickObject: {fileID: 2885337975627474754}
|
||||||
_health: 0
|
_health: 0
|
||||||
|
--- !u!114 &4547043864789539458
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 2435349004046080434}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 686125cb666fff047a08043aa1feb0a8, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
diamonds: 0
|
||||||
|
chest: 0
|
||||||
|
damage: 0
|
||||||
--- !u!212 &1770509300873928573
|
--- !u!212 &1770509300873928573
|
||||||
SpriteRenderer:
|
SpriteRenderer:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ GameObject:
|
||||||
m_Component:
|
m_Component:
|
||||||
- component: {fileID: 9187907134033443523}
|
- component: {fileID: 9187907134033443523}
|
||||||
- component: {fileID: 849256457500513523}
|
- component: {fileID: 849256457500513523}
|
||||||
|
- component: {fileID: 6904757263627452010}
|
||||||
- component: {fileID: 1770509300873928573}
|
- component: {fileID: 1770509300873928573}
|
||||||
- component: {fileID: 4019891345885281529}
|
- component: {fileID: 4019891345885281529}
|
||||||
- component: {fileID: -1465197196826248026}
|
- component: {fileID: -1465197196826248026}
|
||||||
|
|
@ -50,9 +51,22 @@ MonoBehaviour:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
adjacentRooms: []
|
adjacentRooms: []
|
||||||
isEntrance: 0
|
isEntrance: 0
|
||||||
keyType: 0
|
|
||||||
numberTextObject: {fileID: 8119019481281764985}
|
numberTextObject: {fileID: 8119019481281764985}
|
||||||
number: 0
|
--- !u!114 &6904757263627452010
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 2435349004046080434}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 686125cb666fff047a08043aa1feb0a8, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
diamonds: 0
|
||||||
|
chest: 0
|
||||||
|
damage: 0
|
||||||
--- !u!212 &1770509300873928573
|
--- !u!212 &1770509300873928573
|
||||||
SpriteRenderer:
|
SpriteRenderer:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
31
PuzzleGameProject/Assets/Scripts/Rooms/RoomReward.cs
Normal file
31
PuzzleGameProject/Assets/Scripts/Rooms/RoomReward.cs
Normal file
|
|
@ -0,0 +1,31 @@
|
||||||
|
using System;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
public class RoomReward : MonoBehaviour
|
||||||
|
{
|
||||||
|
public static event Action<int> DiamondsRewarded;
|
||||||
|
public static event Action ChestRewarded;
|
||||||
|
public static event Action<int> DamageDealt;
|
||||||
|
|
||||||
|
[SerializeField] private int diamonds;
|
||||||
|
[SerializeField] private bool chest;
|
||||||
|
[SerializeField] private int damage;
|
||||||
|
|
||||||
|
public void TriggerGetReward()
|
||||||
|
{
|
||||||
|
if (diamonds > 0)
|
||||||
|
{
|
||||||
|
DiamondsRewarded?.Invoke(diamonds);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (chest)
|
||||||
|
{
|
||||||
|
ChestRewarded?.Invoke();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (damage > 0)
|
||||||
|
{
|
||||||
|
DamageDealt?.Invoke(damage);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 686125cb666fff047a08043aa1feb0a8
|
||||||
Loading…
Add table
Add a link
Reference in a new issue