Пример #1
0
        private void SavePlayerInputControllerType(int playerIndex)
        {
            int playerID = playerIndex;
            PlayerControllerInput currentPlayerControllerInput = playerInfo.GetPlayerControllerInput(playerIndex - 1);

            // 現在選択している入力操作の逆に選択する
            if (currentPlayerControllerInput == PlayerControllerInput.Keyboard)
            {
                GameObject.Find("Player" + playerID + "ControllerKeyboardBackground").GetComponent <Image>().color = Color.white;
                GameObject.Find("Player" + playerID + "ControllerKeyboardText").GetComponent <Text>().color        = Color.black;
                GameObject.Find("Player" + playerID + "ControllerJoystickBackground").GetComponent <Image>().color = Color.black;
                GameObject.Find("Player" + playerID + "ControllerJoystickText").GetComponent <Text>().color        = Color.white;
                playerInfo.SetPlayerControllerInput(playerIndex - 1, PlayerControllerInput.Joystick);
                playerInputHintsTexts[playerIndex - 1].text = playerInputJoystickHints;
            }
            else
            {
                GameObject.Find("Player" + playerID + "ControllerJoystickBackground").GetComponent <Image>().color = Color.white;
                GameObject.Find("Player" + playerID + "ControllerJoystickText").GetComponent <Text>().color        = Color.black;
                GameObject.Find("Player" + playerID + "ControllerKeyboardBackground").GetComponent <Image>().color = Color.black;
                GameObject.Find("Player" + playerID + "ControllerKeyboardText").GetComponent <Text>().color        = Color.white;
                playerInfo.SetPlayerControllerInput(playerIndex - 1, PlayerControllerInput.Keyboard);
                playerInputHintsTexts[playerIndex - 1].text = playerInputKeyboardHints[playerIndex - 1];
            }
        }
Пример #2
0
    public SetSequences(SetSequencesData data, PlayerControllerInput playerController, IShooter controller)
    {
        this.data             = data;
        this.playerController = playerController;
        this.controller       = controller;

        commands = new List <CommandSequence>();
        foreach (CommandSequenceData sequences in data.comboSections)
        {
            CommandSequence command = new CommandSequence(sequences, this.playerController, this.controller);
            command.onCompletedSequence += NextSection;
            command.onWrongInput        += RemoveSequence;
            commands.Add(command);
        }

        commands[0].onStartSequence += StartSection;

        this.playerController.OnInputPressed += CheckPressedInput;
        this.controller.OnDestroy            += UnsubscribeEvent;

        currentSection = commands[0];
        canExecute     = true;

        cooldownCorutine = CooldownCorutine();
    }
Пример #3
0
    public CommandSequence(CommandSequenceData data, PlayerControllerInput playerController, IShooter controller)
    {
        this.data             = data;
        this.playerController = playerController;
        this.controller       = controller;

        //this.playerController.OnInputPressed += CheckPressedInput;
        this.controller.OnDestroy += UnsubscribeEvent;
    }
Пример #4
0
 public void SetStepBlockKeyCode(KeyCode keyCode, int keyCodeIndex = -1, PlayerControllerInput playerInput = PlayerControllerInput.Keyboard)
 {
     stepBlockKeyCode = keyCode;
     if (playerInput == PlayerControllerInput.Keyboard)
     {
         ShowKeyCodeText(keyCode);
     }
     else
     {
         ShowKeyCodeImage(keyCodeIndex);
     }
 }
        // Start is called before the first frame update
        void Start()
        {
            buttonPressed          = false;
            currenyPlayerInputTime = 0f;

            buttonEntered.Clear();
            playerButtons.Clear();
            playerButtons.Add(hitButton1);
            playerButtons.Add(hitButton2);
            playerButtons.Add(hitButton3);
            playerButtons.Add(hitButton4);
            playerInputMethod = playerInfo.GetPlayerControllerInput(playerID);

            playerLife = playerInfo.GetCurrentLife(playerID);
        }
Пример #6
0
 public void InitializeInputMethod(int playerIndex)
 {
     playerInputMethod = playerInfo.GetPlayerControllerInput(playerIndex);
 }
Пример #7
0
 public void SetPlayerControllerInput(int index, PlayerControllerInput input)
 {
     playerControllerInputs[index] = input;
     PlayerPrefs.SetString("Player" + (index + 1) + "ControllerInput", input.ToString());
 }
Пример #8
0
 private void Initialization()
 {
     playerIsRunning   = false;
     playerInputMethod = playerInfo.GetPlayerControllerInput(playerID);
     playerInputTimer  = playerStandTimer;
 }
        private void RandomPlayerStepBlock(int playerIndex)
        {
            List <KeyCode>        playerButtons = kenkenpaPlayerControllers[playerIndex].GetPlayerButtons();
            PlayerControllerInput playerInput   = playerInfo.GetPlayerControllerInput(playerIndex);

            for (int step = 1; step <= lapMaxSteps; step++)
            {
                int randomBlockPattern = Random.Range(0, 2); // シングルブロックまたはダブルブロック
                //int randomBlockPattern = 0;
                int randomButtonNum  = Random.Range(0, playerButtons.Count);
                int randomButtonNum2 = Random.Range(0, playerButtons.Count);
                while (randomButtonNum2 == randomButtonNum)
                {
                    randomButtonNum2 = Random.Range(0, playerButtons.Count);
                }

                GameObject singleBlockArea = GameObject.Find("Player" + (playerIndex + 1) + "StepSingleBlockArea" + step);
                foreach (Image img in singleBlockArea.GetComponentsInChildren <Image>())
                {
                    img.enabled = true;
                }
                foreach (Text txt in singleBlockArea.GetComponentsInChildren <Text>())
                {
                    txt.enabled = true;
                }
                GameObject doubleBlockArea = GameObject.Find("Player" + (playerIndex + 1) + "StepDoubleBlockArea" + step);
                foreach (Image img in doubleBlockArea.GetComponentsInChildren <Image>())
                {
                    img.enabled = true;
                }
                foreach (Text txt in doubleBlockArea.GetComponentsInChildren <Text>())
                {
                    txt.enabled = true;
                }

                // 一旦全てのブロックエリアを活性化する
                switch (randomBlockPattern)
                {
                case 0:
                    KenkenpaRandomStepBlock randomSingleBlock = GameObject.Find("Player" + (playerIndex + 1) + "StepSingleBlockArea" + step + "Block").
                                                                GetComponent <KenkenpaRandomStepBlock>();
                    randomSingleBlock.SetStepBlockKeyCode(playerButtons[randomButtonNum], randomButtonNum, playerInput);
                    foreach (Image img in doubleBlockArea.GetComponentsInChildren <Image>())
                    {
                        img.enabled = false;
                    }
                    foreach (Text txt in doubleBlockArea.GetComponentsInChildren <Text>())
                    {
                        txt.enabled = false;
                    }
                    foreach (KenkenpaRandomStepBlock k in doubleBlockArea.GetComponentsInChildren <KenkenpaRandomStepBlock>())
                    {
                        k.SetStepBlockKeyCode(KeyCode.None);
                    }
                    break;

                case 1:
                    KenkenpaRandomStepBlock randomDoubleBlock1 = GameObject.Find("Player" + (playerIndex + 1) + "StepDoubleBlockArea" + step + "Block1").
                                                                 GetComponent <KenkenpaRandomStepBlock>();
                    randomDoubleBlock1.SetStepBlockKeyCode(playerButtons[randomButtonNum], randomButtonNum, playerInput);
                    KenkenpaRandomStepBlock randomDoubleBlock2 = GameObject.Find("Player" + (playerIndex + 1) + "StepDoubleBlockArea" + step + "Block2").
                                                                 GetComponent <KenkenpaRandomStepBlock>();
                    randomDoubleBlock2.SetStepBlockKeyCode(playerButtons[randomButtonNum2], randomButtonNum2, playerInput);
                    foreach (Image img in singleBlockArea.GetComponentsInChildren <Image>())
                    {
                        img.enabled = false;
                    }
                    foreach (Text txt in singleBlockArea.GetComponentsInChildren <Text>())
                    {
                        txt.enabled = false;
                    }
                    foreach (KenkenpaRandomStepBlock k in singleBlockArea.GetComponentsInChildren <KenkenpaRandomStepBlock>())
                    {
                        k.SetStepBlockKeyCode(KeyCode.None);
                    }
                    break;
                }
            }
        }
Пример #10
0
 private void Initialization()
 {
     numOfPlayers            = playerInfo.GetPlayersCount();
     playerInputConfirmFlags = new bool[numOfPlayers];
     selectedPlayerID        = 1;
     GameObject.Find("Player" + selectedPlayerID + "NameBackground").GetComponent <Image>().color = Color.black;
     GameObject.Find("Player" + selectedPlayerID + "NameText").GetComponent <Text>().color        = Color.white;
     gameLanguage = mapInfo.GetGameLanguage();
     if (gameLanguage == Language.Japanese)
     {
         checkPlayerInputHintsText.text       = localeJP.GetLabelContent("CheckPlayerInputHints");
         checkInputTestControlHintsTitle.text = localeJP.GetLabelContent("InputButtonsTitle");
         checkInputTestAreaTitle.text         = localeJP.GetLabelContent("InputTestTitle");
         testInputHints           = localeJP.GetLabelContent("TestInputHint");
         chosenPlayerLabel        = localeJP.GetLabelContent("ChosenPlayerHint");
         startButtonText.text     = localeJP.GetLabelContent("Start");
         backButtonText.text      = localeJP.GetLabelContent("Back");
         settingHints             = localeJP.GetLabelContent("SettingtHint");
         startButtonText.text     = localeJP.GetLabelContent("Start");
         playerInputTypeText.text = localeJP.GetLabelContent("PlayerInputType");
         for (int playerIndex = 0; playerIndex < numOfPlayers; playerIndex++)
         {
             playerLabelTexts[playerIndex].text         = localeJP.GetLabelContent("Player") + (playerIndex + 1);
             playerInputKeybordTexts[playerIndex].text  = localeJP.GetLabelContent("Keyboard");
             playerInputJoystickTexts[playerIndex].text = localeJP.GetLabelContent("Joystick");
             confirmedButtonText[playerIndex].text      = localeJP.GetLabelContent("Confirmed");
         }
     }
     else
     {
         checkPlayerInputHintsText.text       = localeEN.GetLabelContent("CheckPlayerInputHints");
         checkInputTestControlHintsTitle.text = localeEN.GetLabelContent("InputButtonsTitle");
         checkInputTestAreaTitle.text         = localeEN.GetLabelContent("InputTestTitle");
         testInputHints           = localeEN.GetLabelContent("TestInputHint");
         chosenPlayerLabel        = localeEN.GetLabelContent("ChosenPlayerHint");
         startButtonText.text     = localeEN.GetLabelContent("Start");
         backButtonText.text      = localeEN.GetLabelContent("Back");
         settingHints             = localeEN.GetLabelContent("SettingtHint");
         startButtonText.text     = localeEN.GetLabelContent("Start");
         playerInputTypeText.text = localeEN.GetLabelContent("PlayerInputType");
         for (int playerIndex = 0; playerIndex < numOfPlayers; playerIndex++)
         {
             playerLabelTexts[playerIndex].text         = localeEN.GetLabelContent("Player") + (playerIndex + 1);
             playerInputKeybordTexts[playerIndex].text  = localeEN.GetLabelContent("Keyboard");
             playerInputJoystickTexts[playerIndex].text = localeEN.GetLabelContent("Joystick");
             confirmedButtonText[playerIndex].text      = localeEN.GetLabelContent("Confirmed");
         }
     }
     for (int playerIndex = 0; playerIndex < numOfPlayers; playerIndex++)
     {
         int playerID = playerIndex + 1;
         PlayerControllerInput playerControllerInput = playerInfo.GetPlayerControllerInput(playerIndex);
         if (playerControllerInput == PlayerControllerInput.Keyboard)
         {
             GameObject.Find("Player" + playerID + "ControllerKeyboardBackground").GetComponent <Image>().color = Color.black;
             GameObject.Find("Player" + playerID + "ControllerKeyboardText").GetComponent <Text>().color        = Color.white;
             GameObject.Find("Player" + playerID + "ControllerJoystickBackground").GetComponent <Image>().color = Color.white;
             GameObject.Find("Player" + playerID + "ControllerJoystickText").GetComponent <Text>().color        = Color.black;
             playerInputHintsTexts[playerIndex].text = playerInputKeyboardHints[playerIndex];
         }
         else
         {
             GameObject.Find("Player" + playerID + "ControllerJoystickBackground").GetComponent <Image>().color = Color.black;
             GameObject.Find("Player" + playerID + "ControllerJoystickText").GetComponent <Text>().color        = Color.white;
             GameObject.Find("Player" + playerID + "ControllerKeyboardBackground").GetComponent <Image>().color = Color.white;
             GameObject.Find("Player" + playerID + "ControllerKeyboardText").GetComponent <Text>().color        = Color.black;
             playerInputHintsTexts[playerIndex].text = playerInputJoystickHints;
         }
         playerInputConfirmFlags[playerIndex]       = false;
         playerInputTestAreaTexts[playerIndex].text = "";
         playerNameTexts[playerIndex].text          = playerInfo.GetPlayerName(playerIndex);
     }
     isSelectingPlayers         = true;
     playerInputTestFlag        = false;
     settingHintsText.text      = settingHints;
     testInputHintsText.text    = "";
     proceedButton.interactable = false;
     startButtonText.color      = Color.gray;
 }