Esempio n. 1
0
    /// <summary>
    /// 구매 버튼
    /// </summary>
    public void OnBuyBtn()
    {
        // 버튼음 재생
        GameManager.Instance.SoundManager.PlaySFX(AudioNameConstant.BUTTON_SOUND);

        // 선택한 아이템 구매 처리
        if (selectItem != null)
        {
            selectItem.Buy();
        }

        // 장착 슬롯 UI 변경
        EquipSlotPanel equipSlotPanel = PanelManager.GetPanel(typeof(EquipSlotPanel)) as EquipSlotPanel;

        equipSlotPanel.ChangedEquipSlot(GameManager.Instance.GetCurrentSceneManager <LobbySceneManager>().DisplayPlayer);
    }
Esempio n. 2
0
    //Handles input from player
    void Update()
    {
        //select J
        if (Input.GetKeyDown(KeyCode.J))
        {
            SmallItemSlot.ShowDescriptionPanel();
            MediumItemSlot.HideDescriptionPanel();
            LargeItemSlot.HideDescriptionPanel();
            choice = (int)Choices.Small;
        }
        if (Input.GetKeyDown(KeyCode.K))
        {
            SmallItemSlot.HideDescriptionPanel();
            MediumItemSlot.ShowDescriptionPanel();
            LargeItemSlot.HideDescriptionPanel();
            choice = (int)Choices.Medium;
        }
        if (Input.GetKeyDown(KeyCode.L))
        {
            SmallItemSlot.HideDescriptionPanel();
            MediumItemSlot.HideDescriptionPanel();
            LargeItemSlot.ShowDescriptionPanel();
            choice = (int)Choices.Large;
        }

        if (Input.GetKey(KeyCode.A) && Input.GetKey(KeyCode.D))
        {
            HoldADTime += Time.deltaTime;
            HoldADFill.transform.localScale = new Vector3(HoldADTime, 1, 1);
            print("been holding for " + (int)HoldADTime);
            if (HoldADTime > 1f)
            {
                ChangeSceneScript.ChangeScene(nextScene);
            }
        }

        if (Input.GetKeyUp(KeyCode.A) || Input.GetKeyUp(KeyCode.D))
        {
            HoldADTime = 0;
            HoldADFill.transform.localScale = new Vector3(HoldADTime, 1, 1);
            print("been holding for " + (int)HoldADTime);
        }
        if (Input.GetKey(KeyCode.Space))
        {
            HoldSpaceTime += Time.deltaTime;
            //don't stretch infinitely
            if (HoldSpaceTime < 1.01)
            {
                HoldSpaceFill.transform.localScale = new Vector3(HoldSpaceTime, 1, 1);
            }
            print("been holding for " + (int)HoldSpaceTime);
            if (HoldSpaceTime > 1f)
            {
                switch (choice)
                {
                case (int)Choices.None:
                    error.Play();
                    print("no selection");
                    break;

                case (int)Choices.Small:
                    SmallItemSlot.Buy();
                    break;

                case (int)Choices.Medium:
                    MediumItemSlot.Buy();
                    break;

                case (int)Choices.Large:
                    LargeItemSlot.Buy();
                    break;
                }
                HoldSpaceTime = 0f;
            }
        }
        if (Input.GetKeyUp(KeyCode.Space))
        {
            HoldSpaceTime = 0;
            HoldSpaceFill.transform.localScale = new Vector3(HoldSpaceTime, 1, 1);
            print("been holding for " + (int)HoldSpaceTime);
        }

        if (Input.GetKeyDown(KeyCode.A) || Input.GetKeyDown(KeyCode.D))
        {
            SmallItemSlot.HideDescriptionPanel();
            MediumItemSlot.HideDescriptionPanel();
            LargeItemSlot.HideDescriptionPanel();
            //reset choice nothing
            choice = (int)Choices.None;
        }
    }