Skip to content

Instantly share code, notes, and snippets.

@kovek
Created April 14, 2013 02:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kovek/5381171 to your computer and use it in GitHub Desktop.
Save kovek/5381171 to your computer and use it in GitHub Desktop.
// 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