안녕하세요. @tcban입니다.
설 연휴로
게임 작업은 머릿속에서만 하고
구현을 지금에서야 하네요.
지금까지 누적 작업시간 : 총 2시간 (반성합니다..)
혼자 게임 만들면 정리하느라 어질어질하옵니다.. 왜냐고요?
사실 기획서가 마무리 안되었기 때문이죠.
그래서 기획서 없이는 키보드 치지 말자고 다짐해도
머릿속에 있는 그림으로 한 번 해보려는 습관이 발동했어요.
(일종의 방황? 반항 그런 거 같아요)
게임제작 정식 일지로 기록하고 싶지는 않지만
책상 위 스탠드 불빛이 예뻐요.
괜히 감성수치 올라와 기록해봅니다.
using System.Collections;
using System.Collections.Generic;
using UnityEngine.UI;
using UnityEngine;`
//함수
public class questionBox : MonoBehaviour {
public static questionBox instace; //싱글톤 선언
public int[] questionBoxArray; //첫번째 배열 - 인스펙터에서 10으로 설정
public List<Sprite> questionImages = new List<Sprite>(); //카드 이미지 배열
// 싱글톤 호출
void Awake()
{
if (questionBox.instace == null)
questionBox.instace = this;
}
// 첫번째 카드 생성 -> 불러오기
void firstQBoxDisplay ()
{
firstBoxCheckSum = 0;
for (int i=0; i<questionBoxArray.Length; i++)
{
questionBoxArray[i] = Random.Range(1, questionBoxArray.Lengt+1);
// 랜덤으로 뽑은 함수에 이미지 대입하기, ShapeManager 별도)
if (questionBoxArray[i] == 1)
{
int randomImageNum = Random.Range(0, shapeManager.instace.randomimages.Length);
shapeManager.instace.firstBoxImages[i].sprite = shapeManager.instace.randomimages[randomImageNum];
}
else
{
shapeManager.instace.firstBoxImages[i].sprite = null;
}
}
checkTheFirstQBox();
}
// Use this for initialization
void Start () {
firstQBoxDisplay();
checkTheFirstQBox();
}
void Update () {
}
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine.UI;
using UnityEngine;
public class shapeManager : MonoBehaviour {
public static shapeManager instace;
public Sprite [] randomimages;
public Image[] firstBoxImages;
void Awake()
{
if (shapeManager.instace == null) shapeManager.instace = this;
}
void Start () {
}
void Update () {
}
}
public void randomNumberCheck()
{
int tmp1;
int tmp2;
//ES2는 내부 데이터 베이스 Asset
if (!ES2.Exists ("chatInt")) {
//카드 하나를 뽑는다
tmp1 = Random.Range (0, _stringTemp.Count);
//뽑은 번호를 저장한다
ES2.Save (tmp1, "chatInt");
//랜덤으로 뽑은 카드를 뿌린다
_charText.text = _stringTemp [tmp1];
} else {
//랜덤으로 번호를 뽑는다
tmp2 = Random.Range (0, _stringTemp.Count);
//이미 뽑은 번호를 가져온다
tmp1 = ES2.Load<int> ("chatInt");
// 둘 이 같 으 면
while (tmp1 == tmp2) {
// 한 번 더 뽑는다
tmp2 = Random.Range (0, _stringTemp.Count);
// 그리고 같지 않으면 끝낸 다
if (!(tmp1 == tmp2)) {
break;
}
}
// 같 지 않은 새 로 생긴 번호의 스트링을 출력 한 다
_charText.text = _stringTemp [tmp2];
// 새로 뽑은 번호를 과거 스트링 셋으로 저장한다.
ES2.Save (tmp2, "chatInt");
}
}