protected override IEnumerator LateStart() { yield return(new WaitForEndOfFrame()); FSMAction noAction = new FSMAction_None(); // Setup actions. FSMAction moveToPlayerEnter = new FSMAction_MoveToPlayerEnter(this.owner); FSMAction moveToPlayerUpdate = new FSMAction_MoveToPlayerUpdate(this.owner, GameManager.instance.InGameController.Airship); FSMAction moveToPlayerExit = new FSMAction_MoveToPlayerExit(this.owner); FSMState moveToPlayer = new FSMState("moveToPlayer", moveToPlayerEnter, moveToPlayerUpdate, moveToPlayerExit); FSMAction patrolEnter = new FSMAction_PatrolEnter(this.owner); FSMAction patrolUpdate = new FSMAction_PatrolUpdate(this.owner, this.patrolPoints); FSMAction patrolExit = new FSMAction_PatrolExit(this.owner); FSMState patrol = new FSMState("patrol", patrolEnter, patrolUpdate, patrolExit); FSMAction attackEnter = new FSMAction_AttackEnter(); FSMAction attackUpdate = new FSMAction_AttackUpdate(this.owner, this.owner.Ability.Cooldown); FSMAction attackExit = new FSMAction_AttackExit(); FSMState attack = new FSMState("attack", attackEnter, attackUpdate, attackExit); // Setup transitions. moveToPlayer.addTransition(new FSMTransition(patrol, noAction), "patrol"); moveToPlayer.addTransition(new FSMTransition(attack, noAction), "attack"); patrol.addTransition(new FSMTransition(moveToPlayer, noAction), "moveToPlayer"); patrol.addTransition(new FSMTransition(attack, noAction), "attack"); attack.addTransition(new FSMTransition(moveToPlayer, noAction), "moveToPlayer"); attack.addTransition(new FSMTransition(patrol, noAction), "patrol"); this.fsm = FSM.FSM.createFSMInstance(patrol, patrolEnter); }
protected override IEnumerator LateStart() { yield return(new WaitForEndOfFrame()); FSMAction noAction = new FSMAction_None(); // Setup actions. FSMAction rotateEnter = new FSMAction_RotateHeadingEnter(); FSMAction rotateUpdate = new FSMAction_RotateHeadingUpdate(this.owner, this.directions, this.turnDuration); FSMAction rotateExit = new FSMAction_RotateHeadingExit(); FSMState rotate = new FSMState("rotate", rotateEnter, rotateUpdate, rotateExit); FSMAction attackEnter = new FSMAction_AttackEnter(); FSMAction attackUpdate = new FSMAction_AttackUpdate(this.owner, this.owner.Ability.Cooldown); FSMAction attackExit = new FSMAction_AttackExit(); FSMState attack = new FSMState("attack", attackEnter, attackUpdate, attackExit); // Setup transitions. rotate.addTransition(new FSMTransition(attack, noAction), "attack"); attack.addTransition(new FSMTransition(rotate, noAction), "rotate"); this.fsm = FSM.FSM.createFSMInstance(rotate, rotateEnter); }