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

29 lines
695 B
C#
Raw Normal View History

2019-04-28 12:11:21 +00:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
2019-04-28 14:34:50 +00:00
public class EntityItem : Entity
2019-04-28 12:11:21 +00:00
{
2019-04-28 14:44:16 +00:00
public virtual string Name {
get {
Debug.LogWarning("No name given to an item");
return "";
}
}
2019-04-28 14:28:31 +00:00
2019-04-28 13:29:17 +00:00
protected override void Start() {
base.Start();
2019-04-28 12:11:21 +00:00
overlappable = true;
}
2019-04-28 14:34:50 +00:00
public virtual void OnPickup(EntityPlayer player) {
2019-04-28 12:11:21 +00:00
Debug.LogWarning("OnPickup not overridden");
2019-04-28 14:44:16 +00:00
messageBar.Write("Picked up: " + Name, Color.yellow);
2019-04-28 14:28:31 +00:00
Destroy(gameObject);
}
public override void Die() {
2019-04-28 14:44:16 +00:00
messageBar.Write("Destroyed: " + Name, Color.red);
2019-04-28 13:29:17 +00:00
Destroy(gameObject);
2019-04-28 12:11:21 +00:00
}
}