// Start is called before the first frame update void Awake() { //キャラ状態 p_status = GameObject.Find("player_status").GetComponent <charStatus>(); e_status = GameObject.Find("enemy_status").GetComponent <charStatus>(); //開始時の残りターン表示 Turntext = GetComponent <Text>(); Turntext.text = "残りターン数:" + Turn; //ログテキストのテキストスクリプト取得 GameObject logText = GameObject.Find("logText"); log_text = logText.GetComponent <backLog>(); //ゲームオーバーシーン移動 var gameover_panel = GameObject.Find("ButtleEnd_panel"); _gameover = gameover_panel.GetComponent <ButtleEnd>(); //スキル使用可能にする var panel = GameObject.Find("playerComandManager"); SAManager = panel.GetComponent <skillActiveManager>(); }
IEnumerator action() { float timeDelay = 0; while (true) { time++; if (myStatus == charStatus.Study) { Debug.Log("공부를 합니다."); hungry++; thirsty++; tired++; timeDelay = 2; } else if (myStatus == charStatus.Drink) { Debug.Log("물을 마십니다."); thirsty = 0; timeDelay = 0.2f; } else if (myStatus == charStatus.Eat) { Debug.Log("식사를 합니다."); hungry = 0; thirsty = 0; timeDelay = 1; } else if (myStatus == charStatus.Rest) { Debug.Log("잠시 쉽니다."); tired -= 3; timeDelay = 0.5f; } else if (myStatus == charStatus.Sleep) { Debug.Log("잠을 잡니다."); tired = 0; hungry++; thirsty++; time = 0; timeDelay = 3; } if (time > 20) { myStatus = charStatus.Sleep; } else if (tired > 5) { myStatus = charStatus.Rest; } else if (hungry > 7) { myStatus = charStatus.Eat; } else if (thirsty > 4) { myStatus = charStatus.Drink; } else { myStatus = charStatus.Study; } yield return(new WaitForSeconds(timeDelay)); } }