1
Fork 0
slime-blood-and-pain/Assets/Scripts/EntityItemShop.cs
2019-04-29 14:35:35 +02:00

27 lines
No EOL
732 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class EntityItemShop : EntityItem {
public float hpChange = -1f;
public float maxHpChange = -1f;
protected EntityPlayer player;
protected override void Start() {
base.Start();
player = GameObject.FindGameObjectWithTag("Player").GetComponent<EntityPlayer>();
}
protected virtual void OnPurchase() {
Debug.LogWarning("OnPurchase not overridden");
}
public override void OnPickup(EntityPlayer player) {
player.hp += hpChange;
player.hpMax += maxHpChange;
OnPurchase();
messageBar.Write("Bought: " + Name, Color.yellow);
Destroy(gameObject);
}
}