티거쌤 유니티 14강

14강
using UnityEngine;
using System.Collections;
using UnityEngine.UI;

public class ItemGet : MonoBehaviour {


    public Text _scoreText;
    //따로 관리하는 메모리에 저장하는 변수타입 공유 메모리 = static
    public static int _scoreNum = 0;

 // Use this for initialization
 void Start () {
      // 태그로 게임오브젝트 찾을때 
      // 태그 그룹으로 찾을대는 GameObject.FindGameObjectsWithTag("score") s 붙여준다.
      _scoreText = GameObject.FindGameObjectWithTag("score").GetComponent<Text>();
 }
 
 // Update is called once per frame
 void Update () {
 }

    // 마우스를 누르고 놓았을때 발동
    void OnMouseUpAsButton()
    {
        /*
        ItemGet._scoreNum++;
        _scoreText.text = ItemGet._scoreNum.ToString();    
         */
        int count = int.Parse(_scoreText.text);
        _scoreNum++;
        _scoreText.text = _scoreNum.ToString();
        Destroy(gameObject);
     }
    
    /*
    void OnMouseDown()
    {
        Destroy(gameObject);
        scoreNum++;
        scoreText.text = scoreNum.ToString();     
    }
     */
}


=================================================================

씬과 씬으로 이동시 스태틱 메모리 접근하여 겂 넘겨주기

using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class CShowCount : MonoBehaviour {

    public Text itmeCount;
    public void OnShowCountBtn()    {
        itmeCount.text = ItemGet._scoreNum.ToString();
        Debug.Log("BtnClick");
    }
}

=================================================================
String Class

[foreach 문]=========================================================
   int[] numb = { 1, 2, 3, 4, 5 };
        // 배열의 모든 인덱스를 돌면서 값을 호출
        //foreach (자료형 변수 in 배열 )        
          foreach ( int n in numb){
            Debug.Log(n.ToString());
        }============================================================
UML 생성 프로그램( 클래스 구조 차트 만들기 )
http://staruml.io/download =

HEAD FIRST SQL - SQL 책 추천. 읽어 볼것.

게임 디자인 레벨업 가이드 - 책 추천 .

게임 디자인 워크숍

















댓글

이 블로그의 인기 게시물

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

코루틴에서 CallBack 함수 적용하기

C++ 언어 퍼센트 구하는 방법 / 기본 언어 퍼센트 구하는 방법