1월, 2016의 게시물 표시

날짜 시간 시간차 시간 계산 하기

System. DateTime  StartDate = System. Convert .ToDateTime( "2012/05/07 08:00" );  // 시작시간 System. DateTime  EndDate = System. Convert .ToDateTime( "2012/05/10 10:20" );  // 현재시간( 완료 시간 ) System. TimeSpan  timeCal = EndDate - StartDate;  // 시간차 계산 int  timeCalDay = timeCal.Days; //날짜 차이 int  timeCalHour = timeCal.Hours;  //시간차이 int  timeCalMinute = timeCal.Minutes; // 분 차이 Debug .Log(timeCalDay); Debug .Log(timeCalHour); Debug .Log(timeCalMinute); System. DateTime  time = System. DateTime .Now; Debug .Log(time.ToString( "hh:mm tt" ));  // 시간 / 분 / 오전오후 Debug .Log(time.ToString( "MM/dd/yyyy" ));  // 월 시간 코드 샘플 http://www.csharp-examples.net/string-format-datetime/ //경과 시간 계산 string  currentTime;     string  calTime;     string  startTime;     void  TimeCal()    {        currentTime = System. DateTime .Now.ToString( "h:mm:ss.ff" );        System. DateTime  start = System. Convert .ToDateTime(startTime);      

스크립터블 오브젝트 설명

http://m.blog.naver.com/tobik/220252078732

shader

Shader "Diffuse_Shader01" { Properties // 변수들 { _Color ("Main My Color", Color) = (1,1,1,1) // => 변수명 ("이름", 속성) = (값) _MainTex ("Base (RGB)", 2D) = "white" {} _SubTex ("Sub (RGB)", 2D) = "white" {} _BumpTex ("Normal" , 2D) = "bump"{} _f("Value",float) = 1 _RimColor("RimColor", Color) = (1,1,1,1) _RimPower("RimColor", float) = 3.0 } SubShader { Tags { "RenderType"="Opaque" } // 렌더링 되는 순서 LOD 200 CGPROGRAM // 쉐이더 코드 시작 #pragma surface surf Lambert // => #pragma 쉐이더가 어떤 것인지 정의 ( surface 는 픽셀 세이더 Lambert 버텍스 단위로 라이팅 ) sampler2D _MainTex; //자료형 변수 선언 sampler2D _SubTex; // 텍스쳐 추가 sampler2D _BumpTex; // 범프 텍스쳐 추가 float4 _RimColor;         float _RimPower; fixed4 _Color;      //자료형 변수 선언 float4(32bit), half4(16bit), fixed4(8bit) = 모바일에서는 half4만 사용된다. 주로 half4 사용하면 됨

델리게이트 연습 소스

using UnityEngine; using System.Collections; delegate void EventHandler( Color color ); class OrcParams { public event EventHandler OnColorChange; int _hp = 100;   public int hp{ get { return _hp; } set{ _hp = value; if (_hp < 50) OnColorChange (Color.red); } } } public class test : MonoBehaviour { GameObject ttt; void ChangeColor(Color color) { gameObject.GetComponent<MeshRenderer>().material.color = color; } void ShowColorValue (Color color){ Debug.Log (color); } OrcParams MyParam; void Start () { MyParam = new OrcParams(); MyParam.OnColorChange += ShowColorValue; MyParam.OnColorChange += ChangeColor; } void OnMouseDown() { MyParam.hp -= 10; //Debug.Log (MyParam.hp); } void Update () { } }

부모 오브젝트인지 아닌지 확인하기

if  ( Selection .gameObjects[0].transform.childCount == 0)        {             Debug .Log( "부모오브젝가 아닙니다" );        }         else        {             Debug .Log( "부모오브젝트 입니다" );        }