示例#1
0
        private void UpdateHat()
        {
            QuackingTimeData _data = SaveManager.LoadQuackingTime();

            switch (Ducks)
            {
            case DuckPlayers.P1:
                SelectedHat = (DuckHats)_data.player1HatSelection;
                break;

            case DuckPlayers.P2:
                SelectedHat = (DuckHats)_data.player2HatSelection;
                break;

            default:
                break;
            }

            switch (SelectedHat)
            {
            case DuckHats.TopHat:

                transform.Find("HatSlot").transform.Find("TopHat").gameObject.SetActive(true);
                transform.Find("HatSlot").transform.Find("SantaHat").gameObject.SetActive(false);
                transform.Find("HatSlot").transform.Find("PartyHat").gameObject.SetActive(false);
                transform.Find("HatSlot").transform.Find("DuckHat").gameObject.SetActive(false);
                transform.Find("HatSlot").transform.Find("SumHat").gameObject.SetActive(false);
                transform.Find("HatSlot").transform.Find("VikingHat").gameObject.SetActive(false);

                break;

            case DuckHats.Santa:

                transform.Find("HatSlot").transform.Find("TopHat").gameObject.SetActive(false);
                transform.Find("HatSlot").transform.Find("SantaHat").gameObject.SetActive(true);
                transform.Find("HatSlot").transform.Find("PartyHat").gameObject.SetActive(false);
                transform.Find("HatSlot").transform.Find("DuckHat").gameObject.SetActive(false);
                transform.Find("HatSlot").transform.Find("SumHat").gameObject.SetActive(false);
                transform.Find("HatSlot").transform.Find("VikingHat").gameObject.SetActive(false);

                break;

            case DuckHats.Party:

                transform.Find("HatSlot").transform.Find("TopHat").gameObject.SetActive(false);
                transform.Find("HatSlot").transform.Find("SantaHat").gameObject.SetActive(false);
                transform.Find("HatSlot").transform.Find("PartyHat").gameObject.SetActive(true);
                transform.Find("HatSlot").transform.Find("DuckHat").gameObject.SetActive(false);
                transform.Find("HatSlot").transform.Find("SumHat").gameObject.SetActive(false);
                transform.Find("HatSlot").transform.Find("VikingHat").gameObject.SetActive(false);

                break;

            case DuckHats.None:

                transform.Find("HatSlot").transform.Find("TopHat").gameObject.SetActive(false);
                transform.Find("HatSlot").transform.Find("SantaHat").gameObject.SetActive(false);
                transform.Find("HatSlot").transform.Find("PartyHat").gameObject.SetActive(false);
                transform.Find("HatSlot").transform.Find("DuckHat").gameObject.SetActive(false);
                transform.Find("HatSlot").transform.Find("SumHat").gameObject.SetActive(false);
                transform.Find("HatSlot").transform.Find("VikingHat").gameObject.SetActive(false);

                break;

            case DuckHats.Duck:

                transform.Find("HatSlot").transform.Find("TopHat").gameObject.SetActive(false);
                transform.Find("HatSlot").transform.Find("SantaHat").gameObject.SetActive(false);
                transform.Find("HatSlot").transform.Find("PartyHat").gameObject.SetActive(false);
                transform.Find("HatSlot").transform.Find("DuckHat").gameObject.SetActive(true);
                transform.Find("HatSlot").transform.Find("SumHat").gameObject.SetActive(false);
                transform.Find("HatSlot").transform.Find("VikingHat").gameObject.SetActive(false);

                break;

            case DuckHats.Sum:

                transform.Find("HatSlot").transform.Find("TopHat").gameObject.SetActive(false);
                transform.Find("HatSlot").transform.Find("SantaHat").gameObject.SetActive(false);
                transform.Find("HatSlot").transform.Find("PartyHat").gameObject.SetActive(false);
                transform.Find("HatSlot").transform.Find("DuckHat").gameObject.SetActive(false);
                transform.Find("HatSlot").transform.Find("SumHat").gameObject.SetActive(true);
                transform.Find("HatSlot").transform.Find("VikingHat").gameObject.SetActive(false);

                break;

            case DuckHats.Viking:

                transform.Find("HatSlot").transform.Find("TopHat").gameObject.SetActive(false);
                transform.Find("HatSlot").transform.Find("SantaHat").gameObject.SetActive(false);
                transform.Find("HatSlot").transform.Find("PartyHat").gameObject.SetActive(false);
                transform.Find("HatSlot").transform.Find("DuckHat").gameObject.SetActive(false);
                transform.Find("HatSlot").transform.Find("SumHat").gameObject.SetActive(false);
                transform.Find("HatSlot").transform.Find("VikingHat").gameObject.SetActive(true);

                break;

            default:
                break;
            }
        }
示例#2
0
        protected override void Update()
        {
            switch (ControllerType)
            {
            case SupportedControllers.ArcadeBoard:

                // Player 1
                if ((ArcadeControls.JoystickLeft(Joysticks.White) && (!IsCoR_P1) && (!ReadyP1)))
                {
                    StartCoroutine(ToggleSelP1(1));
                }
                if ((ArcadeControls.JoystickRight(Joysticks.White) && (!IsCoR_P1) && (!ReadyP1)))
                {
                    StartCoroutine(ToggleSelP1(-1));
                }

                if (ArcadeControls.ButtonPress(Joysticks.White, Buttons.B8))
                {
                    am.Play("Menu_Select", .75f);
                    ReadyP1          = !ReadyP1;
                    Ready[0].enabled = ReadyP1;
                }

                if (ArcadeControls.ButtonPress(Joysticks.White, Buttons.B7))
                {
                    am.Play("Confirm", .25f);
                    SC.MoveToDucks  = false;
                    SC.MoveToRounds = true;
                    RSC.enabled     = true;
                    this.enabled    = false;
                }

                // Player 2
                if ((ArcadeControls.JoystickLeft(Joysticks.Black) && (!IsCoR_P2) && (!ReadyP2)))
                {
                    StartCoroutine(ToggleSelP2(1));
                }
                if ((ArcadeControls.JoystickRight(Joysticks.Black) && (!IsCoR_P2) && (!ReadyP2)))
                {
                    StartCoroutine(ToggleSelP2(-1));
                }

                if (ArcadeControls.ButtonPress(Joysticks.Black, Buttons.B8))
                {
                    am.Play("Menu_Select", .75f);
                    ReadyP2          = !ReadyP2;
                    Ready[1].enabled = ReadyP2;
                }

                break;

            case SupportedControllers.GamePadBoth:

                // Player 1
                if ((ControllerControls.ControllerLeft(Players.P1) && (!IsCoR_P1) && (!ReadyP1)))
                {
                    StartCoroutine(ToggleSelP1(1));
                }
                if ((ControllerControls.ControllerRight(Players.P1) && (!IsCoR_P1) && (!ReadyP1)))
                {
                    StartCoroutine(ToggleSelP1(-1));
                }

                if (ControllerControls.ButtonPress(Players.P1, ControllerButtons.Confirm))
                {
                    am.Play("Menu_Select", .75f);
                    ReadyP1          = !ReadyP1;
                    Ready[0].enabled = ReadyP1;
                }

                if (ControllerControls.ButtonPress(Players.P1, ControllerButtons.B))
                {
                    am.Play("Confirm", .25f);
                    SC.MoveToDucks  = false;
                    SC.MoveToRounds = true;
                    RSC.enabled     = true;
                    this.enabled    = false;
                }

                // Player 2
                if ((ControllerControls.ControllerLeft(Players.P2) && (!IsCoR_P2) && (!ReadyP2)))
                {
                    StartCoroutine(ToggleSelP2(1));
                }
                if ((ControllerControls.ControllerRight(Players.P2) && (!IsCoR_P2) && (!ReadyP2)))
                {
                    StartCoroutine(ToggleSelP2(-1));
                }

                if (ControllerControls.ButtonPress(Players.P2, ControllerButtons.Confirm))
                {
                    am.Play("Menu_Select", .75f);
                    ReadyP2          = !ReadyP2;
                    Ready[1].enabled = ReadyP2;
                }

                break;

            case SupportedControllers.KeyboardBoth:

                if ((KeyboardControls.KeyboardLeft(Players.P1) && (!IsCoR_P1) && (!ReadyP1)))
                {
                    StartCoroutine(ToggleSelP1(1));
                }
                if ((KeyboardControls.KeyboardRight(Players.P1) && (!IsCoR_P1) && (!ReadyP1)))
                {
                    StartCoroutine(ToggleSelP1(-1));
                }

                if (KeyboardControls.ButtonPress(Players.P1, Buttons.B8))
                {
                    am.Play("Menu_Select", .75f);
                    ReadyP1          = !ReadyP1;
                    Ready[0].enabled = ReadyP1;
                }

                if (KeyboardControls.ButtonPress(Players.P1, Buttons.B7))
                {
                    am.Play("Confirm", .25f);
                    SC.MoveToDucks  = false;
                    SC.MoveToRounds = true;
                    RSC.enabled     = true;
                    this.enabled    = false;
                }

                // Player 2
                if ((KeyboardControls.KeyboardLeft(Players.P2) && (!IsCoR_P2) && (!ReadyP2)))
                {
                    StartCoroutine(ToggleSelP2(1));
                }
                if ((KeyboardControls.KeyboardRight(Players.P2) && (!IsCoR_P2) && (!ReadyP2)))
                {
                    StartCoroutine(ToggleSelP2(-1));
                }

                if (KeyboardControls.ButtonPress(Players.P2, Buttons.B8))
                {
                    am.Play("Menu_Select", .75f);
                    ReadyP2          = !ReadyP2;
                    Ready[1].enabled = ReadyP2;
                }

                break;

            case SupportedControllers.KeyboardP1ControllerP2:

                if ((KeyboardControls.KeyboardLeft(Players.P1) && (!IsCoR_P1) && (!ReadyP1)))
                {
                    StartCoroutine(ToggleSelP1(1));
                }
                if ((KeyboardControls.KeyboardRight(Players.P1) && (!IsCoR_P1) && (!ReadyP1)))
                {
                    StartCoroutine(ToggleSelP1(-1));
                }

                if (KeyboardControls.ButtonPress(Players.P1, Buttons.B8))
                {
                    am.Play("Menu_Select", .75f);
                    ReadyP1          = !ReadyP1;
                    Ready[0].enabled = ReadyP1;
                }

                if (KeyboardControls.ButtonPress(Players.P1, Buttons.B7))
                {
                    am.Play("Confirm", .25f);
                    SC.MoveToDucks  = false;
                    SC.MoveToRounds = true;
                    RSC.enabled     = true;
                    this.enabled    = false;
                }

                if ((ControllerControls.ControllerLeft(Players.P1) && (!IsCoR_P2) && (!ReadyP2)))
                {
                    StartCoroutine(ToggleSelP2(1));
                }
                if ((ControllerControls.ControllerRight(Players.P1) && (!IsCoR_P2) && (!ReadyP2)))
                {
                    StartCoroutine(ToggleSelP2(-1));
                }

                if (ControllerControls.ButtonPress(Players.P1, ControllerButtons.A))
                {
                    am.Play("Menu_Select", .75f);
                    ReadyP2          = !ReadyP2;
                    Ready[1].enabled = ReadyP2;
                }

                break;

            case SupportedControllers.KeyboardP2ControllerP1:

                if ((ControllerControls.ControllerLeft(Players.P1) && (!IsCoR_P1) && (!ReadyP1)))
                {
                    StartCoroutine(ToggleSelP1(1));
                }
                if ((ControllerControls.ControllerRight(Players.P1) && (!IsCoR_P1) && (!ReadyP1)))
                {
                    StartCoroutine(ToggleSelP1(-1));
                }

                if (ControllerControls.ButtonPress(Players.P1, ControllerButtons.A))
                {
                    am.Play("Menu_Select", .75f);
                    ReadyP1          = !ReadyP1;
                    Ready[0].enabled = ReadyP1;
                }

                if (ControllerControls.ButtonPress(Players.P1, ControllerButtons.B))
                {
                    am.Play("Confirm", .25f);
                    SC.MoveToDucks  = false;
                    SC.MoveToRounds = true;
                    RSC.enabled     = true;
                    this.enabled    = false;
                }

                if ((KeyboardControls.KeyboardLeft(Players.P1) && (!IsCoR_P2) && (!ReadyP2)))
                {
                    StartCoroutine(ToggleSelP2(1));
                }
                if ((KeyboardControls.KeyboardRight(Players.P1) && (!IsCoR_P2) && (!ReadyP2)))
                {
                    StartCoroutine(ToggleSelP2(-1));
                }

                if (KeyboardControls.ButtonPress(Players.P1, Buttons.B8))
                {
                    am.Play("Menu_Select", .75f);
                    ReadyP2          = !ReadyP2;
                    Ready[1].enabled = ReadyP2;
                }

                break;

            default:
                break;
            }

            if (ReadyP1 && ReadyP2)
            {
                QuackingTimeData _data = new QuackingTimeData(Duck1Pos, Duck2Pos);
                SaveManager.SaveQuackingTime(_data);
                ChangeScene.ChangeToLevel();
            }
        }