Exemplo n.º 1
0
    public void PopulateStateRewardScreen(bool allowCommon, bool allowRare, bool allowBoss)
    {
        Debug.Log("RewardScreen.PopulateStateRewardScreen() called...");

        // get potential state rewards
        List <StateDataSO> viableStates = new List <StateDataSO>();

        if (allowCommon)
        {
            viableStates.AddRange(StateLibrary.Instance.GetAllCommonStates());
        }
        if (allowRare)
        {
            viableStates.AddRange(StateLibrary.Instance.GetAllRareStates());
        }
        if (allowBoss)
        {
            viableStates.AddRange(StateLibrary.Instance.GetAllBossStates());
        }

        // Generate random state for state reward 1
        GameObject newStateOne = Instantiate(PrefabHolder.Instance.StateCard, ChooseStateScreenContent.transform);
        StateCard  stateOne    = newStateOne.GetComponent <StateCard>();

        stateOne.BuildFromStateData(viableStates[Random.Range(0, viableStates.Count)]);
        currentStateOne = newStateOne;

        // Generate random state for state reward 2
        GameObject newStateTwo = Instantiate(PrefabHolder.Instance.StateCard, ChooseStateScreenContent.transform);
        StateCard  stateTwo    = newStateTwo.GetComponent <StateCard>();

        stateTwo.BuildFromStateData(viableStates[Random.Range(0, viableStates.Count)]);
        currentStateTwo = newStateTwo;

        // Prevent duplicate items appearing as reward: Reroll item until we get a non-duplicate
        while (stateTwo.myStateData.stateName == stateOne.myStateData.stateName)
        {
            Debug.Log("RewardScreen.PopulateStateScreen() detected a duplicate state reward, rerolling state two...");
            stateTwo.BuildFromStateData(viableStates[Random.Range(0, viableStates.Count)]);
        }

        // Generate random state for state reward 3
        GameObject newStateThree = Instantiate(PrefabHolder.Instance.StateCard, ChooseStateScreenContent.transform);
        StateCard  stateThree    = newStateThree.GetComponent <StateCard>();

        stateThree.BuildFromStateData(viableStates[Random.Range(0, viableStates.Count)]);
        currentStateThree = newStateThree;

        // Prevent duplicate items appearing as reward: Reroll item until we get a non-duplicate
        while (stateThree.myStateData.stateName == stateOne.myStateData.stateName ||
               stateThree.myStateData.stateName == stateTwo.myStateData.stateName)
        {
            Debug.Log("RewardScreen.PopulateStateScreen() detected a duplicate state reward, rerolling state three...");
            stateThree.BuildFromStateData(viableStates[Random.Range(0, viableStates.Count)]);
        }
    }
Exemplo n.º 2
0
 void OnMouseDown()
 {
     if (ControlCard.flippedCards < 2)
     {
         if (stateCard == StateCard.FLIP && flipCard == FlipCard.BACK)
         {
             iTween.Stab(gameObject, audioClick, 0);
             flipping();
         }
         else if (stateCard == StateCard.DRAG_AND_DROP)
         {
             screenPoint = Camera.main.WorldToScreenPoint(gameObject.transform.position);
             offset      = transform.position - Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, screenPoint.z));
             stateCard   = StateCard.DRAGGED;
         }
     }
 }
