using UnityEngine;
using System.Collections;
public class NameCard{
private int age;
private string name;
public int Age
{
get{return age;}
set{ age = value;}
}
public string Name
{
get{return name;}
set{ name = value;}
}
}
public class test : MonoBehaviour {
// Use this for initialization
void Start () {
NameCard MyCard = new NameCard();
MyCard.Age = 24;
MyCard.Name = "SUNG SUCK";
print(string.Format("age : {0}", MyCard.Age));
print(string.Format("name : {0}", MyCard.Name));
}
// Update is called once per frame
void Update () {
}
}
using UnityEngine;
using System.Collections;
public class test2 : MonoBehaviour {
// Use this for initialization
void Start () {
var nameCard = new { Name="hamgwangho", Age=123} ;
print (string.Format("Name:{0}, Age:{1}", nameCard.Name, nameCard.Age));
var complex = new { Real = 3, Imaginary = -12} ;
print (string.Format("Real:{0}, Imaginary:{1}", complex.Real, complex.Imaginary));
}
// Update is called once per frame
void Update () {
}
}
'Computer Language > 유니티' 카테고리의 다른 글
로그 찍기 (0) | 2014.05.23 |
---|---|
오브젝트 찾고 지우기 1. 태그 2. 이름 (0) | 2014.05.23 |
남은 시간 출력 하기. 그외 시간 함수 (0) | 2014.05.20 |
프로퍼티 (0) | 2014.05.20 |
해쉬 테이블 DictionaryEntry 사용 예제 (0) | 2014.05.20 |