Beispiel #1
0
        virtual public void EvaluateNextState()
        {
            //Check state with highest input
            float highestInput = float.MinValue;
            State highestState = null;

            foreach (State state in _stateList.Values)
            {
                float input = state.CalculateCurrentInputSignal();
                //Add info in all states about input (for balancing)
                state.SetBalanceLastInput(input);
                if (input <= 0)
                {
                    continue;
                }
                if (input > highestInput)
                {
                    highestInput = input;
                    highestState = state;
                }
                else if (input == highestInput)
                {
                    highestInput = input;
                    if (highestState == null || state.PositionY < highestState.PositionY)
                    {
                        highestState = state;
                    }
                }
            }
            _nextState = highestState;
            //Add info in state that was next state (for balancing)
            _nextState.SetBalanceNextState(true);
            _nextState.SetBalanceLastTimeUsed(VirtualTime.GetCurrentTime());
        }
Beispiel #2
0
        public float CalulateSignal(float decay)
        {
            float loss          = (VirtualTime.GetCurrentTime() - TimeOfOutput) * decay;
            int   startOfSignal = VirtualTime.GetCurrentTime() - (TimeOfOutput + LengthOfDelay);

            if (ModulusOfSignal == 0 || startOfSignal < 0 || startOfSignal > LengthOfSignal)
            {
                //Not started yet or finished allready
                return(0f);
            }
            return((startOfSignal % ModulusOfSignal < LengthOfOn)?Math.Max(1f * AmplificationOfAction - loss, 0f): 0f);
        }
Beispiel #3
0
 public void TriggerEvent(StateEventEnum triggeredEvent)
 {
     //gc-warning: using struct for EventOutput
     _stateEvent[Convert.ToInt32(triggeredEvent)].CurrentEventSignal = new EventSignal(VirtualTime.GetCurrentTime(), _stateEvent[Convert.ToInt32(triggeredEvent)].CurrentEventSetting);
 }
Beispiel #4
0
 override public void EvaluateNextState()
 {
     //Add info in state that was next state (for balancing)
     _nextState.SetBalanceNextState(true);
     _nextState.SetBalanceLastTimeUsed(VirtualTime.GetCurrentTime());
 }