private StateParams StateQueue; //The state to take when re-enabled if there was a state change request when disabled

        void OnEnable()
        {
            if (StateQueue != null)
            {
                BeginTransition(StateQueue.TransitionIn);
                StateQueue = null;
            }
        }
            public ValidationRequest SVX_MakeValidationRequest(AuthorizationCodeResponse resp)
            {
                // May as well fail fast.  It should also pass verification to do this in SVX_SignInRP.
                // Pull new { ... } out to work around BCT mistranslation.
                var stateParams = new StateParams {
                    client = resp.SVX_sender, idpPrincipal = googlePrincipal
                };

                stateGenerator.Verify(stateParams, resp.state);
                return(new ValidationRequest
                {
                    authorizationCode = resp.authorizationCode,
                    rpPrincipal = SVX_Principal  // Like in the original authorization code request.
                });
            }
 public void BeginTransition(bool transitionIn)
 {
     if (!gameObject.activeInHierarchy)
     {
         StateQueue = new StateParams
         {
             TransitionIn = transitionIn
         };
     }
     else
     {
         AnimatorBind.SetBool("TransitionIn", transitionIn);
         AnimatorBind.SetTrigger("Transition");
     }
 }
            public RPAuthenticationConclusion SVX_SignInRP(IdTokenResponse resp)
            {
                // Comment out these 2 lines to see the verification fail.
                if (resp.idToken.theParams.rpPrincipal != SVX_Principal)
                {
                    throw new Exception("IdTokenResponse was not issued to this RP.");
                }
                // Pull new { ... } out to work around BCT mistranslation.
                var stateParams = new StateParams {
                    client = resp.SVX_sender, idpPrincipal = googlePrincipal
                };

                stateGenerator.Verify(stateParams, resp.state);
                return(new RPAuthenticationConclusion {
                    authenticatedClient = resp.SVX_sender,
                    googleUsername = resp.idToken.theParams.username
                });
            }
Esempio n. 5
0
        public void ChangeState(System.Type type, StateParams stateParams = null)
        {
            if (stateMap.TryGetValue(type, out StateMachineState nextState))
            {
                StateMachineState prevState = currentState;

                currentState = nextState;

                if (prevState != null)
                {
                    prevState.Exit();
                }

                currentState.Enter(stateParams);

                OnStateChanged(prevState, nextState);
            }
            else
            {
                Debug.LogError("Tried to enter null state. This isn't supported");
            }
        }
Esempio n. 6
0
 public State1Controller(Scope _scope, StateParams _stateParams)
 {
     MyValue = "hjhh";
     id      = _stateParams["id"];
 }
Esempio n. 7
0
 public virtual void Enter(StateParams stateParams)
 {
     enterStateTime  = Time.time;
     lastTimeInState = Time.time;
 }
Esempio n. 8
0
 public void ChangeState <K>(StateParams stateParams = null) where K : StateMachineState
 {
     stateMachine.ChangeState <K>(stateParams);
 }
    public bool processKeyDown()
    {
        if (Input.GetKeyDown((KeyCode)'a'))
        {

            StateParams p = new StateParams();
            p.extraValue = new object[1];
            p.extraValue[0] = currentTouchPos;
            setState((int)GlobalDef.UnitState.State_Charm, p);

        }
        else if (Input.GetKeyDown((KeyCode)'s'))
        {
            Begin(angle, Vector3.zero);
            //LevelFlowCtrl.instance.ExternalSuccess();
        }
        else if (Input.GetKeyDown((KeyCode)'f'))
        {
            CancelAtk();
        }
        else if (Input.anyKeyDown)
        {
            m_keyDown = true;
            m_bSaveTouchPos = false;
        }
        else if (Input.anyKey)
        {
            if (getCurProperty((int)GlobalDef.NewHeroProperty.PRO_LIFEPOINT) <= 0)
                return false;

            m_ray = Camera.main.ScreenPointToRay(Input.mousePosition);

            if (m_mapCollider.Raycast(m_ray, out m_mouseCastHit, 4) && 
                UICamera.hoveredObject == null)
            {
                currentTouchPos = m_mouseCastHit.point;
                if (!m_bSaveTouchPos)
                {
                    m_lastTouchPos = currentTouchPos;
                    m_bSaveTouchPos = true;
                }

                Vector3 tempMovedir = currentTouchPos - m_transform.position;
                tempMovedir[1] = 0;
                float magnitude_temp = tempMovedir.magnitude;
                tempMovedir = tempMovedir / magnitude_temp;

                //< 缈绘粴
                float curEnergy = getCurProperty((int)GlobalDef.NewHeroProperty.PRO_MOVEPOWER);
                //				if (m_dubbleClick<0.3f && (int)curEnergy > 0 )
                if (m_dubbleClick < 0.3f)
                {
                    if (m_curStat < 50 && m_curStat >= 0)
                    {
                        if (Vector3.Distance(currentTouchPos, m_lastTouchPos) < 0.1f)
                        {
                            CancelInvoke("OnReplyEnergy");
                            m_directionVector = tempMovedir;
                            m_transform.rotation = Quaternion.LookRotation(m_directionVector);
                            m_speedFactor = 6.5f;
                            m_rigidbody.mass = 2;
                            CancelAtk();
                            m_animation.Stop();
                            m_animation.Play("dodge");
                            m_curStat = 53;
                            m_rigidbody.AddForce(m_directionVector * 220);
                            m_atkCollider.enabled = false;
                            OnEnergy(-1);
                            InvokeRepeating("OnReplyEnergy", 5, 5);
                        }
                    }
                }

                if (magnitude_temp > 0.08f)
                {
                    m_directionVector = tempMovedir;
                    m_speedFactor = 6.5f;
                }
            }
            m_keyDown = true;
        }
        else if (m_keyDown)
        {
            m_dubbleClick = 0;
            m_keyDown = false;
        }

        m_dubbleClick += 2 * Time.deltaTime;
        return true;
    }
Esempio n. 10
0
 public void ChangeState <J>(StateParams stateParams = null) where J : StateMachineState
 {
     ChangeState(typeof(J), stateParams);
 }
Esempio n. 11
0
 public void ChangeState(StateMachineState state, StateParams stateParams = null)
 {
     ChangeState(state.GetType(), stateParams);
 }
 //< 硬直
 public virtual void OnHardStraight(int damage)
 {
     float val = addCurProperty((int)GlobalDef.NewHeroProperty.PRO_HARDSTRAIGHT, damage);
     if (val <= 0)
     {
         if (hasState((int)GlobalDef.UnitState.State_HardStraight))
         {
             removeState((int)GlobalDef.UnitState.State_HardStraight);
         }
     }
     else
     {
         if (!hasState((int)GlobalDef.UnitState.State_HardStraight))
         {
             StateParams p = new StateParams();
             setState((int)GlobalDef.UnitState.State_HardStraight, p);
         }
     }
 }
	/// <summary>
	/// 设置状态
	/// </summary>
	public void setState(int type, StateParams param)
	{
		if(state.ContainsKey(type))
		{
			state.Remove(type);
		}
		state.Add (type,param);
	}
 public StateTimeBuffer(int newId, int newInterval, float newduration, float fvalue, int iValue)
     : base(newId, newInterval, newduration)
 {
     stateParams = new StateParams();
     stateParams.iValue = iValue;
     stateParams.fvalue = fvalue;
 }
 /// <summary>
 /// 设置状态
 /// </summary>
 public void setState(int type, StateParams param)
 {
     m_curHeroData.setState(type, param);
 }