1
Fork 0

Add Heart Item

This commit is contained in:
Lorenzo Balugani 2019-04-28 17:22:08 +02:00
parent 337e52a080
commit d943add3ea
2 changed files with 38 additions and 0 deletions

View file

@ -0,0 +1,27 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class EntityItemHeart : EntityItem
{
public int regen;
protected EntityPlayer player;
public override string Name {
get {
return "Heart";
}
}
// Start is called before the first frame update
protected new void Start() {
base.Start();
player = GameObject.FindGameObjectWithTag("Player").GetComponent<EntityPlayer>();
}
// Update is called once per frame
public override void OnPickup(EntityPlayer player) {
messageBar.Write("You used: " + Name, Color.yellow);
player.hp+=regen;
if (player.hp > player.hpMax) player.hp = player.hpMax;
Destroy(gameObject);
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: c07fddfe35675304f92b18a213875e74
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: