void Update()
    {
        if (!isLocalPlayer)
        {
            return;
        }

        if (Input.GetButtonDown(InputConstants.ITEM_SCREEN))
        {
            _inventoryMenu.OpenMenu(new Vector2(825, 460));
            _characterMovement.enabled = false;
            _characterWeapon.enabled   = false;
            _cameraController.enabled  = false;
            Cursor.visible             = true;
            Cursor.lockState           = CursorLockMode.None;
            foreach (PiData data in _inventoryMenu.piData)
            {
                data.highlightedColor    = Color.cyan;
                data.nonHighlightedColor = Color.white;
            }
        }
        else if (Input.GetButtonUp(InputConstants.ITEM_SCREEN))
        {
            _inventoryMenu.CloseMenu();
            _characterMovement.enabled = true;
            _characterWeapon.enabled   = true;
            _cameraController.enabled  = true;
            Cursor.visible             = false;
            Cursor.lockState           = CursorLockMode.Locked;
        }

        Spawn();
    }
Beispiel #2
0
    private void SpawnNewPoi(PiUI.PiData poiNoteData, bool isRandom)
    {
        if (!isRandom)
        {
            if (!isPoiMenuOpen)
            {
                return;
            }

            poiNoteMenu.CloseMenu();
            isPoiMenuOpen = false;
        }
        else
        {
            if (Random.value > 0.5f)
            {
                nextPoiSize = PoiSizeType.BigPoi;
            }
            else
            {
                nextPoiSize = PoiSizeType.SmolPoi;
            }

            float personalityChance = Random.value;
            if (Random.value < 0.3f)
            {
                nextPoiPersonality = PoiPersonalityType.ShiPoi;
            }
            else if (Random.value < 0.6f)
            {
                nextPoiPersonality = PoiPersonalityType.NormiPoi;
            }
            else
            {
                nextPoiPersonality = PoiPersonalityType.FabPoi;
            }

            int randomNoteIndex = (int)Random.Range(0, poiNoteMenu.piData.Length - 0.5f);
            poiNoteData = poiNoteMenu.piData[randomNoteIndex];
        }
        nextPoiNote  = poiNoteData.order;
        nextPoiColor = poiNoteData.highlightedColor;

        poofEffectParticle.Play();
        spawnPoint.GetComponent <AudioSource>().Play();
        GameObject newPoi = Instantiate(poiPrefab, spawnPoint.position, Quaternion.identity);

        newPoi.GetComponent <PoiController>().SetPoiProperties(nextPoiSize, nextPoiNote, nextPoiColor, nextPoiPersonality);
    }
Beispiel #3
0
    private void ShowPoiNoteMenu(PiUI.PiData poiSizeData)
    {
        if (!Input.GetMouseButtonDown(0))
        {
            return;
        }
        switch (poiSizeData.sliceLabel)
        {
        case ("Big Poi"):
            nextPoiSize = PoiSizeType.BigPoi;
            break;

        case ("Smol Poi"):
            nextPoiSize = PoiSizeType.SmolPoi;
            break;
        }
        poiSizeMenu.CloseMenu();
        poiNoteMenu.OpenMenu(new Vector2(Screen.width / 2f, Screen.height / 2f));
    }
Beispiel #4
0
    /// <summary>
    /// Will open/close the menu name passed at the position passed.
    /// </summary>
    /// <param name="menuName">Menu to open or close.</param>
    /// <param name="pos">Position to open menu.</param>
    public void ChangeMenuState(string menuName, Vector2 pos = default(Vector2))
    {
        PiUI currentPi = GetPiUIOf(menuName);

        if (currentPi.openedMenu)
        {
            currentPi.CloseMenu( );
        }
        else
        {
            currentPi.OpenMenu(pos);
        }
    }
Beispiel #5
0
    private void ShowPoiSizeMenu(PiUI.PiData poiPersonalityData)
    {
        if (!Input.GetMouseButtonDown(0))
        {
            return;
        }
        switch (poiPersonalityData.sliceLabel)
        {
        case ("Shi Poi"):
            nextPoiPersonality = PoiPersonalityType.ShiPoi;
            break;

        case ("Normi Poi"):
            nextPoiPersonality = PoiPersonalityType.NormiPoi;
            break;

        case ("Fab Poi"):
            nextPoiPersonality = PoiPersonalityType.FabPoi;
            break;
        }
        poiPersonalityMenu.CloseMenu();
        poiSizeMenu.OpenMenu(new Vector2(Screen.width / 2f, Screen.height / 2f));
    }
Beispiel #6
0
    // Update is called once per frame
    void Update()
    {
        //Bool function that returns true if on a menu
        if (piUi.OverAMenu( ))
        {
            Debug.Log("You are over a menu");
        }
        else
        {
            Debug.Log("You are not over a menu");
        }
        //Just open the normal Menu if A is pressed
        // if (Input.GetKeyDown(KeyCode.A))
        // {
        //  Vector3 temp = Camera.main.ScreenToWorldPoint(Input.mousePosition);
        //  temp.z = 0;
        //  piUi.ChangeMenuState("Normal Menu",temp);
        // }
        // //Update the menu and add the Testfunction to the button action if s or Fire1 axis is pressed
        // if (Input.GetKeyDown(KeyCode.S) || Input.GetButtonDown("Fire1"))
        // {
        //     //Ensure menu isnt currently open on update just for a cleaner look
        //     if (!piUi.PiOpened("Normal Menu"))
        //     {
        //         int i = 0;
        //         //Iterate through the piData on normal menu
        //         foreach (PiUI.PiData data in normalMenu.piData)
        //         {
        //             //Changes slice label
        //             data.sliceLabel = "Test" + i.ToString( );
        //             //Creates a new unity event and adds the testfunction to it
        //             data.onSlicePressed = new UnityEngine.Events.UnityEvent( );
        //             data.onSlicePressed.AddListener(TestFunction);
        //             i++;
        //         }
        //         //Since PiUI.sliceCount or PiUI.equalSlices didnt change just calling update
        //         piUi.UpdatePiMenu("Normal Menu");
        //     }
        //     //Open or close the menu depending on it's current state at the center of the screne
        //     piUi.ChangeMenuState("Normal Menu", new Vector2(Screen.width / 2f, Screen.height / 2f));
        // }
        if (Input.GetKeyDown(KeyCode.D))
        {
            //Ensure menu isnt currently open on regenerate so it doesnt spasm
            if (!piUi.PiOpened("Normal Menu"))
            {
                //Make all angles equal
                normalMenu.equalSlices  = true;
                normalMenu.iconDistance = 0f;
                //Changes the piDataLength and adds new piData
                normalMenu.piData = new PiUI.PiData[10];
                for (int j = 0; j < 10; j++)
                {
                    normalMenu.piData[j] = new PiUI.PiData( );
                }
                //Turns of the syncing of colors
                normalMenu.syncColors = false;
                //Changes open/Close animations
                normalMenu.openTransition  = PiUI.TransitionType.Fan;
                normalMenu.closeTransition = PiUI.TransitionType.SlideRight;
                int i = 0;
                foreach (PiUI.PiData data in normalMenu.piData)
                {
                    //Turning off the interactability of a slice
                    if (i % 2 == 0)
                    {
                        data.isInteractable = false;
                    }
                    //Set new highlight/non highlight colors
                    data.nonHighlightedColor = new Color(1 - i / 10f, 0, 0, 1);
                    data.highlightedColor    = new Color(0, 0, 1 - i / 10f, 1);
                    data.disabledColor       = Color.grey;
                    //Changes slice label
                    data.sliceLabel = "Test" + i.ToString( );
                    //Creates a new unity event and adds the testfunction to it
                    data.onSlicePressed = new UnityEngine.Events.UnityEvent( );
                    data.onSlicePressed.AddListener(TestFunction);
                    i += 1;
                    //Enables hoverFunctions
                    data.hoverFunctions = true;
                    //Creates a new unity event to adds on hovers function
                    data.onHoverEnter = new UnityEngine.Events.UnityEvent( );
                    data.onHoverEnter.AddListener(OnHoverEnter);
                    data.onHoverExit = new UnityEngine.Events.UnityEvent( );
                    data.onHoverExit.AddListener(OnHoverExit);
                }
                piUi.RegeneratePiMenu("Normal Menu");
            }
            piUi.ChangeMenuState("Normal Menu", new Vector2(Screen.width / 2f, Screen.height / 2f));
        }

        //Set joystick input on the normal menu which the piPieces check
        normalMenu.joystickInput = new Vector2(Input.GetAxis("Horizontal"), Input.GetAxis("Vertical"));
        //Set the bool to detect if the controller button has been pressed
        normalMenu.joystickButton = Input.GetButtonDown("Fire1");
        //If the button isnt pressed check if has been released
        if (Input.GetButtonUp("Fire1"))
        {
            normalMenu.joystickButton = Input.GetButtonUp("Fire1");
            normalMenu.CloseMenu();
        }
    }