Enemy drop money on dealth

This commit is contained in:
BOT Alex 2024-04-21 06:56:15 +02:00
parent dc1dfeee67
commit 000f72bc7a
8 changed files with 105 additions and 0 deletions

View File

@ -9,6 +9,8 @@ GameObject:
serializedVersion: 6
m_Component:
- component: {fileID: 8711060493889635308}
- component: {fileID: 369596802107988542}
- component: {fileID: 8270377878650669399}
m_Layer: 0
m_Name: Enemy
m_TagString: Untagged
@ -31,3 +33,41 @@ Transform:
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &369596802107988542
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 95331384460172707}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 62293fbacde88045196dca1e291b5f23, type: 3}
m_Name:
m_EditorClassIdentifier:
startHealth: 100
OnHealthZero:
m_PersistentCalls:
m_Calls: []
OnHealthChange:
m_PersistentCalls:
m_Calls: []
OnHealthChange2:
m_PersistentCalls:
m_Calls: []
OnHealthChange3:
m_PersistentCalls:
m_Calls: []
--- !u!114 &8270377878650669399
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 95331384460172707}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d1d1daa1d5342744bb097706d0969cae, type: 3}
m_Name:
m_EditorClassIdentifier:
MoneyDropOnDeath: 0

View File

@ -13,6 +13,11 @@ PrefabInstance:
propertyPath: m_Name
value: GreenBoy1
objectReference: {fileID: 0}
- target: {fileID: 8270377878650669399, guid: eff762e00bcd52a438a5abf98a554a0b,
type: 3}
propertyPath: MoneyDropOnDeath
value: 25
objectReference: {fileID: 0}
- target: {fileID: 8711060493889635308, guid: eff762e00bcd52a438a5abf98a554a0b,
type: 3}
propertyPath: m_LocalPosition.x

View File

@ -13,6 +13,11 @@ PrefabInstance:
propertyPath: m_Name
value: GreenBoy2
objectReference: {fileID: 0}
- target: {fileID: 8270377878650669399, guid: eff762e00bcd52a438a5abf98a554a0b,
type: 3}
propertyPath: MoneyDropOnDeath
value: 50
objectReference: {fileID: 0}
- target: {fileID: 8711060493889635308, guid: eff762e00bcd52a438a5abf98a554a0b,
type: 3}
propertyPath: m_LocalPosition.x

View File

@ -87,6 +87,11 @@ PrefabInstance:
propertyPath: m_Name
value: GreenBoyBoss
objectReference: {fileID: 0}
- target: {fileID: 8270377878650669399, guid: eff762e00bcd52a438a5abf98a554a0b,
type: 3}
propertyPath: MoneyDropOnDeath
value: 200
objectReference: {fileID: 0}
- target: {fileID: 8711060493889635308, guid: eff762e00bcd52a438a5abf98a554a0b,
type: 3}
propertyPath: m_LocalPosition.x

View File

@ -87,6 +87,11 @@ PrefabInstance:
propertyPath: m_Name
value: GreenBoyJetpack
objectReference: {fileID: 0}
- target: {fileID: 8270377878650669399, guid: eff762e00bcd52a438a5abf98a554a0b,
type: 3}
propertyPath: MoneyDropOnDeath
value: 150
objectReference: {fileID: 0}
- target: {fileID: 8711060493889635308, guid: eff762e00bcd52a438a5abf98a554a0b,
type: 3}
propertyPath: m_LocalPosition.x

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: aac742eb4131cb34a87890b1b678b4b9
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,26 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class MoneyOnEnemyDeath : MonoBehaviour
{
private HealthComponent healthComp;
[SerializeField] private float MoneyDropOnDeath;
private void OnEnable()
{
healthComp = GetComponent<HealthComponent>();
healthComp.OnHealthZero.AddListener(OnDeath);
}
private void OnDisable()
{
healthComp.OnHealthZero.RemoveListener(OnDeath);
}
void OnDeath()
{
GameManager.Instance.Balance.Value += MoneyDropOnDeath;
}
}

View File

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