Stateマシーン

「Stateマシーン」の編集履歴(バックアップ)一覧に戻る

Stateマシーン - (2015/06/21 (日) 10:10:54) の編集履歴(バックアップ)


void Update () {
if (state==0)
{
	clearFloor();
	floorNo++;
	GameObject.Find("Status").GetComponent<TextMesh>().text = "";
	GameObject.Find("Info").GetComponent<TextMesh>().text = "  Floor "+(floorNo);
	GameObject.Find("Info2").GetComponent<TextMesh>().text = "Hit Any Key";
	state=1;
	MapRoot.SetActive(false);
}
else if(state==1)
{
	if( Input.anyKeyDown )
	{
		newFloor();
		GameObject.Find("Info").GetComponent<TextMesh>().text = "";
		GameObject.Find("Info2").GetComponent<TextMesh>().text = "";
		state=2;
		MapRoot.SetActive(true);
	}
}
else if (state==2)
{
	timer--;
	string temp="Floor"+floorNo+" Hp"+hp+" Score"+score+" Timer"+timer+"\n\n\n\n";
	GameObject.Find("Status").GetComponent<TextMesh>().text = temp;
	if(checkTresure())
	{
		isTresure=true;
		Vector2 pos=new Vector2( 9*3-1.5f, 4*3+1.5f);
		dropSprite3(door[1],pos.x,pos.y,"Tresure");
	}
}
else if (state==99)
{
	myItems="";showItems();
	clearFloor();
	floorNo=1;
	GameObject.Find("Status").GetComponent<TextMesh>().text = "";
	GameObject.Find("Info").GetComponent<TextMesh>().text = "GAME OVER";
	GameObject.Find("Info2").GetComponent<TextMesh>().text = "Hit Any Key";
	state=1;
	MapRoot.SetActive(false);
}
}