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

27 lines
719 B
C#
Raw Normal View History

2019-04-29 08:39:48 +00:00
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);
}
}