Esempio n. 1
0
    /// <summary>
    /// Fires the transition
    /// </summary>
    /// <returns>The transition was successfully  fired or not</returns>
    public bool FireTransition()
    {
        //  The current state is equals to the StateFrom     The state from the stateFrom's machine (the super machine) is equals to the stateFrom
        if (BehaviourEngine.actualState == StateFrom || StateFrom.BehaviourEngine.actualState == StateFrom)
        {
            //Debug.Log("Transition fired: " + StateFrom.Name + " -> " + StateTo.Name);
            //Console.WriteLine("Transition fired: " + StateFrom.Name + " -> " + StateTo.Name);
            StateFrom.Exit(this.Name);
            if (this.type == TRANSITION_TYPE.SUPER_TRANSITION)
            {
                StateFrom.InternalTransition(this.Name);
            }

            // To change the actualState of the StateFrom Machine, the states should be from the same machine
            if (StateTo.BehaviourEngine == StateFrom.BehaviourEngine)
            {
                StateFrom.BehaviourEngine.actualState = StateTo;
            }

            //Entry is done in StateFrom.InternalTransition so there's no need to do the entry again
            if (this.type != TRANSITION_TYPE.SUPER_TRANSITION)
            {
                StateTo.Entry();
            }

            return(true);
        }

        return(false);
    }
Esempio n. 2
0
    public override int GetHashCode()
    {
        int hash = 1;

        if (StateFrom.Length != 0)
        {
            hash ^= StateFrom.GetHashCode();
        }
        if (StateTo.Length != 0)
        {
            hash ^= StateTo.GetHashCode();
        }
        if (Userrelationid != 0)
        {
            hash ^= Userrelationid.GetHashCode();
        }
        if (_unknownFields != null)
        {
            hash ^= _unknownFields.GetHashCode();
        }
        return(hash);
    }