// 食事の挙動 private void UpdateMeal() { if (mocha_behavior_info.IsMove == true) { float MoveDirection = mocha_behavior_info.MoveDirection / 20.0f; UtillityMethod.PlanetRotate(this.gameObject, MoveDirection); mocha_behavior_info.MoveNowTime += Time.deltaTime; if (mocha_behavior_info.MoveNowTime >= mocha_behavior_info.MoveMaxTime) { mocha_behavior_info.IsMove = false; my_animator.SetBool("IsWalkMove", false); } } else { mocha_behavior_info.StateNowTime += Time.deltaTime; if (mocha_behavior_info.StateNowTime >= mocha_behavior_info.StateMaxTime) { this.mocha_parameter.m_State = mocha_manager.MochaNextState(this.my_object); } this.mocha_parameter.m_Stamina = (int)mocha_behavior_info.StateNowTime; } }
// Update is called once per frame void Update() { // タイトルシーンでの処理 if (DataBank.GetCurrScene() == Scene.TITLE) { UtillityMethod.PlanetRotate(this.gameObject, -gameData.MAP_SPEED * Time.deltaTime); } // ゲームシーンでの処理 else { UtillityMethod.PlanetRotate(this.gameObject, gameData.speed); if (UtillityMethod.GetMessage(Message.RESPOWN)) { transform.position = new Vector3(0, 10, -10); transform.rotation = new Quaternion(0, 0, 0, 0); } himoController.CreateHimo(gameObject); DestroyChild("TitleEnd"); // イベント処理(くしゃみ) if (EventDirector.can_achoo_event) { EventDirector.StartAchooEvent(gameObject); } } }
// 移動の挙動 private void UpdateEmigrate() { float MoveDirection = mocha_behavior_info.MoveDirection / 20.0f; UtillityMethod.PlanetRotate(this.gameObject, MoveDirection); mocha_behavior_info.MoveNowTime += Time.deltaTime; if (mocha_behavior_info.MoveNowTime >= mocha_behavior_info.MoveMaxTime) { this.mocha_parameter.m_State = mocha_manager.MochaNextState(this.my_object); } }
// 休憩の挙動 private void UpdateBreak() { mocha_behavior_info.MoveNowTime += Time.deltaTime; if (mocha_behavior_info.MoveNowTime >= mocha_behavior_info.MoveMaxTime) { StartBreak(); } float MoveDirection = mocha_behavior_info.MoveDirection / 20.0f; UtillityMethod.PlanetRotate(this.gameObject, MoveDirection); mocha_behavior_info.StateNowTime += Time.deltaTime; if (mocha_behavior_info.StateNowTime >= mocha_behavior_info.StateMaxTime) { //this.mocha_parameter.m_State = MochaState.BREAK; this.mocha_parameter.m_State = mocha_manager.MochaNextState(this.my_object); } }
void CreateObject() { // オブジェクト取得 GameObject get_obj; float obj_angle = 0.0f; const float ANGLE = 15.0f; // 最大スロット数分 for (int i = 0; i < MAX_OBJECT_SLOT_NUM; i++) { Vector3 pos = new Vector3(32 * i, 0, 0); Vector3 axis = new Vector3(32 * i, 0, 0); float angle = Time.deltaTime; transform.RotateAround(pos, axis, angle); // 惑星回転 UtillityMethod.PlanetRotate(this.gameObject, ANGLE); // アングル加算 obj_angle += ANGLE; // 入っていないならもう一度 if (m_planet_slot_list[i].p_obj == null) { continue; } Quaternion rot = Quaternion.identity; rot.eulerAngles = new Vector3(0.0f, 0.0f, obj_angle); // 生成 get_obj = Instantiate(m_planet_slot_list[i].p_obj, transform.position, rot); // 全体配列に代入 //m_planet_slot_list[i].p_obj = get_obj; // コピー用スロット作成 Slot slot; slot = m_planet_slot_list[i]; // 生成名から生成物を取得 slot.p_obj = GameObject.Find(get_obj.name); // それぞれの配列に代入 switch (m_planet_slot_list[i].slot_element) { case SlotElement.ARCH: // リストに追加 m_arch_slot_list.Add(slot); break; case SlotElement.PLANT: // リストに追加 m_plant_slot_list.Add(slot); break; case SlotElement.FOOD: // リストに追加 //m_food_slot_list.Add(slot); break; } // 固定用スロットにも生成物追加 m_planet_slot_list[i].p_obj = slot.p_obj; } }