Ejemplo n.º 1
0
    void Update()
    {
        if (InGameManager.InGameInstance.m_curGameState
            == InGameManager.eGameState.ReadyForPlay)
        {
            eAState = eAniState.Idle;
            m_curHp = m_hp;

            if (m_isBeginHeld == true)
            {
                Vector3 mousePos;
                mousePos = Input.mousePosition;
                mousePos = Camera.main.ScreenToWorldPoint(mousePos);

                this.gameObject.transform.localPosition = new Vector3(mousePos.x - m_startPosX, mousePos.y - m_startPosY, 0);

                //----- Ray를 쏘아 태그를 판별해서 이벤트를 발생시킬 부분 -----
                Vector2      touchPos = new Vector2(mousePos.x, mousePos.y);
                Ray2D        ray      = new Ray2D(touchPos, Vector2.zero);
                RaycastHit2D hit      = Physics2D.Raycast(ray.origin, ray.direction);

                // 캐릭터 팔기
                if (hit.collider.tag == "Sell")
                {
                    m_isSell = true;
                }
                else
                {
                    m_isSell = false;
                }
                // 캐릭터 팔기

                // 캐릭터 슬롯 이동
                if (hit.collider.tag == "MoveCharacter")
                {
                    // Debug.Log("Move Char");
                    m_isActive   = false;
                    m_movSlotNum = (int)hit.collider.gameObject.GetComponent <CharacterSlot>().eNum;
                }
                else
                {
                    m_isActive = true;
                }
                // 캐릭터 슬롯 이동

                //----- Ray를 쏘아 태그를 판별해서 이벤트를 발생시킬 부분 -----
            }
        }
        else if (theInGame.m_curGameState == InGameManager.eGameState.WaitPlayTime)
        {
            for (int n = 0; n < theInGame.m_isCharSlotOn.Length; n++)
            {
                theInGame.m_cardZone[n].gameObject.SetActive(false);
            }

            // 판매 UI Off
            theCardInfo.SellOff();
            theCardInfo.OffInfoPanel();
            // 판매 UI Off

            this.transform.position = m_originPos;
        }

        CharacterAniState();
    }
Ejemplo n.º 2
0
    /// <summary>
    /// 전투 준비 전 단계
    /// </summary>
    public void ReadyForGamePlay()
    {
        if (m_timer.value <= .0f)
        {
            bool isAllEmpty = true;
            for (int n = 0; n < m_isCharSlotOn.Length; n++)
            {
                if (m_isCharSlotOn[n] == false)
                {
                    isAllEmpty = false;
                }
            }
            if (isAllEmpty == true)
            {
                m_curGameState = eGameState.Result;
                StartCoroutine(ShowLoseTxt("Y o u  L o s e..", 2.5f));
                PlayerPrefs.DeleteAll();

                return;
            }

            // 설치존 SetActive 끈다
            for (int n = 0; n < 9; n++)
            {
                m_cardZone[n].SetActive(false);
            }
            // 설치존 SetActive 끈다

            m_timer.value = 1.0f;
            m_skipReadyForPlayBtn.SetActive(false);             // 스킵 버튼 끄기
            m_shopBtn.GetComponent <Button>().enabled = false;  // Shop 버튼 사용 끄기
            OffShopUI();                                        // Shop UI 끄기
            theCardInfo.OffInfoPanel();                         // 정보패널 끄기

            // Which Slot에 What kind Character 설치되어 있는지 저장
            string a_charActive = "";
            string a_charLevel  = "";
            for (int n = 0; n < m_isActiveMyCard.Length; n++)
            {
                if (m_isActiveMyCard[n] == true)
                {// 해당 슬롯에 캐릭터가 있다.
                    a_charActive = a_charActive + 1.ToString();
                    a_charLevel  = a_charLevel + this.transform.GetChild(n).GetComponent <CharController>().m_level.ToString();
                }
                else
                {// 해당 슬롯에 캐릭터가 없다
                    a_charActive = a_charActive + 0.ToString();
                    a_charLevel  = a_charLevel + 0.ToString();
                }

                if (n < m_isActiveMyCard.Length - 1)
                {
                    a_charActive = a_charActive + ",";
                    a_charLevel  = a_charLevel + ",";
                }
            }
            PlayerPrefs.SetString("CharActiveNum", a_charActive);
            PlayerPrefs.SetString("CharLevel", a_charLevel);
            // Which Slot에 What kind Character 설치되어 있는지 저장
            Debug.Log(a_charLevel);


            // Character로 된 tag 객체들 모조리 찾아오기.
            GameObject[] charic = GameObject.FindGameObjectsWithTag("Character");
            foreach (GameObject obj in charic)
            {
                if (obj != null)
                {
                    m_myCard.Add(obj);
                }
            }
            Debug.Log("m_myCard : " + m_myCard.Count);
            // Character로 된 tag 객체들 모조리 찾아오기.

            m_curGameState = eGameState.WaitPlayTime;
            return;
        }

        m_timer.value -= Time.deltaTime / 22;
        // Debug.Log(m_timer.value);

        // 실시간 돈 업데이트
        m_moneyTxt.text = m_money.ToString();
        // 실시간 돈 업데이트
    }