当前位置: 首页>>代码示例>>C#>>正文


C# IState.GetType方法代码示例

本文整理汇总了C#中IState.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# IState.GetType方法的具体用法?C# IState.GetType怎么用?C# IState.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IState的用法示例。


在下文中一共展示了IState.GetType方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TransitionTo

        public void TransitionTo(IState state)
        {
            if (!(state is IdleState) && !_stackState.Contains(state))
                _stackState.Add(state);

            CurrentState = state;
            CurrentState.FiniteStateMachine = this;
            CurrentState.OnLeave = OnStateLeave;

            Log.Write("Transition to: {0}", state.GetType(), ConsoleColor.Red);

            CurrentState.OnEnter();
        }
开发者ID:PawelklosPL,项目名称:GameDevelopment,代码行数:13,代码来源:FiniteStateMachine.cs

示例2: Plan

        /// <summary>
        /// Generic plan
        /// </summary>
        /// <param name="planningState"></param>
        /// <param name="navigationalPlan"></param>
        /// <param name="vehicleState"></param>
        /// <param name="vehicles"></param>
        /// <param name="obstacles"></param>
        /// <param name="blockage"></param>
        /// <returns></returns>
        public Maneuver Plan(IState planningState, INavigationalPlan navigationalPlan, VehicleState vehicleState,
            SceneEstimatorTrackedClusterCollection vehicles, SceneEstimatorUntrackedClusterCollection obstacles,
            List<ITacticalBlockage> blockages, double vehicleSpeed)
        {
            // update stuff
            this.Update(vehicles, vehicleState);

            #region Plan Roads

            if (planningState is TravelState)
            {
                Maneuver roadFinal = roadTactical.Plan(
                    planningState,
                    (RoadPlan)navigationalPlan,
                    vehicleState,
                    vehicles,
                    obstacles,
                    blockages,
                    vehicleSpeed);

                // return
                return roadFinal;
            }

            #endregion

            #region Plan Intersection

            else if (planningState is IntersectionState)
            {
                Maneuver intersectionFinal = intersectionTactical.Plan(
                    planningState,
                    navigationalPlan,
                    vehicleState,
                    vehicles,
                    obstacles,
                    blockages);

                // return
                return intersectionFinal;
            }

            #endregion

            #region Plan Zone

            else if (planningState is ZoneState)
            {
                Maneuver zoneFinal = zoneTactical.Plan(
                    planningState,
                    navigationalPlan,
                    vehicleState,
                    vehicles,
                    obstacles,
                    blockages);

                // return
                return zoneFinal;
            }

            #endregion

            #region Plan Blockage

            else if (planningState is BlockageState)
            {
                Maneuver blockageFinal = blockageTactical.Plan(
                    planningState,
                    vehicleState,
                    vehicleSpeed,
                    blockages,
                    navigationalPlan);

                return blockageFinal;
            }

            #endregion

            #region Unknown

            else
            {
                throw new Exception("Unknown planning state type: " + planningState.GetType().ToString());
            }

            #endregion
        }
开发者ID:anand-ajmera,项目名称:cornell-urban-challenge,代码行数:97,代码来源:TacticalDirector.cs

示例3: GoalsSatisfied

 internal bool GoalsSatisfied(Pair<Set<CompoundTerm>, Set<Term>> simpleAndFsmGoals, IState state)
 {
     if (typeof(SimpleState) == state.GetType())
     {
         //currently not yet implemented
         return true;
     }
     else if (typeof(FsmState) == state.GetType())
     {
         FsmState fsmState =(FsmState)state;
         Console.WriteLine("Comparing FsmState: " + state.ToString() + " to " + simpleAndFsmGoals.Second);
         if (fsmState.AutomatonStates.IsSupersetOf(simpleAndFsmGoals.Second))
             return true;
     }
     else if (typeof(PairState) == state.GetType()) {
         PairState pairState = (PairState)state;
         return GoalsSatisfied(simpleAndFsmGoals, pairState.First) && GoalsSatisfied(simpleAndFsmGoals, pairState.Second);
     }
     return false;
 }
开发者ID:juhan,项目名称:NModel,代码行数:20,代码来源:Reachability.cs

示例4: ChangeState

 // Forcibly change state without a transition
 public override void ChangeState(IState state)
 {
     Console.WriteLine("StateMachine: Changing state (No transition) to " + state.GetType().Name);
     base.ChangeState(state); // Calls GetDistination State
 }
