示例#1
0
        public float ApplyTo(StatusKeeper keeper, double deltaTime)
        {
            Symptom symptom = null;

            if (mSymptomLookup.TryGetValue(keeper.Name, out symptom))                   //if it's active...
            {
                if (symptom.IsActive(TimeSoFar))
                {
                    //apply to the actual value not the normalized value
                    float currentValue = keeper.Value;
                    //get the ACTUAL seek value as it applies to this keeper's seek value type
                    float seekValue = StatusKeeper.GetSeekValue(keeper.ActiveState.SeekType, symptom.SeekType, symptom.SeekValue);
                    //apply the value to the current value
                    return(Mathf.Lerp(currentValue, symptom.SeekValue, (float)(symptom.SeekSpeed * deltaTime)));
                }
                else                            //if it's not active just return the untouched value
                {
                    return(keeper.Value);
                }
            }
            else
            {
                return(keeper.Value);
            }
        }
示例#2
0
        //no need for time variables because we're applying the value from the last update
        public float ApplyTo(StatusKeeper keeper, float valueWithFlow)
        {
            //get the actual flow last update
            //first align it with the target keeper's type
            //then apply multipliers
            float flowLastUpdate = StatusKeeper.GetSeekValue(keeper.ActiveState.SeekType, FlowType, FlowLastUpdate);

            flowLastUpdate = flowLastUpdate *= FlowMultiplier;
            switch (FlowType)
            {
            case StatusSeekType.Positive:
            default:
                flowLastUpdate *= Globals.StatusKeeperPositiveFlowMultiplier;
                break;

            case StatusSeekType.Neutral:
                //don't adjust flow
                break;

            case StatusSeekType.Negative:
                flowLastUpdate *= Globals.StatusKeeperNegativeFlowMultiplier;
                break;
            }
            //now apply it to the keeper's value
            //apply to the actual value not the normalized value
            //yes this can result in crazy flow stuff but that's OK
            return(valueWithFlow + flowLastUpdate);
        }