Пример #1
0
	void Init()
	{
		// GameStatus 초기화
		GameStatus = START;

		// Computer의 정답 설정
		SetAnswer();

		// 목숨 설정
		Player.life = 10;

		// strike, ball 개수 설정
		strike = 0;
		ball = 0;

		// InputBox 초기화
		for (int i = 0; i < 3; i++)
		{
			InBox[i].num = -1;
			InBox[i].X = 10 + (4*i);
			InBox[i].Y = 9;
		}
	
		// 시작 문구 초기화 -> StatusPrint()로 이동
		
	}
void UBTTask_WaitAnswer::SetAnswer(UDialogueButton* DialogueButton)
{
	if (DialogueButton != nullptr && DialogueButton->GetChildrenCount() > 0)
	{
		UTextBlock* TextBlock = Cast<UTextBlock>(DialogueButton->GetChildAt(0));
		if (TextBlock)
		{
			SetAnswer(TextBlock->GetText());
		}
	}
}
Пример #3
0
	void StatusPrint() // GameStatus에 따른 화면 출력 및 상태 변화
	{
		clock_t CurTime = clock(); // 현재 시각

		switch (GameStatus)
		{
		case START:
			// 시작 문구 초기화
			sprintf(statPrint,
				"숫 자 야 구\n\n"
				"지금부터 숫자야구를 시작하겠습니다.\n\n"
				"게임 규칙\n\n"
				"정해진 세 자리 수를 맞추는 게임입니다.\n정해진 수를 예측하고 세 자리 수를 입력하면,\n"
				"숫자와 자리가 맞을 경우 스트라이크\n"
				"숫자는 맞는데 자리가 틀릴 경우 볼입니다.\n"
				"ex) 정답 123, 입력한 값 132 -> 1 스트라이크 2볼\n\n"
				"입력방법 : 숫자를 하나씩 입력하며, 전부 입력한 후엔 [Enter]를 누릅니다.\n\n"
				"[Space Bar]키를 누르면 시작합니다.");

			// 출력
			ScreenPrint(10, 2, statPrint);
			break;

		case INIT:
			// 게임 초기화 (void Init()에서 따왔음)

			// Computer의 정답 설정
			SetAnswer();

			// 목숨 설정
			Player.life = 10;

			// strike, ball 개수 설정
			strike = 0;
			ball = 0;

			// InputBox 초기화
			for (int i = 0; i < 3; i++)
			{
				InBox[i].num = -1;
				InBox[i].X = 10 + (4 * i);
				InBox[i].Y = 9;
			}

			// 추측 문구 초기화
			sprintf(gueAftPrint, "%d 스트라이크, %d 볼, 남은 목숨 : %d", strike, ball, Player.life);

			// 화면출력
			if (CurTime - stat_OldTime < 3 * 1000) // 3초 동안 출력
			{
				sprintf(statPrint, "[컴퓨터 숫자 세팅 중]");
				ScreenPrint(25, 8, statPrint);
			}
			else
			{
				GameStatus = RUNNING; // 3초 출력 후, 게임 시작.
				stat_OldTime = CurTime; // 마지막 실행 시각 = 현재 시각
			}

			break;

		case RUNNING:
			break;

		case FINISH:
			break;

		default:
			break;
		}
	}