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");
|
|
|
|
}
|
|
|
|
|
2019-04-29 12:35:35 +00:00
|
|
|
public override void OnPickup(EntityPlayer player) {
|
2019-04-29 08:39:48 +00:00
|
|
|
player.hp += hpChange;
|
2019-04-29 12:35:35 +00:00
|
|
|
player.hpMax += maxHpChange;
|
2019-04-29 08:39:48 +00:00
|
|
|
OnPurchase();
|
|
|
|
messageBar.Write("Bought: " + Name, Color.yellow);
|
|
|
|
Destroy(gameObject);
|
|
|
|
}
|
|
|
|
}
|