Example #1
0
    void addTextValueChanges(modifierGroup modsGroup, valueDefinitions.values v, ref float newValue, ref bool randomIndependent)
    {
        //Debug.Log("Result 1 has " + modsGroup.valueChanges.Length + " elements");
        foreach (resultModifier rm in modsGroup.valueChanges)
        {
            if (rm.modifier == v)//only for matching values
            {
                switch (rm.modificationType)
                {
                case E_ModificationType.add:
                    newValue += rm.valueAdd;
                    break;

                case E_ModificationType.set:
                    ValueScript vs = valueManager.instance.getFirstFittingValue(rm.modifier);
                    newValue = rm.valueSet - vs.value;
                    break;

                case E_ModificationType.addRandom:
                case E_ModificationType.addRandInt:
                case E_ModificationType.setRandInt:
                case E_ModificationType.setRandom:
                default:
                    //change/set is unknown...
                    newValue          = 0f;
                    randomIndependent = false;
                    break;
                }
                //Debug.Log(v.ToString() +" "+ newValue.ToString());
            }
        }
    }
Example #2
0
    //execution of a group of value modifications
    void executeValueChanges(modifierGroup modsGroup)
    {
        //reset the user info
        //InfoDisplay.instance.clearDisplay ();

        foreach (resultModifier rm in  modsGroup.valueChanges)
        {
            valueManager.instance.changeValue(rm.modifier, rm.valueAdd);
        }

        //Tell the cardstack the follow up card.
        //Follow up card can be NULL, the cardstack itself checks the cards before spawning.
        CardStack.instance.followUpCard = modsGroup.followUpCard;

        //show the value changes over the animation (if available)
        //InfoDisplay.instance.startAnimationIfNotEmpty();
    }
Example #3
0
    //add element preview of a group of value modifications
    void addPreviewValueChanges(modifierGroup modsGroup, bool randomIndependent = true)
    {
        if (modsGroup.valueChanges == null)
        {
            Debug.LogError("Can not show preview, modifier group is null.");
            return;
        }

        foreach (resultModifier rm in  modsGroup.valueChanges)
        {
            resultModifierPreview rmp = new resultModifierPreview();
            rmp.resultModification = new resultModifier();
            rmp.modificationIsRandomIndependant = randomIndependent;
            rmp.resultModification.modifier     = rm.modifier;
            rmp.resultModification.valueAdd     = rm.valueAdd;
            previewModifiers.Add(rmp);
        }
    }
Example #4
0
    //add element preview of a group of value modifications
    void addPreviewValueChanges(modifierGroup modsGroup, bool randomIndependent = true)
    {
        if (modsGroup.valueChanges == null)
        {
            Debug.LogError("Can not show preview, modifier group is null.");
            return;
        }

        foreach (resultModifier rm in  modsGroup.valueChanges)
        {
            resultModifierPreview rmp = new resultModifierPreview();
            rmp.resultModification = new resultModifier();

            switch (rm.modificationType)
            {
            case E_ModificationType.add:
                rmp.resultModification.valueAdd     = rm.valueAdd;
                rmp.modificationIsRandomIndependant = randomIndependent;
                break;

            case E_ModificationType.set:
                ValueScript vs = valueManager.instance.getFirstFittingValue(rm.modifier);
                rmp.resultModification.valueAdd     = rm.valueSet - vs.value;
                rmp.modificationIsRandomIndependant = randomIndependent;
                break;

            case E_ModificationType.addRandInt:
            case E_ModificationType.setRandInt:
            case E_ModificationType.addRandom:
            case E_ModificationType.setRandom:
            default:
                rmp.resultModification.valueAdd     = 0f;
                rmp.modificationIsRandomIndependant = false;
                break;
            }

            rmp.resultModification.modifier = rm.modifier;

            previewModifiers.Add(rmp);
        }
    }
Example #5
0
    //execution of a group of value modifications
    static void executeValueChanges(modifierGroup modsGroup, bool actualizeFollowUpCard)
    {
        //reset the user info
        //InfoDisplay.instance.clearDisplay ();

        foreach (resultModifier rm in  modsGroup.valueChanges)
        {
            executeValueChange(rm);
        }

        executeExtraChanges(modsGroup.extras);

        //Tell the cardstack the follow up card.
        //Follow up card can be NULL, the cardstack itself checks the cards before spawning.
        if (actualizeFollowUpCard == true)
        {
            CardStack.instance.decreaseFollowUpStackTime();

            if (modsGroup.followUpCard != null)
            {
                int followUpDelay = Random.Range(modsGroup.followUpDelay.min, modsGroup.followUpDelay.max + 1);

                if (followUpDelay == 0)
                {
                    CardStack.instance.followUpCard = modsGroup.followUpCard;
                }
                else
                {
                    CardStack.instance.followUpCard = CardStack.instance.getNextFollowUpCard();
                    CardStack.instance.addToFollowUpStack(modsGroup.followUpCard, followUpDelay);
                }
            }
            else
            {
                CardStack.instance.followUpCard = CardStack.instance.getNextFollowUpCard();
            }
        }

        //show the value changes over the animation (if available)
        //InfoDisplay.instance.startAnimationIfNotEmpty();
    }