2014/1/5 에 유니티 보다가 적은 건데, 별 내용 아니니까 삭제 해야 하나. 흠. ====== CoRoutine에 람다 표현식 응용 ====== Unity3D의 CoRoutine을 사용할 때, 람다함수로 간단한 코드 몇줄은 바로 포함시켜서 실행 하도록. * 링크 : [[http://www.blockypixel.com/2012/09/c-in-unity3d-dynamic-methods-with-lambda-expressions/|C# in Unity3D – Dynamic Methods with Lambda Expressions]] private IEnumerator waitThenCallback(float time, Action callback) { yield return new WaitForSeconds(time); callback(); } void Start() { splashScreen.show(); StartCoroutine( waitThenCallback( 5, () => { Debug.Log("Five seconds have passed!"); } )); StartCoroutine( waitThenCallback( 10, () => { Debug.Log("Ten seconds have passed!"); } )); StartCoroutine( waitThenCallback( 20, () => { Debug.Log("Twenty seconds have passed!"); splashScreen.hide(); } )); } ====== LeanTween의 Action 함수 ====== * 완료(onComplete), 업데이트(OnUpdate)류의 이벤트 실행시 코드가 몇줄 안되는데 별도 함수를 작성하기 싫고, * 코드 한줄로 끝내고 싶을때 LeanTween에는 System.Action() 델리게이트 함수를 파라미터로 받아 주기 때문에, 아래 코드처럼 짧게 작성할 수 있다. * [[http://msdn.microsoft.com/ko-kr/library/018hxwa8.aspx|Action 대리자]] 함수 추가하기 귀찮을때 굿. LeanTween.value( gameObject, delegate( float v_ ) { mUISprite.alpha = v_; }, 0, 1, 1f );