Exemplo n.º 3
0
    public void flipping()
    {
        stateCard = StateCard.BLOCK;

        if (flipCard == FlipCard.BACK)
        {
            ControlCard.flippedCards++;
            flipCard = FlipCard.FRONT;
            if (ControlCard.flippedCards == 1)
            {
                ControlCard.card1 = gameObject;

                iTween.MoveBy(gameObject, iTween.Hash("z", -upEffect, "time", timeUpEffect));

                iTween.RotateBy(gameObject, iTween.Hash("y", .5, "time", timeRotate, "easeType", "easeInOutBack", "delay", timeUpEffect));
            }
            else if (ControlCard.flippedCards == 2)
            {
                ControlCard.card2 = gameObject;

                iTween.MoveBy(gameObject, iTween.Hash("z", -upEffect, "time", timeUpEffect));

                iTween.RotateBy(gameObject, iTween.Hash("y", .5, "time", timeRotate, "easeType", "easeInOutBack", "delay", timeUpEffect, "onComplete", "setStateCardFlip"));
            }
        }
        else
        {
            flipCard = FlipCard.BACK;

            iTween.MoveBy(gameObject, iTween.Hash("z", -upEffect, "time", timeUpEffect));

            iTween.RotateBy(gameObject, iTween.Hash("y", -.5, "time", timeRotate/2, "easeType", "easeInOutBack", "delay", timeUpEffect, "onComplete", "setStateCardFlip"));

            iTween.Stab(gameObject, audioError, timeUpEffect);
            iTween.ShakePosition(gameObject, iTween.Hash("y", .1f, "x", .1f, "z", .1f, "time", .1f, "delay", timeUpEffect, "onComplete", "setGameStateFree"));

        }
    }
Exemplo n.º 4
0
    public void flipping()
    {
        stateCard = StateCard.BLOCK;

        if (flipCard == FlipCard.BACK)
        {
            ControlCard.flippedCards++;
            flipCard = FlipCard.FRONT;
            if (ControlCard.flippedCards == 1)
            {
                ControlCard.card1 = gameObject;

                iTween.MoveBy(gameObject, iTween.Hash("z", -upEffect, "time", timeUpEffect));

                iTween.RotateBy(gameObject, iTween.Hash("y", .5, "time", timeRotate, "easeType", "easeInOutBack", "delay", timeUpEffect));
            }
            else if (ControlCard.flippedCards == 2)
            {
                ControlCard.card2 = gameObject;

                iTween.MoveBy(gameObject, iTween.Hash("z", -upEffect, "time", timeUpEffect));

                iTween.RotateBy(gameObject, iTween.Hash("y", .5, "time", timeRotate, "easeType", "easeInOutBack", "delay", timeUpEffect, "onComplete", "setStateCardFlip"));
            }
        }
        else
        {
            flipCard = FlipCard.BACK;

            iTween.MoveBy(gameObject, iTween.Hash("z", -upEffect, "time", timeUpEffect));

            iTween.RotateBy(gameObject, iTween.Hash("y", -.5, "time", timeRotate / 2, "easeType", "easeInOutBack", "delay", timeUpEffect, "onComplete", "setStateCardFlip"));

            iTween.Stab(gameObject, audioError, timeUpEffect);
            iTween.ShakePosition(gameObject, iTween.Hash("y", .1f, "x", .1f, "z", .1f, "time", .1f, "delay", timeUpEffect, "onComplete", "setGameStateFree"));
        }
    }
Exemplo n.º 5
0
 void setStateCardDragDrod()
 {
     stateCard = StateCard.DRAG_AND_DROP;
 }
Exemplo n.º 6
0
 void setStateCardFlip()
 {
     stateCard = StateCard.FLIP;
     ControlCard.cardFlip();
 }
Exemplo n.º 7
0
 void setStateCardDragAndDrop()
 {
     stateCard = StateCard.DRAG_AND_DROP;
 }
Exemplo n.º 8
0
 void setStateCardFlip()
 {
     stateCard = StateCard.FLIP;
     ControlCard.cardFlip();
 }
Exemplo n.º 9
0
 void setStateCardDragDrod()
 {
     stateCard = StateCard.DRAG_AND_DROP;
 }
Exemplo n.º 10
0
 void setStateCardDragAndDrop()
 {
     stateCard = StateCard.DRAG_AND_DROP;
 }
Exemplo n.º 11
0
    void OnMouseDown()
    {
        if (ControlCard.flippedCards < 2)
        {
            if (stateCard == StateCard.FLIP && flipCard == FlipCard.BACK)
            {
                iTween.Stab(gameObject, audioClick, 0);
                flipping();
            }
            else if (stateCard == StateCard.DRAG_AND_DROP)
            {
                screenPoint = Camera.main.WorldToScreenPoint(gameObject.transform.position);
                offset = transform.position - Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, screenPoint.z));
                stateCard = StateCard.DRAGGED;
            }

        }
    }