Ejemplo n.º 1
0
    public eDecision GetDecision(SHUIWidget_Stick pStick, SHUIWidget_Monster pMonster)
    {
        if ((null == pStick) || (null == pMonster))
        {
            return(eDecision.Miss);
        }

        var fGap = Mathf.Abs(pMonster.GetLocalPosition().x - pStick.GetLocalPosition().x);
        var fSep = 50.0f;//pMonster.GetCollider().bounds.size.x / 3.0f;

        if (fGap <= (fSep * 0.5f))
        {
            return(eDecision.Good);
        }
        if (fGap <= (fSep * 1.5f))
        {
            return(eDecision.Normal);
        }
        if (fGap <= (fSep * 3.0f))
        {
            return(eDecision.Bad);
        }

        return(eDecision.Miss);
    }
Ejemplo n.º 2
0
 private SHUIWidget_Monster AddMonster(SHUIWidget_Monster pMonster)
 {
     if (null != pMonster)
     {
         m_pMonsters.Add(pMonster);
     }
     return(pMonster);
 }
Ejemplo n.º 3
0
    void ReturnStickObject(SHUIWidget_Monster pMonster)
    {
        if (null == pMonster)
        {
            return;
        }

        Single.ObjectPool.Return(pMonster.GetGameObject());
    }
Ejemplo n.º 4
0
    public float GetRatioToGap(SHUIWidget_Stick pStick, SHUIWidget_Monster pMonster)
    {
        if ((null == pStick) || (null == pMonster))
        {
            return(0.0f);
        }

        var fRatio = Mathf.Abs(pMonster.GetLocalPosition().x - pStick.GetLocalPosition().x) / 150.0f;        //pMonster.GetCollider().bounds.size.x;

        return(Mathf.Clamp(fRatio, 0.0f, 1.0f));
    }
Ejemplo n.º 5
0
    void SetMonsterSlot(eMonsterType eType, SHUIWidget_Monster pMonster, SHUIWidget_ItemSlot pSlot)
    {
        if ((null == pMonster) || (null == pSlot))
        {
            return;
        }

        SHGameObject.SetParent(pMonster.GetGameObject(), pSlot.GetGameObject());
        pMonster.Initialize(eType, 0.5f, 0.0f, 0.0f);
        pMonster.SetLocalPosition(Vector3.zero);
        pMonster.SetLocalScale(Vector3.one);
        pMonster.StopMoveTween();
        pMonster.SetActive(true);
    }
Ejemplo n.º 6
0
    public void Initialize(eMonsterType eType1, eMonsterType eType2)
    {
        ReturnStickObject(m_pLeftMonster);
        ReturnStickObject(m_pRightMonster);
        SetMonsterSlot(
            (m_eLeftType = eType1),
            (m_pLeftMonster = CreateMonsterSlot(eType1)),
            m_pLeftSlot);
        SetMonsterSlot(
            (m_eRightType = eType2),
            (m_pRightMonster = CreateMonsterSlot(eType2)),
            m_pRightSlot);

        SetGoodsState();
    }
Ejemplo n.º 7
0
    void SetCrash(SHUIWidget_Monster pMonster)
    {
        if (null == pMonster)
        {
            return;
        }

        if (false == pMonster.IsDie())
        {
            ChangeState(eState.Flick);
        }
        else
        {
            ChangeState(eState.Crash, pMonster);
        }
    }
Ejemplo n.º 8
0
    public eDirection GetDirection(SHUIWidget_Stick pStick, SHUIWidget_Monster pMonster)
    {
        if ((null != pStick) && (null != pMonster))
        {
            if (pMonster.GetLocalPosition().x < pStick.GetLocalPosition().x)
            {
                return(eDirection.Left);
            }

            if (pMonster.GetLocalPosition().x > pStick.GetLocalPosition().x)
            {
                return(eDirection.Right);
            }
        }

        return(SHMath.RandomN(new List <eDirection>()
        {
            eDirection.Left,
            eDirection.Right,
        }));
    }
Ejemplo n.º 9
0
    public void OnClickToSlot(SHUIWidget_Monster pMonster)
    {
        if (null == pMonster)
        {
            return;
        }

        var eUseType = Single.Inventory.GetMonsterGoodsStateToPlayerPrefs(pMonster.m_eType);

        switch (eUseType)
        {
        case eGoodsState.NotHas:
            if (Single.Inventory.m_iCoin < pMonster.GetPrice())
            {
                Single.UI.ShowNotice("알림",
                                     string.Format("{0} 코인이 부족합니다.", pMonster.GetPrice() - Single.Inventory.m_iCoin));
            }
            else
            {
                Single.UI.ShowNotice_TwoBtn("알림",
                                            string.Format("{0} 코인을 소모합니다.\n구매 하시겠습니까?", pMonster.GetPrice()),
                                            () =>
                {
                    Single.Inventory.ConsumeCoin(pMonster.GetPrice());
                    Single.Inventory.SetMonsterTypeToPlayerPrefs(pMonster.m_eType, eGoodsState.Enable);
                }, null);
            }
            break;

        case eGoodsState.Disable:
            Single.Inventory.SetMonsterTypeToPlayerPrefs(pMonster.m_eType, eGoodsState.Enable);
            break;

        case eGoodsState.Enable:
            Single.Inventory.SetMonsterTypeToPlayerPrefs(pMonster.m_eType, eGoodsState.Disable);
            break;
        }
        RefleshSlotForSelect();
    }