开发者ID:dickiepotter,项目名称:State,代码行数:6,代码来源:StateSamples.cs

示例5: Plan


//.........这里部分代码省略.........
				// check reasoning
				if (this.opposingReasoning == null || !this.opposingReasoning.Lane.Equals(ols.OpposingLane))
				{
					if (ols.OpposingLane.LaneOnRight == null)
						this.leftLateralReasoning = new LateralReasoning(null, SideObstacleSide.Driver);
					else if (!ols.OpposingLane.LaneOnRight.Way.Equals(ols.OpposingLane.Way))
						this.leftLateralReasoning = new LateralReasoning(ols.OpposingLane.LaneOnRight, SideObstacleSide.Driver);
					else
						this.leftLateralReasoning = new OpposingLateralReasoning(ols.OpposingLane.LaneOnRight, SideObstacleSide.Driver);

					if (ols.OpposingLane.LaneOnLeft == null)
						this.rightLateralReasoning = new LateralReasoning(null, SideObstacleSide.Passenger);
					else if (!ols.OpposingLane.LaneOnLeft.Way.Equals(ols.OpposingLane.Way))
						this.rightLateralReasoning = new LateralReasoning(ols.OpposingLane.LaneOnLeft, SideObstacleSide.Passenger);
					else
						this.rightLateralReasoning = new OpposingLateralReasoning(ols.OpposingLane.LaneOnLeft, SideObstacleSide.Passenger);

					this.opposingReasoning = new OpposingReasoning(this.leftLateralReasoning, this.rightLateralReasoning, ols.OpposingLane);
				}

				// get the forward lane plan
				Maneuver forwardManeuver = this.opposingReasoning.ForwardManeuver(ols.OpposingLane, ols.ClosestGoodLane, vehicleState, navigationalPlan, blockages);

				// get the secondary maneuver
				Maneuver? secondaryManeuver = null;
				if(ols.ClosestGoodLane != null)
					secondaryManeuver = this.opposingReasoning.SecondaryManeuver(ols.OpposingLane, ols.ClosestGoodLane, vehicleState, blockages, ols.EntryParameters);

				// check for reasonings secondary maneuver for desired behavior other than going straight
				if (secondaryManeuver != null)
				{
					// return the secondary maneuver
					return secondaryManeuver.Value;
				}
				// otherwise our default behavior and posibly desired is going straight
				else
				{
					// return default forward maneuver
					return forwardManeuver;
				}
			}

			#endregion

			#region not imp
			/*
			#region Uturn

			// we are making a uturn
			else if (planningState is uTurnState)
			{
				// get the uturn state
				uTurnState uts = (uTurnState)planningState;

				// get the final lane we wish to be in
				ArbiterLane targetLane = uts.TargetLane;

				// get operational state
				Type operationalBehaviorType = CoreCommon.Communications.GetCurrentOperationalBehavior();

				// check if we have completed the uturn
				bool complete = operationalBehaviorType == typeof(StayInLaneBehavior);

				// default next behavior
				Behavior nextBehavior = new StayInLaneBehavior(targetLane.LaneId, new ScalarSpeedCommand(CoreCommon.OperationalStopSpeed), new List<int>());
				nextBehavior.Decorators = TurnDecorators.NoDecorators;

				// check if complete
				if (complete)
				{
					// stay in lane
					List<ArbiterLaneId> aprioriLanes = new List<ArbiterLaneId>();
					aprioriLanes.Add(targetLane.LaneId);
					return new Maneuver(nextBehavior, new StayInLaneState(targetLane), null, null, aprioriLanes, true);
				}
				// otherwise keep same
				else
				{
					// set abort behavior
					((StayInLaneBehavior)nextBehavior).SpeedCommand = new ScalarSpeedCommand(0.0);

					// maneuver
					return new Maneuver(uts.DefaultBehavior, uts, nextBehavior, new StayInLaneState(targetLane));
				}
			}

			#endregion*/

			#endregion

			#region Unknown

			// unknown state
			else
			{
				throw new Exception("Unknown Travel State type: planningState: " + planningState.ToString() + "\n with type: " + planningState.GetType().ToString());
			}

			#endregion
		}
开发者ID:anand-ajmera,项目名称:cornell-urban-challenge,代码行数:101,代码来源:RoadTactical.cs


注:本文中的IState.GetType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。