Exemple #1
0
    protected override void InitializeActor()
    {
        SaveData saveData = GameManager.Instance.DataBase.SaveData;

        // 구입한 수류탄, tnt 전달
        GrenadeCount = saveData.grenadeCount;
        TntCount     = saveData.tntCount;

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

        equipSlotPanel.ChangedEquipSlot(this);
    }
Exemple #2
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);
    }
Exemple #3
0
    /* Called every time this panel is activated by the controller */
    public override void OnActivation()
    {
        //Clear old items
        for (int i = holdingPanel.childCount - 1; i >= 0; i--)
        {
            Destroy(holdingPanel.GetChild(i).gameObject);
        }

        //Set up new item displays
        displayed = examinedEquipment.equipmentSlots;
        switch (queuedAction)
        {
        case ItemAction.EQUIP:
            EquipableItem equip = queuedItem.held[0].equipable;
            displayed = displayed.FindAll(x => x.type.Contains(equip.primarySlot));
            if (displayed.Count == 0)
            {
                //TODO: Console log that you apparently can't wear this
                Debug.LogError($"Player can't equip, as they have no slots of type {equip.primarySlot}");
                return;
            }
            else if (displayed.Count == 1)
            {
                //You probably just want to equip this? We'll just go ahead and do it
                examinedEquipment.monster.SetAction(new EquipAction(queuedItem.position, displayed[0].position));
                //examinedEquipment.Equip(queuedItem.position, displayed[0].position);
                ExitAllWindows();
                break;
            }
            break;
        }

        //Sort the list into item types
        //ItemType currentType = ItemType.NONE;

        for (int i = 0; i < displayed.Count; i++)
        {
            GameObject     instance = Instantiate(EquipmentSlotPrefab);
            EquipSlotPanel current  = instance.GetComponent <EquipSlotPanel>();
            EquipmentSlot  slot     = displayed[i];

            //Set up item readout
            current.Setup(this, slot.position);
            current.RebuildGraphics();
            instance.transform.SetParent(holdingPanel);
        }
    }
Exemple #4
0
    /// <summary>
    /// 총기 모델 교체 함수
    /// </summary>
    /// <param name="selectGunIndex">교체할 총기 인덱스</param>
    public void ChangedGunModel(int selectGunIndex)
    {
        // 게임 매니저 캐싱
        GameManager gameManager = GameManager.Instance;

        // 변경할 총기 오브젝트 생성
        GameObject go = Instantiate(gameManager.GunModels[selectGunIndex]);

        // 부모 지정
        if (go != null)
        {
            go.transform.SetParent(transform);
        }

        Gun newGun = go.GetComponent <Gun>();

        if (newGun != null)
        {
            // 장착 중인 총기 비활성 및 장착총기 NULL값 초기화
            SetActivatedGunModel(EquipGun.gameObject, false);
            EquipGun = null;

            // 보조무기인 경우
            if (newGun is Pistol)
            {
                // 선택된 총기 인덱스 저장
                gameManager.DataBase.SaveData.subGunIndex = selectGunIndex;

                // 보조무기 교체
                if (SubGun != null)
                {
                    Destroy(SubGun.gameObject);
                }
                SubGun = newGun;

                // 무기에 따른 애니메이션 셋 변경
                SetBaseAnimation(WeaponStyle.PISTOL);
            }
            else // 주무기인경우
            {
                // 선택된 총기 인덱스 저장
                gameManager.DataBase.SaveData.mainGunIndex = selectGunIndex;

                // 주무기 교체
                if (MainGun != null)
                {
                    Destroy(MainGun.gameObject);
                }
                MainGun = newGun;

                // 무기에 따른 애니메이션 셋 변경
                SetBaseAnimation(WeaponStyle.WEAPON);
            }

            // 총꺼내는 애니메이션 재생
            Animator.PlayAnimator(AnimationConstantName.DRAW);

            // 장착 총기 설정
            EquipGun = newGun;
        }

        // 저장
        gameManager.DataBase.Save();

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

        equipSlotPanel.ChangedEquipSlot(this);
    }