Skip to content

Instantly share code, notes, and snippets.

@kovek
Created Apr 14, 2013
Embed
What would you like to do?
// BaseObj.cs
using UnityEngine;
using System.Collections;
public class BaseObj : MonoBehaviour {
public TextMesh template;
public float health;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
}
public interface IInteractive{
void clicked();
}
// Building.sc
using UnityEngine;
using System.Collections;
public class Building : BaseObj, IInteractive {
private float money;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
public void clicked(){
HUDisplay.displayInfo( this );
}
}
// HUDisplay.cs
using UnityEngine;
using System.Collections;
public class HUDisplay : MonoBehaviour {
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
public void displayInfo(BaseObj theObject){
Debug.Log (theObject.health);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment