Exemple #1
0
    private void UIActive()
    {
        if (SwitchInput.GetButtonDown(0, SwitchButton.Ok) && Flg && !START && !EXIT && !Credit)
        {
            switch (select_index)
            {
            case 0:
                Credit = true;
                Credit_Image.SetActive(true);
                //音再生
                SoundManager.Instance.Push();
                break;

            case 1:
                START = true;
                //ロードする時の処理
                StartCoroutine("Loadscene");
                //音再生
                SoundManager.Instance.Push();
                break;

            case 2:
                EXIT = true;
                StartCoroutine("End");
                //音再生
                SoundManager.Instance.Push();
                break;
            }
        }
    }
Exemple #2
0
 void Update()
 {
     if (SwitchInput.GetButtonDown(0, SwitchButton.Down))
     {
         SceneManager.LoadScene("SelectScene");
     }
 }
Exemple #3
0
    void Update()
    {
        if (stagenumber != UiRectTransforms.Length - 1)
        {
            //後ろのマップを回転させる
            list[stagenumber].transform.Rotate(0, 5.0f * Time.deltaTime, 0);
        }

        if (Push)
        {
            return;
        }
        if (!Fade.Instance.IsEnd)
        {
            return;
        }
        SelectUpdate();

        //決定
        if (SwitchInput.GetButtonDown(0, SwitchButton.Ok) && !Push)
        {
            Push = true;
            //プッシュの音を鳴らす
            SoundManager.Instance.Push();
            //ロード処理に入る
            StartCoroutine("Loadscene");
        }
    }
Exemple #4
0
    void Update()
    {
        if (Push)
        {
            return;
        }
        if (!Fade.Instance.IsEnd)
        {
            return;
        }
        SelectUpdate();
        if (SwitchInput.GetButtonDown(0, SwitchButton.Ok) && !Push)
        {
            Push = true;
            string SceneName = "";
            switch (select_index)
            {
            case 0:
                SceneName = "Field";
                break;

            case 1:
                SceneName = "Select";
                break;

            case 2:
                SceneName = "Title";
                break;
            }
            //フェード開始
            StartCoroutine("Loadscene", SceneName);
            //プッシュの音を鳴らす
            SoundManager.Instance.Push();
        }
    }
    private void Update()
    {
        if (fade.IsFade)
        {
            return;
        }
        RenderSettings.skybox = skybox;
        if (!titleAnimationPlaying)
        {
            if (SwitchInput.GetButtonDown(0,
                                          nn.hid.NpadButton.A |
                                          nn.hid.NpadButton.B |
                                          nn.hid.NpadButton.X |
                                          nn.hid.NpadButton.Y |
                                          nn.hid.NpadButton.Up |
                                          nn.hid.NpadButton.Down |
                                          nn.hid.NpadButton.Right |
                                          nn.hid.NpadButton.Left))
            {
                SeManager.GetInstance().Play(SeEnum.Decision);
                fade.StartFadeOut("CharacterSelectScene");
            }
        }

        if (canSkip)
        {
            if (SwitchInput.GetButtonDown(0, SwitchButton.Pause))
            {
                titleAnimator.SetTrigger("SkipTrigger");
            }
        }
    }
Exemple #6
0
    void Update()
    {
        for (int i = 0; i < m_PlayerNumber; ++i)
        {
            //既にOKならcontinue
            if (m_IsOk[i])
            {
                continue;
            }
            if (SwitchInput.GetButtonDown(i, SwitchButton.Ok))
            {
                SetOk(i);
            }
        }

        //全てOKか確認する
        try
        {
            foreach (var isOk in m_IsOk)
            {
                if (!isOk)
                {
                    throw new Exception();
                }
            }
            //全てOKならシーン遷移
            SceneManager.LoadScene("GameScene");
        }
        catch (Exception) { }
    }
Exemple #7
0
 void Update()
 {
     if (SwitchInput.GetButtonDown(0, SwitchButton.Down))
     {
         SceneManager.LoadScene("PlayerNumCheckScene");
     }
 }
Exemple #8
0
        /// <summary>
        /// ブーストの更新
        /// </summary>
        void UpdateBoost()
        {
            //ブースト
            boostIntervalTimeCount -= Time.deltaTime;
            if (boostIntervalTimeCount <= 0.0f)
            {
                if (!particleSystem.isPlaying)
                {
                    particleSystem.Play();
                }
            }
            else
            {
                if (!particleSystem.isStopped)
                {
                    particleSystem.Stop();
                }
            }

            if ((SwitchAcceleration.GetAcceleration(ballBehaviour.playerIndex).magnitude > 3.0f ||
                 SwitchInput.GetButtonDown(ballBehaviour.playerIndex, SwitchButton.Boost)) &&
                boostIntervalTimeCount <= 0.0f)
            {
                //入力方向に力を加える
                ballBehaviour.thisRigidbody.AddForce(
                    ballBehaviour.lookatDir.normalized *
                    ballBehaviour.boostPower *
                    ballBehaviour.thisRigidbody.mass);

                boostIntervalTimeCount = ballBehaviour.boostInterval;
            }
        }
Exemple #9
0
 void CreditUpdate()
 {
     if (SwitchInput.GetButtonDown(0, SwitchButton.Ok) || SwitchInput.GetButtonDown(0, SwitchButton.Cancel))
     {
         Credit = false;
         Credit_Image.SetActive(false);
     }
 }
 void Update()
 {
     FlashLightRotation();
     //Stick押し込みでリセット
     if (SwitchInput.GetButtonDown(0, SwitchButton.Stick))
     {
         SwitchGyro.SetBaseGyro(0);
     }
 }
 /// <summary>
 /// 決定のキャンセル
 /// </summary>
 void Cancel(int playerId)
 {
     if (SwitchInput.GetButtonDown(playerId, SwitchButton.Cancel))
     {
         PlayerType type = playerUI[playerId].decisionInfo.decisionInfoType;
         animalArray[animalIndex[type]].GetComponent <BoxCollider>().enabled = true;
         animalArray[animalIndex[type]].transform.localPosition = startAnimal[animalIndex[type]];
         playerUI[playerId].Cancel();
         PlayerJoinManager.SetJoinInfo(playerId, false);
     }
 }
 void Update()
 {
     if (!animEnd || fade.IsFade)
     {
         return;
     }
     if (SwitchInput.GetButtonDown(0, SwitchButton.Ok) || Input.GetKeyDown(KeyCode.Return))
     {
         fade.StartFadeOut("TitleScene");
     }
 }
 /// <summary>
 /// ジャンプ
 /// </summary>
 void Jump()
 {
     //ジャンプボタンを押し、地面についているときにジャンプする
     if (SwitchInput.GetButtonDown(playerNumber, SwitchButton.Jump) && IsGround())
     {
         var velocity = rigidbody.velocity;
         velocity.y         = 0.0f;
         rigidbody.velocity = velocity;
         rigidbody.AddForce(Vector3.up * jumpPower, ForceMode.Impulse);
     }
 }
Exemple #14
0
    void SelectUpdate()
    {
        Vector2Int prev_index = select_index;

        if (SwitchInput.GetButtonDown(0, SwitchButton.StickRight))
        {
            ++select_index.x;
        }
        else if (SwitchInput.GetButtonDown(0, SwitchButton.StickLeft))
        {
            --select_index.x;
        }
        if (SwitchInput.GetButtonDown(0, SwitchButton.StickDown))
        {
            ++select_index.y;
        }
        else if (SwitchInput.GetButtonDown(0, SwitchButton.StickUp))
        {
            --select_index.y;
        }
        select_index.y = Mathf.Clamp(select_index.y, 0, 2);
        select_index.x = Mathf.Clamp(select_index.x, 0, 2);
        if (select_index.y == 2)
        {
            select_index.x = 0;
        }
        if (select_index.y == 1 && prev_index.y == 2)
        {
            select_index.x = 1;
        }
        if (prev_index != select_index)
        {
            UiRectTransforms[stagenumber].localScale = init_scale;
            if (stagenumber != UiRectTransforms.Length - 1)
            {
                list[stagenumber].SetActive(false);
            }
            SoundManager.Instance.Stick();
            increment_scale.Set(0, 0, 0);
            scale_time  = 0.0f;
            stagenumber = select_index.y * 3 + select_index.x;
            if (stagenumber != UiRectTransforms.Length - 1)
            {
                list[stagenumber].SetActive(true);
            }
        }
        scale_time     += Time.deltaTime * 6;
        increment_scale = (max_scale - init_scale) * ((Mathf.Sin(scale_time) + 1) / 2);
        UiRectTransforms[stagenumber].localScale = init_scale + increment_scale;
    }
Exemple #15
0
 public override void LateUpdate()
 {
     if (SwitchInput.GetButton(ballBehaviour.playerIndex, SwitchButton.Brake))
     {
         var velocity = ballBehaviour.thisRigidbody.velocity;
         velocity /= 1 + Time.deltaTime * ballBehaviour.brakePower;
         ballBehaviour.thisRigidbody.velocity = velocity;
         if (SwitchInput.GetButtonDown(ballBehaviour.playerIndex, SwitchButton.Brake) &&
             velocity.magnitude > 1.0f)
         {
             ballBehaviour.brakeSound.Play();
         }
     }
     AdjustNumberUI();
 }
 void Update()
 {
     //背景を暗くするために1フレーム後にキーボードを表示
     if (showKeyboardFlag)
     {
         ShowKeyboard();
         showKeyboardFlag = false;
         blackImage.color = new Color(0, 0, 0, 0);
     }
     else if (SwitchInput.GetButtonDown(0, SwitchButton.Down))
     {
         showKeyboardFlag = true;
         blackImage.color = new Color(0, 0, 0, 0.8f);
     }
     else if (SwitchInput.GetButtonDown(0, SwitchButton.Up))
     {
         UnityEngine.SceneManagement.SceneManager.LoadScene("GameScene");
     }
 }
    private void Update()
    {
        if (fade.IsFade)
        {
            return;
        }
        // 各プレイヤー実行
        //----------------------
        for (int i = 0; i < playerUI.Length; ++i)
        {
            // 未決定
            if (!playerUI[i].decisionInfo.isDecision)
            {
                CursorMove(i);
            }
            else
            {
                playerUI[i].OkObjAnimation();
                Cancel(i);
            }
        }
        //----------------------

        AnimalRote();

        if (SwitchInput.GetButtonDown(0, SwitchButton.Pause))
        {
            int count = 0;
            for (int i = 0; i < PlayerCount.MaxValue; ++i)
            {
                if (PlayerJoinManager.IsJoin(i))
                {
                    ++count;
                }
            }
            if (count >= PlayerCount.MinValue)
            {
                fade.StartFadeOut("GameScene");
            }
        }
    }
Exemple #18
0
    void SelectUpdate()
    {
        int prev_index = select_index;

        if (SwitchInput.GetButtonDown(0, SwitchButton.StickDown))
        {
            ++select_index;
        }
        else if (SwitchInput.GetButtonDown(0, SwitchButton.StickUp))
        {
            --select_index;
        }
        select_index = Mathf.Clamp(select_index, 0, UiRectTransforms.Length - 1);
        if (prev_index != select_index)
        {
            UiRectTransforms[prev_index].localScale = init_scale;
            SoundManager.Instance.Stick();
            scale_time = 0.0f;
        }
        scale_time += Time.unscaledDeltaTime * 6;
        UiRectTransforms[select_index].localScale = init_scale + (max_scale - init_scale) * ((Mathf.Sin(scale_time) + 1) / 2);
    }
    /// <summary>
    /// レイを飛ばして情報の取得
    /// </summary>
    /// <param name="playerId"></param>
    void PointerRaycast(int playerId)
    {
        Vector3 cursorPos = playerUI[playerId].cursor.transform.position;

        Ray         ray      = Camera.main.ScreenPointToRay(Camera.main.WorldToScreenPoint(cursorPos));
        RaycastHit  hit      = new RaycastHit();
        const float distance = 15;

        if (Physics.Raycast(ray, out hit, distance))
        {
            GameObject obj  = hit.collider.gameObject;
            PlayerType type = obj.GetComponent <CharaType>().type;

            // 決定
            if (SwitchInput.GetButtonDown(playerId, SwitchButton.Ok))
            {
                Decision(playerId, type);
            }
            else
            {
                roteNewFlg[animalIndex[type]] = true;
            }
        }
    }
Exemple #20
0
    void Update()
    {
        if (Pad)
        {
            Controller();
        }

        if (!GameOver && GameStart && !FieldManeger.Instance.Pause_Flg)
        {
            RaycastHit hit;

            //ジャンプ                 自分の中心       レイの幅          方向    長さ
            if (Physics.SphereCast(transform.position, 1.5f, Vector3.down, out hit, 1.7f) &&
                SwitchInput.GetButtonDown(playerNumber, SwitchButton.Down))
            {
                if (hit.collider.tag == "Cube" || hit.collider.tag == "StrongCube")
                {
                    //力を加える
                    rb.AddForce(Vector3.up * 1000f);
                    //かかっている力をリセット
                    rb.velocity = Vector3.zero;
                    SoundManager.Instance.Jump();
                }
            }

            //プレイヤーの頭上に移動
            HoldPosition = new Vector3(transform.position.x, transform.position.y, transform.position.z);

            //===爆弾関連===
            PlayerBomb();
        }
        else if (GameOver) //ゲームオーバーになった場合
        {
            this.transform.position = new Vector3(-10.0f, 0.0f, -10.0f);
        }
    }
Exemple #21
0
    void Update()
    {
        ExamineBase prevHitExamine = rayHitExamine;
        //現在ヒットしているExamineを取得
        var currentHitExamine = GetExamineWithRay();

        //違うオブジェクトにヒットしたらヒットしていたオブジェクトをExit,
        //現在ヒットしているオブジェクトをEnterを実行
        if (prevHitExamine != currentHitExamine)
        {
            if (prevHitExamine)
            {
                prevHitExamine.HitExit();
            }
            if (currentHitExamine)
            {
                currentHitExamine.HitEnter();
            }
        }
        //Stayは常に実行
        if (currentHitExamine)
        {
            currentHitExamine.HitStay();
        }
        //Examineを押したらExamineを実行
        if (SwitchInput.GetButtonDown(0, SwitchButton.Examine))
        {
            if (currentHitExamine)
            {
                currentHitExamine.Examine();
            }
        }
        rayHitExamine = currentHitExamine;
        //UIの表示・非表示
        examineUI.enabled = rayHitExamine;
    }
Exemple #22
0
    void Update()
    {
        if (PlayerPoints[0] == 1)
        {
            Star[0].SetActive(true);
        }
        if (PlayerPoints[1] == 1)
        {
            Star[2].SetActive(true);
        }
        if (PlayerPoints[2] == 1)
        {
            Star[4].SetActive(true);
        }
        if (PlayerPoints[3] == 1)
        {
            Star[6].SetActive(true);
        }


        if (!GameOver)
        {
            int survivePlayerNumber = 0;
            int deathCount          = 0;
            for (int i = 0; i < PlayerGameOvers.Length; ++i)
            {
                if (PlayerGameOvers[i])
                {
                    ++deathCount;
                }
                else
                {
                    survivePlayerNumber = i;
                }
            }
            if (deathCount == PlayerGameOvers.Length - 1)
            {
                GameOver = true;
                ++PlayerPoints[survivePlayerNumber];
                if (PlayerPoints[survivePlayerNumber] == 2)
                {
                    //ゲームオーバー時の処理に入る
                    StartCoroutine("Gameover");
                    //星生成
                    Star[survivePlayerNumber * 2 + 1].SetActive(true);
                    WinPlayerNumber = survivePlayerNumber;
                }
                else
                {
                    StartCoroutine("Restart");
                }
            }
        }
        if (Pause_Flg)
        {
            OnPause();
        }
        else
        {
            Pause_Push = false;
            OnUnPause();
            //ポーズ画面
            if (SwitchInput.GetButtonDown(0, SwitchButton.Pause) && !Pause_Flg && Game_Start)
            {
                Pause_Flg = true;
            }
        }
    }
Exemple #23
0
    void Update()
    {
        if (START || EXIT)
        {
            return;
        }
        if (!Flg)
        {
            Timer -= Time.deltaTime;
        }
        if (!Fade.Instance.IsEnd)
        {
            return;
        }

        //特定のブロックと爆弾を消す
        if (SwitchInput.GetButtonDown(0, SwitchButton.Ok) && !Check)
        {
            Timer = 0;
            Push  = true;
            Check = true;


            GameObject[] cubes = GameObject.FindGameObjectsWithTag("Cube");

            foreach (GameObject cube in cubes)
            {
                Destroy(cube);
            }

            GameObject[] bombs = GameObject.FindGameObjectsWithTag("Bomb");

            foreach (GameObject bomb in bombs)
            {
                Destroy(bomb);
            }
        }
        else
        {
            Push = false;
        }

        if (Timer <= 0)
        {
            foreach (var obj in UiRectTransforms)
            {
                obj.gameObject.SetActive(true);
            }
            if (!Push)
            {
                Flg = true;
            }
            if (Credit)
            {
                CreditUpdate();
            }
            else
            {
                SelectUpdate();
                UIActive();
            }
        }
    }
Exemple #24
0
    //ポーズ画面展開
    public void OnPause()
    {
        //時間を止める
        Time.timeScale = 0;

        //ボタンを見えるように
        Panel.GetComponent <Image>().color = new Color32(0, 0, 0, 150);
        for (int i = 0; i < Panel.transform.childCount; i++)
        {
            Panel.transform.transform.GetChild(i).GetComponent <Image>().color = Color.white;
        }
        SelectUpdate();
        if (SwitchInput.GetButtonDown(0, SwitchButton.Pause) && !Pause_Push)
        {
            Pause_Push = true;
            Pause_Flg  = false;
            Panel.GetComponent <Image>().color = new Color32(0, 0, 0, 0);

            for (int i = 0; i < Panel.transform.childCount; i++)
            {
                Panel.transform.transform.GetChild(i).GetComponent <Image>().color = new Color32(0, 0, 0, 0);
            }
            select_index = 0;
            foreach (var obj in UiRectTransforms)
            {
                obj.localScale = init_scale;
            }
            scale_time = 0;
        }
        //ボタンを押したら
        if (SwitchInput.GetButtonDown(0, SwitchButton.Ok) && !Pause_Push)
        {
            Pause_Push = true;
            Pause_Flg  = false;
            switch (select_index)
            {
            case 0:
                Panel.GetComponent <Image>().color = new Color32(0, 0, 0, 0);

                for (int i = 0; i < Panel.transform.childCount; i++)
                {
                    Panel.transform.transform.GetChild(i).GetComponent <Image>().color = new Color32(0, 0, 0, 0);
                }
                select_index = 0;
                foreach (var obj in UiRectTransforms)
                {
                    obj.localScale = init_scale;
                }
                scale_time = 0;
                break;

            case 1:
                //スタティックなので値を0に
                PlayerPoints = new int[4];
                StartCoroutine("SelectScene");
                break;

            case 2:
                //スタティックなので値を0に
                PlayerPoints = new int[4];
                StartCoroutine("TitleScene");
                break;
            }
        }
    }
Exemple #25
0
 void Update()
 {
     if (fade.IsFade)
     {
         return;
     }
     if (isTranslation)
     {
         return;
     }
     if (isPause)
     {
         if (SwitchInput.GetButtonDown(0, SwitchButton.Pause))
         {
             SeManager.GetInstance().Play(SeEnum.Decision);
             StartCoroutine(ReturnGame());
         }
         else
         {
             PauseItem nextItem = null;
             if (SwitchInput.GetButtonDown(0, SwitchButton.Ok))
             {
                 isPause = false;
                 SeManager.GetInstance().Play(SeEnum.Decision);
                 currentItem.transform.localScale = Vector3.Scale(defaultScale
                                                                  , new Vector3(1 + SizeRange, 1 + SizeRange, 1.0f));
                 currentItem.Execute();
             }
             else if (SwitchInput.GetButtonDown(0, SwitchButton.SelectUp))
             {
                 nextItem = currentItem.up;
             }
             else if (SwitchInput.GetButtonDown(0, SwitchButton.SelectDown))
             {
                 nextItem = currentItem.down;
             }
             else if (SwitchInput.GetButtonDown(0, SwitchButton.SelectRight))
             {
                 nextItem = currentItem.right;
             }
             else if (SwitchInput.GetButtonDown(0, SwitchButton.SelectLeft))
             {
                 nextItem = currentItem.left;
             }
             if (nextItem != null)
             {
                 currentItem.transform.localScale = defaultScale;
                 currentItem = nextItem;
                 timeCount   = 0.0f;
             }
             float addScale = (Mathf.Sin(timeCount) + 1) / 2;
             float scale    = 1 + addScale * SizeRange;
             currentItem.transform.localScale = Vector3.Scale(defaultScale
                                                              , new Vector3(scale, scale, 1.0f));
             timeCount += Time.unscaledDeltaTime * 2.0f;
         }
     }
     else
     {
         if (Time.timeScale == 0.0f)
         {
             return;
         }
         if (SwitchInput.GetButtonDown(0, SwitchButton.Pause))
         {
             currentItem = pauseItems[0];
             foreach (var pauseItem in pauseItems)
             {
                 pauseItem.transform.localScale = defaultScale;
             }
             StartCoroutine(ToPause());
         }
     }
 }