Esempio n. 1
0
    // Update is called once per frame
    void Update()
    {
        if (rectTran.position.y < endY && isPlaying)
        {
            rectTran.Translate(0, scrollSpeed * Time.deltaTime, 0);

//				position.Set(rectTran.position.x, rectTran.position.y+scrollSpeed * Time.deltaTime
//			                      , rectTran.position.z);
            //Debug.Log("Scrolling");
        }
        else
        {
            isPlaying = false;
        }

        if (ControllerManager.GetButton(ControllerInputWrapper.Buttons.B, 1, true) ||
            ControllerManager.GetButton(ControllerInputWrapper.Buttons.B, 2, true) ||
            ControllerManager.GetButton(ControllerInputWrapper.Buttons.B, 3, true) ||
            ControllerManager.GetButton(ControllerInputWrapper.Buttons.B, 4, true) ||
            Input.GetMouseButtonDown(0))
        {
            selectAS.Stop();
            selectAS.Play();
            isPlaying   = false;
            interrupted = true;
            creditsPanel.SetActive(false);
            rectTran.position = startPos;
        }
    }
    void checkAbilityInput()
    {
        for (int i = 0; i < numPlayers; i++)
        {
            if (!ready[i])
            {
                if (ControllerManager.GetTrigger(ControllerInputWrapper.Triggers.LeftTrigger, playerControllers[i], true) <= 0f)
                {
                    L2ErrorReady[i] = true;
                }

                if (ControllerManager.GetTrigger(ControllerInputWrapper.Triggers.LeftTrigger, playerControllers[i], true) > .01f)
                {
                    if (checkAbilitySelected(i))
                    {
                        if (L2ErrorReady[i])
                        {
                            errorSound.Stop();
                            errorSound.Play();
                            L2ErrorReady[i] = false;
                        }

                        return;
                    }
                    selectAbilitySounds.Stop();
                    selectAbilitySounds.Play();
                    playerAbilities[i, 0] = allAbilities[currentAbilitySelected[i]];
                    L2ErrorReady[i]       = false;
                    //aAbility[i].sprite = allAbilities[currentAbilitySelected[i]].icon;
                }
                else if (ControllerManager.GetButton(ControllerInputWrapper.Buttons.LeftBumper, playerControllers[i], true))
                {
                    if (checkAbilitySelected(i))
                    {
                        errorSound.Stop();
                        errorSound.Play();
                        return;
                    }
                    playerAbilities[i, 1] = allAbilities[currentAbilitySelected[i]];
                    selectAbilitySounds.Stop();
                    selectAbilitySounds.Play();
                    //xAbility[i].sprite = allAbilities[currentAbilitySelected[i]].icon;
                }
                else if (ControllerManager.GetButton(ControllerInputWrapper.Buttons.RightBumper, playerControllers[i], true))
                {
                    if (checkAbilitySelected(i))
                    {
                        errorSound.Stop();
                        errorSound.Play();
                        return;
                    }
                    selectAbilitySounds.Stop();
                    selectAbilitySounds.Play();
                    playerAbilities[i, 2] = allAbilities[currentAbilitySelected[i]];
                    //bAbility[i].sprite = allAbilities[currentAbilitySelected[i]].icon;
                }
            }
        }
    }
    /// <summary>
    /// Checks the player accept.
    /// </summary>
    void checkPlayerAccept()
    {
        for (int i = -1; i < playerControllers.Length; i++)
        {
            if (ControllerManager.GetButton(ControllerInputWrapper.Buttons.Start, i + 1, true) && !accepted[i + 1])
            {
                //Debug.Log("i = " + i );

                //Set key icons



                TVonSounds.Stop();
                TVonSounds.Play();
                playerAbilities[numPlayers, 3] = mainAbility;
                tvScreenAnimations[numPlayers].GetComponent <Image>().enabled = true;
                tvScreenAnimations[numPlayers].SetTrigger("PlayerStart");
                playerControllers[numPlayers] = i + 1;

                int targetPanelNum = FindSelectPanelNum(i + 1);
                ChangeButtonIcons(i != -1, targetPanelNum);

                accepted[i + 1] = true;
                //panels[numPlayers].enabled = false;
                enterPanel[numPlayers].gameObject.SetActive(false);
                selectAbility[numPlayers].gameObject.SetActive(true);
                numPlayers++;
                if (numPlayers == 2)
                {
                    //Debug.Log("2 men audio");
                    audioS.Stop();
                    audioS.clip = TwoMenClip;
                    audioS.Play();
                }
                else if (numPlayers == 3)
                {
                    //Debug.Log("3 men audio");
                    audioS.Stop();
                    audioS.clip = ThreeMenClip;
                    audioS.Play();
                }
                else if (numPlayers == 4)
                {
                    //Debug.Log("4 men audio");
                    audioS.Stop();
                    audioS.clip = FourMenClip;
                    audioS.Play();
                }
            }
        }
    }
Esempio n. 4
0
 // Update is called once per frame
 void Update()
 {
     if (gm.GameInProgress)
     {
         if (ControllerManager.GetButton(ControllerInputWrapper.Buttons.A, joystickNum))
         {
             if (chestAround)
             {
                 //Debug.Log("Open chest");
                 chestOpenedNum++;
                 chestAround.GetComponent <Chest>().Open();
                 chestAround = null;
             }
         }
     }
 }
Esempio n. 5
0
 public void Update()
 {
     if (inWinUI)
     {
         if (ControllerManager.GetButton(ControllerInputWrapper.Buttons.A, 1) ||
             ControllerManager.GetButton(ControllerInputWrapper.Buttons.A, 2) ||
             ControllerManager.GetButton(ControllerInputWrapper.Buttons.A, 3) ||
             ControllerManager.GetButton(ControllerInputWrapper.Buttons.A, 4))
         {
             SceneManager.LoadScene("Level3");
         }
         else if (ControllerManager.GetButton(ControllerInputWrapper.Buttons.B, 1) ||
                  ControllerManager.GetButton(ControllerInputWrapper.Buttons.B, 2) ||
                  ControllerManager.GetButton(ControllerInputWrapper.Buttons.B, 3) ||
                  ControllerManager.GetButton(ControllerInputWrapper.Buttons.B, 4))
         {
             SceneManager.LoadScene("Main_Menu");
         }
     }
 }
 void checkReadyStart()
 {
     for (int i = 0; i < numPlayers; i++)
     {
         if (ControllerManager.GetButton(ControllerInputWrapper.Buttons.Start, playerControllers[i], true))
         //if (Input.GetKeyDown(KeyCode.KeypadEnter))
         {
             if (ready[i] && timer > 0)
             {
                 ready[i] = false;
                 //countDownAnim.SetTrigger("CancelCD");
             }
             else if (checkAbilityFilled(i))
             {
                 ready[i] = true;
                 if (getAllPlayersReady())
                 {
                     //countDownAnim.SetTrigger("BeginCD");
                 }
             }
         }
     }
 }
Esempio n. 7
0
    void HandleControl(bool isController)
    {
        if (isController)
        {
            //Controller
            if (ControllerManager.GetTrigger(ControllerInputWrapper.Triggers.LeftTrigger, joystickNum, true) > 0)
            {
                //Debug.Log("receiving trigger input");
                if (!castings[1] && !castings[2] && !castings[3])
                {
                    if (abilities[0].abilityReady)
                    {
                        castings[0] = true;
                        abilities[0].Cast();
                        if (abilities[0].triggerOnce)
                        {
                            castings[0] = false;
                            StartCoroutine(EndAbility(0, 0.2f));
                        }
                    }
                }
            }
            else if (castings[0])
            {
                //Debug.Log("casting 0 is true");
                if (!abilities[0].handledEndCast)
                {
                    Debug.Log("Ability 0 endcasting");
                    abilities[0].EndCast();
                }

                if (abilities[0].endCasted)
                {
                    castings [0]            = false;
                    abilities [0].endCasted = false;
                }
                else
                {
                    //Debug.Log("Ability 0 not end casted");
                }
            }



            if (ControllerManager.GetButton(ControllerInputWrapper.Buttons.LeftBumper, joystickNum))
            {
                if (!castings[0] && !castings[2] && !castings[3])
                {
                    if (abilities[1].abilityReady)
                    {
                        castings[1] = true;
                        abilities[1].Cast();
                        if (abilities[1].triggerOnce)
                        {
                            castings[1] = false;
                            StartCoroutine(EndAbility(1, 0.1f));
                        }
                    }
                }
            }
            else if (castings[1])
            {
                if (abilities[1].endCasted)
                {
                    castings [1]            = false;
                    abilities [1].endCasted = false;
                }
                if (!abilities[1].handledEndCast)
                {
                    abilities[1].EndCast();
                }
            }

            //Debug.Log (Input.GetAxisRaw ("PS4_R1_" + playerString));

            if (ControllerManager.GetButton(ControllerInputWrapper.Buttons.RightBumper, joystickNum))
            {
                if (!castings[0] && !castings[1] && !castings[3])
                {
                    if (abilities[2].abilityReady)
                    {
                        //Debug.Log(joystickNum + " is casting");
                        castings[2] = true;
                        abilities[2].Cast();
                        if (abilities[2].triggerOnce)
                        {
                            castings[2] = false;
                            StartCoroutine(EndAbility(2, 0.1f));
                        }
                    }
                }
            }
            else if (castings[2])
            {
                if (abilities[2].endCasted)
                {
                    castings [2]            = false;
                    abilities [2].endCasted = false;
                }
                //Debug.Log("End Cast 3rd ability");

                if (!abilities[2].handledEndCast)
                {
                    abilities[2].EndCast();
                }
            }

            if (ControllerManager.GetTrigger(ControllerInputWrapper.Triggers.RightTrigger, joystickNum, true) > 0)
            {
                if (!castings[0] && !castings[1] && !castings[2])
                {
                    if (abilities[3].abilityReady)
                    {
                        //Debug.Log(joystickNum + " is casting");
                        castings[3] = true;
                        abilities[3].Cast();
                        if (abilities[3].triggerOnce)
                        {
                            castings[3] = false;
                            StartCoroutine(EndAbility(3, 0.1f));
                        }
                    }
                }
            }
            else if (castings[3])
            {
                //Debug.Log("End Cast 3rd ability");
                if (abilities[3].endCasted)
                {
                    castings [3]            = false;
                    abilities [3].endCasted = false;
                }
                else
                {
                    //Debug.Log("Ability 3 not end casted");
                }
                if (!abilities[3].handledEndCast)
                {
                    abilities[3].EndCast();
                    //Debug.Log("Ability 3 endcasting");
                }
            }

            //if (enchanting)
            //{
            //    enchantEffect.SetActive(true);
            //}
            //else
            //{
            //    enchantEffect.SetActive(false);
            //}
        }
        else
        {
            //Keyboard

            //Handle fire
            if (ControllerManager.GetButton(ControllerInputWrapper.Buttons.A, joystickNum, false))
            {
                if (CkeckCasting_Key())
                {
                    if (abilities[currentAbilityNum_Keyboard].abilityReady)
                    {
                        //Debug.Log(joystickNum + " is casting");
                        castings[currentAbilityNum_Keyboard] = true;
                        abilities[currentAbilityNum_Keyboard].Cast();
                        if (abilities[currentAbilityNum_Keyboard].triggerOnce)
                        {
                            castings[currentAbilityNum_Keyboard] = false;
                            StartCoroutine(EndAbility(currentAbilityNum_Keyboard, 0.1f));
                        }
                    }
                }
            }
            else if (castings[currentAbilityNum_Keyboard])
            {
                if (!abilities[currentAbilityNum_Keyboard].handledEndCast)
                {
                    abilities[currentAbilityNum_Keyboard].EndCast();
                }

                //Debug.Log("End Cast 3rd ability");
                if (abilities[currentAbilityNum_Keyboard].endCasted)
                {
                    castings [currentAbilityNum_Keyboard]            = false;
                    abilities [currentAbilityNum_Keyboard].endCasted = false;
                }
            }

            if (ControllerManager.GetTrigger(ControllerInputWrapper.Triggers.LeftTrigger, joystickNum, true) > 0)
            {
                currentAbilityNum_Keyboard = 0;
            }
            else if (ControllerManager.GetButton(ControllerInputWrapper.Buttons.LeftBumper, joystickNum))
            {
                currentAbilityNum_Keyboard = 1;
            }
            else if (ControllerManager.GetButton(ControllerInputWrapper.Buttons.RightBumper, joystickNum))
            {
                currentAbilityNum_Keyboard = 2;
            }
            else if (ControllerManager.GetTrigger(ControllerInputWrapper.Triggers.RightTrigger, joystickNum, true) > 0)
            {
                currentAbilityNum_Keyboard = 3;
            }

            if (enchanting)
            {
                enchantEffect.SetActive(true);
            }
            else
            {
                enchantEffect.SetActive(false);
            }
        }
    }
Esempio n. 8
0
    void Update()
    {
        CheckSelected();

        if (!actionReady)
        {
            if (timer < actionDelay)
            {
                timer += Time.deltaTime;
            }
            else
            {
                actionReady = true;
            }
        }
        else
        {
            timer = 0f;
        }

        //Mouse


        float directX = ControllerManager.GetAxis(ControllerInputWrapper.Axis.LeftStickX, 1, true);
        float directY = ControllerManager.GetAxis(ControllerInputWrapper.Axis.LeftStickY, 1, true);

        switch (currentType)
        {
        case ActionType.Play:


            if (ControllerManager.GetButton(ControllerInputWrapper.Buttons.A, 1, true) ||
                ControllerManager.GetButton(ControllerInputWrapper.Buttons.A, 2, true) ||
                ControllerManager.GetButton(ControllerInputWrapper.Buttons.A, 3, true) ||
                ControllerManager.GetButton(ControllerInputWrapper.Buttons.A, 4, true) &&
                !scrollPanel.isPlaying)
            {
                selectAS.Stop();
                selectAS.Play();
                WhiteOut();
            }
            if (directX < -0.05f || directY < -0.05f && actionReady && !scrollPanel.isPlaying)
            {
                scrollAS.Stop();
                scrollAS.Play();
                currentType = ActionType.Credits;
                actionReady = false;
            }
            break;

        case ActionType.Credits:
            if (ControllerManager.GetButton(ControllerInputWrapper.Buttons.A, 1, true) ||
                ControllerManager.GetButton(ControllerInputWrapper.Buttons.A, 2, true) ||
                ControllerManager.GetButton(ControllerInputWrapper.Buttons.A, 3, true) ||
                ControllerManager.GetButton(ControllerInputWrapper.Buttons.A, 4, true) &&
                !scrollPanel.isPlaying)
            {
                selectAS.Stop();
                selectAS.Play();
                creditsPanel.SetActive(true);
                scrollPanel.isPlaying = true;
            }
            if (directX > 0.05f || directY < -0.05f && actionReady && !scrollPanel.isPlaying)
            {
                scrollAS.Stop();
                scrollAS.Play();
                currentType = ActionType.Quit;
                actionReady = false;
            }
            if (directY > 0.05f && actionReady && !scrollPanel.isPlaying)
            {
                scrollAS.Stop();
                scrollAS.Play();
                currentType = ActionType.Play;
                actionReady = false;
            }
            break;

        case ActionType.Quit:
            if (ControllerManager.GetButtonAll(ControllerInputWrapper.Buttons.A, true))
            {
                selectAS.Stop();
                selectAS.Play();
                Application.Quit();
            }
            if (directX < -0.05f || directY > 0.05f && actionReady && !scrollPanel.isPlaying)
            {
                scrollAS.Stop();
                scrollAS.Play();
                currentType = ActionType.Credits;
                actionReady = false;
            }
            break;
        }
    }