1
Fork 0
slime-blood-and-pain/Assets/Scripts/EntityItemShop.cs

27 lines
No EOL
719 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() {
player.hp += hpChange;
player.maxHpChange += maxHpChange;
OnPurchase();
messageBar.Write("Bought: " + Name, Color.yellow);
Destroy(gameObject);
}
}