本文整理汇总了C#中Vehicle.setController方法的典型用法代码示例。如果您正苦于以下问题:C# Vehicle.setController方法的具体用法?C# Vehicle.setController怎么用?C# Vehicle.setController使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Vehicle
的用法示例。
在下文中一共展示了Vehicle.setController方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Start
void Start()
{
//vehicle
CharacterController controller = GetComponent<CharacterController>();
vehicle = new Vehicle(mass, maxSpeed, maxForce, controller.transform.position);
timer = 0.0f;
attributes = new Dictionary<string, int>();
idle = new State(new Action_IdleEnter(), new Action_Idle(), new Action_IdleExit(), "idle");
seek = new State(new Action_SeekEnter(), new Action_Seek(), new Action_SeekExit(), "seek");
flee = new State(new Action_FleeEnter(), new Action_Flee(), new Action_FleeExit(), "flee");
pursuit = new State(new Action_PursuitEnter(), new Action_Pursuit(), new Action_PursuitExit(), "pursuit");
evade = new State(new Action_EvadeEnter(), new Action_Evade(), new Action_EvadeExit(), "evade");
wander = new State(new Action_WanderEnter(), new Action_Wander(), new Action_WanderExit(), "wander");
patrol = new State(new Action_PatrolEnter(), new Action_Patrol(), new Action_PatrolExit(), "patrol");
seekEnter = new Transition(seek, new Action_None());
idleEnter = new Transition(idle, new Action_None());
fleeEnter = new Transition(flee, new Action_None());
pursuitEnter = new Transition(pursuit, new Action_None());
evadeEnter = new Transition(evade, new Action_None());
wanderEnter = new Transition(wander, new Action_None());
patrolEnter = new Transition(patrol, new Action_None());
idle.addTransition(seekEnter, "seekEnter");
idle.addTransition(fleeEnter, "fleeEnter");
idle.addTransition(pursuitEnter, "pursuitEnter");
idle.addTransition(evadeEnter, "evadeEnter");
idle.addTransition(wanderEnter, "wanderEnter");
idle.addTransition(patrolEnter, "patrolEnter");
seek.addTransition(idleEnter, "idleEnter");
seek.addTransition(fleeEnter, "fleeEnter");
seek.addTransition(pursuitEnter, "pursuitEnter");
seek.addTransition(evadeEnter, "evadeEnter");
seek.addTransition(wanderEnter, "wanderEnter");
seek.addTransition(patrolEnter, "patrolEnter");
flee.addTransition(idleEnter, "idleEnter");
flee.addTransition(seekEnter, "seekEnter");
flee.addTransition(pursuitEnter, "pursuitEnter");
flee.addTransition(evadeEnter, "evadeEnter");
flee.addTransition(wanderEnter, "wanderEnter");
flee.addTransition(patrolEnter, "patrolEnter");
pursuit.addTransition(idleEnter, "idleEnter");
pursuit.addTransition(seekEnter, "seekEnter");
pursuit.addTransition(fleeEnter, "fleeEnter");
pursuit.addTransition(evadeEnter, "evadeEnter");
pursuit.addTransition(wanderEnter, "wanderEnter");
patrol.addTransition(patrolEnter, "patrolEnter");
evade.addTransition(idleEnter, "idleEnter");
evade.addTransition(seekEnter, "seekEnter");
evade.addTransition(fleeEnter, "fleeEnter");
evade.addTransition(pursuitEnter, "pursuitEnter");
evade.addTransition(wanderEnter, "wanderEnter");
evade.addTransition(patrolEnter, "patrolEnter");
wander.addTransition(idleEnter, "idleEnter");
wander.addTransition(seekEnter, "seekEnter");
wander.addTransition(fleeEnter, "fleeEnter");
wander.addTransition(pursuitEnter, "pursuitEnter");
wander.addTransition(evadeEnter, "evadeEnter");
wander.addTransition(patrolEnter, "patrolEnter");
patrol.addTransition(idleEnter, "idleEnter");
patrol.addTransition(seekEnter, "seekEnter");
patrol.addTransition(fleeEnter, "fleeEnter");
patrol.addTransition(pursuitEnter, "pursuitEnter");
patrol.addTransition(evadeEnter, "evadeEnter");
patrol.addTransition(wanderEnter, "wanderEnter");
// set the player controller for use by the state machine
fsmc = FSM.FSM.createFSMInstance(idle, new Idle(), attributes, "hunter");
fsmc.setController(GetComponent<CharacterController>());
vehicle.setController(GetComponent<CharacterController());
}