Give a name to things
This commit is contained in:
parent
c1925499ff
commit
55df0367ce
8 changed files with 31 additions and 11 deletions
|
@ -289,7 +289,8 @@ MonoBehaviour:
|
|||
type: 3}
|
||||
enemyPrefabs:
|
||||
- {fileID: 470211819356819165, guid: 1bd6e08f590fdd844854a34504aeaa4a, type: 3}
|
||||
enemiesToSpawn: 10
|
||||
- {fileID: 1164136568549368904, guid: a4aeecfb369f0974490d158ef9489335, type: 3}
|
||||
enemiesToSpawn: 15
|
||||
--- !u!1 &6763073704789207264
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
|
@ -177,7 +177,7 @@ MonoBehaviour:
|
|||
m_Script: {fileID: 11500000, guid: f16e1b4841b0d4546a52853aafbb7d85, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
hpMax: 0
|
||||
hpMax: 10
|
||||
overlappable: 0
|
||||
hp: 0
|
||||
sprite: {fileID: 0}
|
||||
|
|
|
@ -92,7 +92,7 @@ MonoBehaviour:
|
|||
m_Script: {fileID: 11500000, guid: 1ce1b6adc640d6f46bbf4d7072735b7f, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
hpMax: 0
|
||||
hpMax: 2
|
||||
overlappable: 0
|
||||
hp: 0
|
||||
sprite: {fileID: 0}
|
||||
|
|
|
@ -44,7 +44,7 @@ MonoBehaviour:
|
|||
m_Script: {fileID: 11500000, guid: cfb3c44da9ebb1840b5a2bcdfd5e2730, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
hpMax: 0
|
||||
hpMax: 1
|
||||
overlappable: 0
|
||||
hp: 0
|
||||
sprite: {fileID: 0}
|
||||
|
|
|
@ -10,9 +10,6 @@ public class Entity : MonoBehaviour
|
|||
[AfterStartAttribute]
|
||||
public float hp;
|
||||
|
||||
[BeforeStartAttribute]
|
||||
public Sprite sprite;
|
||||
|
||||
public Vector2Int MapPosition {
|
||||
get {
|
||||
return new Vector2Int((int)transform.position.x, (int)transform.position.y);
|
||||
|
@ -28,7 +25,6 @@ public class Entity : MonoBehaviour
|
|||
protected virtual void Start()
|
||||
{
|
||||
spriteRenderer = GetComponent<SpriteRenderer>();
|
||||
spriteRenderer.sprite = sprite;
|
||||
gameController = GameObject.FindGameObjectWithTag("GameController");
|
||||
turnHandler = gameController.GetComponentInChildren<TurnHandler>();
|
||||
map = gameController.GetComponentInChildren<Map>();
|
||||
|
|
|
@ -4,7 +4,12 @@ using UnityEngine;
|
|||
|
||||
public class EntityItem : Entity
|
||||
{
|
||||
public static string itemName = "White Triangle";
|
||||
public virtual string Name {
|
||||
get {
|
||||
Debug.LogWarning("No name given to an item");
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
protected override void Start() {
|
||||
base.Start();
|
||||
|
@ -13,12 +18,12 @@ public class EntityItem : Entity
|
|||
|
||||
public virtual void OnPickup(EntityPlayer player) {
|
||||
Debug.LogWarning("OnPickup not overridden");
|
||||
messageBar.Write("Picked up: " + itemName, Color.yellow);
|
||||
messageBar.Write("Picked up: " + Name, Color.yellow);
|
||||
Destroy(gameObject);
|
||||
}
|
||||
|
||||
public override void Die() {
|
||||
messageBar.Write("Destroyed: " + itemName, Color.red);
|
||||
messageBar.Write("Destroyed: " + Name, Color.red);
|
||||
Destroy(gameObject);
|
||||
}
|
||||
}
|
|
@ -4,7 +4,19 @@ using UnityEngine;
|
|||
|
||||
public class EntityMonster : Entity
|
||||
{
|
||||
public virtual string Name {
|
||||
get {
|
||||
Debug.LogWarning("No name given to a monster");
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void OnTurn(){
|
||||
Debug.LogWarning("OnTurn() not overridden");
|
||||
}
|
||||
|
||||
public override void Die() {
|
||||
messageBar.Write("Killed: " + Name, Color.red);
|
||||
Destroy(gameObject);
|
||||
}
|
||||
}
|
|
@ -4,6 +4,12 @@ using UnityEngine;
|
|||
|
||||
public class EntityMonsterSlime : EntityMonster
|
||||
{
|
||||
public override string Name {
|
||||
get {
|
||||
return "Slime";
|
||||
}
|
||||
}
|
||||
|
||||
public float moveChance = 0.5f;
|
||||
public float visionRange = 4;
|
||||
protected EntityPlayer player;
|
||||
|
|
Loading…
Reference in a new issue