'잡다한것들전부'에 해당되는 글 207건

  1. 2014.01.01 유니티 최적화팁 transform 사용시
  2. 2013.12.31 유니티 공식 사이트 데모 프로젝트
  3. 2013.12.30 c# delegate
  4. 2013.12.30 뒤로가기 버튼 클릭시 종료 팝업후 종료 하기
  5. 2013.12.30 c# 제네릭
  6. 2013.12.30 INSTALL_FAILED_INSUFFICIENT_STORAGE 오류시
  7. 2013.12.29 RacaseHit 사용시 디버그
  8. 2013.12.29 유니티 오브젝트 풀 기법
  9. 2013.12.24 string::find와 string::npos 관계
  10. 2013.12.23 sd 카드 접근

유니티 최적화팁 transform 사용시

|

Transform 을 사용하는 예가 있는데 최적화 방법중에 
js 기준으로 

var myTransform : Transform; 
function Awake() { 
  myTransform = transform; 

function Update() { 
  myTransform.position.y++; 

이런식으로 참조해서 쓰면 성능향상에 좋다고합니다. Transform 형을 사용한 예입니다.

Trackback 0 And Comment 0

유니티 공식 사이트 데모 프로젝트

|

http://unity3d.com/gallery/demos/demo-projects

Trackback 0 And Comment 0

c# delegate

|


// Declare delegate -- defines required signature:
delegate double MathAction(double num);

class DelegateTest
{
    // Regular method that matches signature:
    static double Double(double input)
    {
        return input * 2;
    }

    static void Main()
    {
        // Instantiate delegate with named method:
        MathAction ma = Double;

        // Invoke delegate ma:
        double multByTwo = ma(4.5);
        Console.WriteLine("multByTwo: {0}", multByTwo);

        // Instantiate delegate with anonymous method:
        MathAction ma2 = delegate(double input)
        {
            return input * input;
        };

        double square = ma2(5);
        Console.WriteLine("square: {0}", square);

        // Instantiate delegate with lambda expression
        MathAction ma3 = s => s * s * s;
        double cube = ma3(4.375);

        Console.WriteLine("cube: {0}", cube);
    }
    // Output:
    // multByTwo: 9
    // square: 25
    // cube: 83.740234375
}


Trackback 0 And Comment 0

뒤로가기 버튼 클릭시 종료 팝업후 종료 하기

|
//add 131227 - 게임 종료시 팝업
private void exitGameDialog()
{
new AlertDialog.Builder(this.mActivity.get()) 
         .setIcon(android.R.drawable.ic_dialog_alert) 
         .setTitle("게임종료 팝업") // 제목부분 텍스트
         .setMessage("게임을 종료 하시겠습니까?") // 내용부분 텍스트
         .setPositiveButton("예",
         new DialogInterface.OnClickListener() 
         { 
             @Override 
             public void onClick( DialogInterface dialog, int which ) 
             { 
            //프로그램 종료
            android.os.Process.killProcess(android.os.Process.myPid());
             } 
         } 
         ).setNegativeButton("아니오", null ).show(); //취소버튼을 눌렀을때..
         
}


Trackback 0 And Comment 0

c# 제네릭

|

c++의 템플릿과 유사한 것

// Declare the generic class.
public class GenericList<T>
{
    void Add(T input) { }
}
class TestGenericList
{
    private class ExampleClass { }
    static void Main()
    {
        // Declare a list of type int.
        GenericList<int> list1 = new GenericList<int>();

        // Declare a list of type string.
        GenericList<string> list2 = new GenericList<string>();

        // Declare a list of type ExampleClass.
        GenericList<ExampleClass> list3 = new GenericList<ExampleClass>();
    }
}


Trackback 0 And Comment 0

INSTALL_FAILED_INSUFFICIENT_STORAGE 오류시

|

android:installLocation="preferExternal"

메모리 공간이 부족해서 나는 오류이므로

manifest 에 추가

Trackback 0 And Comment 0

RacaseHit 사용시 디버그

|

static function DrawRay (start : Vector3, dir : Vector3, color : Color = Color.white) : void

// 트랜스폼의 Z-축을 따라 앞에 위치로부터 10미터의 긴 그린 라인을 그립니다.
function Update () {
var forward : Vector3 = transform.TransformDirection(Vector3.forward) * 10;
Debug.DrawRay (transform.position, Vector3.forward * 10, Color.green);
}

예) 현재 위치 로부터 아래로 2미터예 있는지 없는지 판단할때

Debug.DrawRay(transform.position, Vector3.down * 2f, Color.green);

        if (Physics.Raycast(transform.position, Vector3.down, out hit, 2f))

        {


        }

Trackback 0 And Comment 0

유니티 오브젝트 풀 기법

|

http://dmayance.com/unity-paint-part-2/

Trackback 0 And Comment 0

string::find와 string::npos 관계

|

find로 찾는 단어나 문자열이 없으면 std::string::npos 반환




예)

jpg와 jpeg검색후 처리

 if ((std::string::npos != filename.find(".jpg")) || (std::string::npos != filename.find(".jpeg")))
    {
        ret = CCImage::kFmtJpg;
    }

'잡다한것들전부 > ' 카테고리의 다른 글

영어와 숫자만 가능하게 처리하기  (0) 2014.01.02
TextInputTest 예제 소스  (0) 2014.01.02
string::find와 string::npos 관계  (0) 2013.12.24
sd 카드 접근  (0) 2013.12.23
c 와 c++ 관련 자료  (0) 2013.12.19
오비비 테스트 apk  (0) 2013.12.18
Trackback 0 And Comment 0

sd 카드 접근

|


    //경로 설정 sdcard 접근 -> sdcard내용 읽어올수 있음
//     vector<string> searchPath;
//     char * path = "/mnt/sdcard/Android/obb/com.test.obb.hjh"; //sd카드 경로
//     searchPath.push_back(path);
//     CCFileUtils::sharedFileUtils()->setSearchPaths(searchPath);

'잡다한것들전부 > ' 카테고리의 다른 글

TextInputTest 예제 소스  (0) 2014.01.02
string::find와 string::npos 관계  (0) 2013.12.24
sd 카드 접근  (0) 2013.12.23
c 와 c++ 관련 자료  (0) 2013.12.19
오비비 테스트 apk  (0) 2013.12.18
중급 개발자가 되는 방법 5가지  (0) 2013.12.16
Trackback 0 And Comment 0