// Update is called once per frame void Update() { if (!finishesBubbleCreate) { if (!isBubbleCreate) { if (inputProvider.isLeftMouseButtonDown) { CreateBubble(); sePlayer.PlaySE("Expand"); isBubbleCreate = true; } } else { nowSize += expandSpeed * Time.deltaTime; bubbleTrans.position += Vector3.right * (expandRightMoveSpeed * Time.deltaTime); if (nowSize >= maxSize) { nowSize = maxSize; finishesBubbleCreate = true; } bubbleTrans.localScale = new Vector3(nowSize, nowSize, 1); if (inputProvider.isLeftMouseButtonUp) { finishesBubbleCreate = true; } } } else { if (!onceBubbleStart) { float bubbleMass = CalcSizeToMass(); bubbleMover.StartMove(releasePower, bubbleMass); sePlayer.PlaySE("Release"); onceBubbleStart = true; } } }
// Update is called once per frame void Update() { if (startsMove) { if (inputProvider.isLeftMouseButtonDown) { Vector2 dir = ((Vector2)bubbleTrans.position - inputProvider.mousePos).normalized; sePlayer.PlaySE("Move"); windCreater.CreateWind(inputProvider.mousePos, dir); MoveBubble(dir, movePower * 100); } } }
/// <summary> /// Play 2D SoundEffect. /// </summary> /// <param name="path">Resources in File path</param> public void PlaySE(string path) { AudioClip clip = ClipLoad(path); if (clip != null) { sePlayer.PlaySE(clip); } }
// Update is called once per frame void Update() { if (Input.GetButtonDown("LeftMouseClick")) { Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit2D hit2d = Physics2D.Raycast((Vector2)ray.origin, (Vector2)ray.direction); if (hit2d && hit2d.collider.gameObject.tag == "Bubble") { GameObject bubble = hit2d.transform.gameObject; bubble.GetComponent <ObjVanisher>().Vanish(); sePlayer.PlaySE("BubbleVanish"); } } }
private void OnTriggerEnter2D(Collider2D collision) { if (!bubbleCore.isHit) { if (collision.gameObject.tag == "Trap") { simpleAnimation.Play("Break"); sePlayer.PlaySE("Break"); bubbleCore.isHit = true; } if (collision.gameObject.tag == "Goal") { bubbleCore.isGoal = true; } } }
/// <summary>[LateUpdate]</summary> void LateUpdate() { bool found = IsHitVisibility(); //見つけとったら音を流す if (((found ^ m_isOldFound) & found) != false && m_sePlayer != null) { if (m_isStopWhenPlayingSE) { m_sePlayer.StopAll(); } m_sePlayer.PlaySE(m_indexOfSE, m_isLoopSE); } //フラグ初期化 m_isOldFound = m_isResult; m_isNowFrameCompleted = false; }
//================================================================================================ // モデル回転・拡縮、アニメーション変更、フェードイン処理 //================================================================================================ // Update is called once per frame void Update() { //================================================================================================ // 回転フラグ、フェードインフラグ処理 //================================================================================================ // Dを押したとき if (Input.GetKeyDown(KeyCode.LeftArrow)) { // 右回転フラグと左回転フラグがFALSEのときだけTRUEにする if (m_Right_RotateFlag == false && m_Left_RotateFlag == false) { m_Right_RotateFlag = true; // 右回転のフラグをtrueにする m_SE.VolumeSE(0.8f); if (m_Fade_flag_2.m_FadeFlag == 0) { m_SE.PlaySE("select/selector_swap"); } } } // Aを押したとき else if (Input.GetKeyDown(KeyCode.RightArrow)) { // 右回転フラグと左回転フラグがFALSEのときだけTRUEにする if (m_Left_RotateFlag == false && m_Right_RotateFlag == false) { m_Left_RotateFlag = true; // 左回転のフラグをtrueにする m_SE.VolumeSE(0.8f); if (m_Fade_flag_2.m_FadeFlag == 0) { m_SE.PlaySE("select/selector_swap"); } } } // Spaceが押されたら遷移 if (Input.GetKeyDown(KeyCode.Space) && m_Fade_flag_2.m_FadeFlag <= 2) // フェードアウトしているか { m_SceneFlag = true; m_Fade_flag_2.m_FadeFlag = 2; } // Shiftが押されたら遷移 if (Input.GetKeyDown(KeyCode.RightShift) && // シフトが押されたか m_Fade_flag_2.m_FadeFlag == 0 && // フェードアウトしているか m_Right_RotateFlag == false && // 右回転しているか m_Left_RotateFlag == false) // 左回転しているか { // フェードインのフラグを1に変更 m_Fade_flag_2.m_FadeFlag = 1; m_SE.PlaySE("select/selector_select"); } else if (Input.GetKeyDown(KeyCode.RightShift) && m_Fade_flag_2.m_FadeFlag == 1) { // シーン変更フラグをtrueにしてフェードインのフラグを2に変更 m_SE.VolumeSE(0.1f); m_SE.PlaySE("select/decisioner_dicision"); m_SceneFlag = true; m_Fade_flag_2.m_FadeFlag = 2; } else if (Input.GetKeyDown(KeyCode.RightControl) && m_Fade_flag_2.m_FadeFlag == 1) { m_SE.VolumeSE(0.2f); m_SE.PlaySE("select/decisioner_cancel"); // フェードインのフラグを3に変更 m_Fade_flag_2.m_FadeFlag = 3; } //================================================================================================ // 回転フラグ、フェードインフラグ処理 //================================================================================================ // LSを右に倒した if (Input.GetAxis(InputXBOX360.P4_XBOX_LEFT_ANALOG_X) >= 1.0f && m_Control == false) { // 右回転フラグと左回転フラグがFALSEのときだけTRUEにする if (m_Right_RotateFlag == false && m_Left_RotateFlag == false) { m_Left_RotateFlag = true; // 右回転のフラグをtrueにする m_SE.VolumeSE(0.8f); if (m_Fade_flag_2.m_FadeFlag == 0) { m_SE.PlaySE("select/selector_swap"); } } m_Control = true; } // LSを左に倒した else if (Input.GetAxis(InputXBOX360.P4_XBOX_LEFT_ANALOG_X) <= -1.0f && m_Control == false) { // 右回転フラグと左回転フラグがFALSEのときだけTRUEにする if (m_Left_RotateFlag == false && m_Right_RotateFlag == false) { m_Right_RotateFlag = true; // 左回転のフラグをtrueにする m_SE.VolumeSE(0.8f); if (m_Fade_flag_2.m_FadeFlag == 0) { m_SE.PlaySE("select/selector_swap"); } m_Control = true; } } else if (Input.GetAxis(InputXBOX360.P4_XBOX_LEFT_ANALOG_X) >= -0.3f && Input.GetAxis(InputXBOX360.P4_XBOX_LEFT_ANALOG_X) <= 0.3f) { if (m_Left_RotateFlag == false && m_Right_RotateFlag == false) { m_Control = false; } } // Aが押されたら if (Input.GetKeyDown(InputXBOX360.P4_XBOX_A) && m_Fade_flag_2.m_FadeFlag == 0 && // フェードアウトしているか m_Right_RotateFlag == false && // 右回転しているか m_Left_RotateFlag == false) // 左回転しているか { // フェードインのフラグを1に変更 m_Fade_flag_2.m_FadeFlag = 1; m_SE.PlaySE("select/selector_select"); } else if (Input.GetKeyDown(InputXBOX360.P3_XBOX_A) && m_Fade_flag_2.m_FadeFlag == 1) { m_SE.VolumeSE(0.1f); m_SE.PlaySE("select/decisioner_dicision"); // シーン変更フラグをtrueにしてフェードインのフラグを2に変更 m_SceneFlag = true; m_Fade_flag_2.m_FadeFlag = 2; } // Bが押されたら else if (Input.GetKeyDown(InputXBOX360.P3_XBOX_B) && m_Fade_flag_2.m_FadeFlag == 1) { m_SE.VolumeSE(0.2f); m_SE.PlaySE("select/decisioner_cancel"); // フェードインのフラグを3に変更 m_Fade_flag_2.m_FadeFlag = 3; } //================================================================================================ // 回転処理 //================================================================================================ //フェードインフラグが1の時(チーム再確認中)ではない時回転し、再確認中は回転フラグを常にfalseにする if (m_Fade_flag_2.m_FadeFlag == 0) { // 右回転処理 Right_Rotate(); // 左回転処理 Left_Rotate(); } else { m_Right_RotateFlag = false; m_Left_RotateFlag = false; } //================================================================================================ // チーム決定後のラベル変更処理 //================================================================================================ // 自チームと相手チームのフェードインフラグが2の時 if (m_Fade_flag_1.m_FadeFlag == 2 && m_Fade_flag_2.m_FadeFlag == 2) { m_Label.text = "ゲームを開始します!"; } else { m_Label.text = "対戦相手がチームを選択しています\nしばらくお待ち下さい…"; } }
/// <summary> /// [AIUpdate] /// Updateフレームに呼ばれるコールバック関数, EndAIFunctionを呼び出す場合引数1が必要 /// 引数1: 更新識別子 /// </summary> public override void AIUpdate(UpdateIdentifier updateIdentifier) { //万が一の無効条件 if (m_markPoint == null) { EndAIFunction(updateIdentifier); return; } else if (m_markPoint.isLinked & m_markPoint.isPauseTimer) { EndAIFunction(updateIdentifier); return; } //state switch switch (functionState) { //突進 case State.Rushing: { //半径でOverlapを行う var hitCollisions = Physics.OverlapSphere(transform.position, m_rushingArrivalDistance, m_markPointLayerMask); //指定ポイントがヒットしているか確認 for (int i = 0, length = hitCollisions.Length; i < length; ++i) { //指定ポイントと合致 if (hitCollisions[i].gameObject.GetInstanceID() == m_markPoint.gameObject.GetInstanceID()) { //移動, 回転停止 navMeshAgent.isStopped = true; dogAIAgent.speedChanger.SetManualAcceleration(0.0f); //回転を決める Vector3 absolute = m_markPointPosition - transform.position; absolute.y = 0.0f; m_targetRotation = Quaternion.LookRotation(absolute.normalized) * Quaternion.AngleAxis(-90, Vector3.up); //Stateを進める functionState = State.Rotation; //Animation Set m_animationController.editAnimation.SetTriggerMarking(); //Timer再スタート timer.Start(); break; } } break; } //回転 case State.Rotation: { //指定時間経過でステートを進める if (timer.elapasedTime >= m_rotationSeconds) { m_sePlayer.PlaySE(m_markingSEIndex, true); m_markingEffect.SetActive(true); functionState = State.Marking; timer.Start(); } //回転 transform.rotation = Quaternion.Slerp(transform.rotation, m_targetRotation, m_rotationSpeed * Time.deltaTime); break; } //マーキング実行 case State.Marking: { //指定時間経過 if (timer.elapasedTime >= m_markingSeconds) { //ポイントをリンクさせる m_markPoint.LinkPlayer(dogAIAgent.linkPlayer, dogAIAgent); //待て! dogAIAgent.SetSitAndStay(true, m_markPoint); //Animation Set m_animationController.editAnimation.SetTriggerSleepStart(); //終了 EndAIFunction(updateIdentifier); } break; } default: break; } }
// Update is called once per frame void Update() { switch (gameState) { case GameState.START: if (!startsPlay) { startTimeline.PlayTimeline(); startsPlay = true; } if (startTimeline.isFinish) { gameState = GameState.CREATE; } break; case GameState.CREATE: inputProvider.MainInput(); if (bubbleCreater.finishesBubbleCreate) { gameState = GameState.MAIN; } break; case GameState.MAIN: inputProvider.MainInput(); if (!uchiwaObj.activeSelf) { uchiwaObj.SetActive(true); } if (bubbleManager.bubbleCore.isHit) { scoreManager.isGameClear = false; bubbleManager.StopBubble(); ScoreSave(); gameState = GameState.FINISH; } if (bubbleManager.bubbleCore.isGoal) { scoreManager.isGameClear = true; sePlayer.PlaySE("Goal"); ScoreSave(); gameState = GameState.FINISH; } break; case GameState.FINISH: if (!startsScore) { scoreTimeline.PlayTimeline(); startsScore = true; } if (!isSkipScore && inputProvider.GetSkipButtonDown() && scoreTimeline.timelineTime() < scoreSkipTime) { scoreTimeline.SkipTimeline(scoreSkipTime); isSkipScore = true; } if (scoreTimeline.isFinish) { sceneLoader.Load("Title"); } break; } }