示例#1
0
    protected override void BuildFSM()
    {
        PatrolState patrol = new PatrolState(PatrolPoints, navAgent, agroDistance);

        patrol.AddTransitionState(FSMStateID.Shoot, FSMTransitions.SawPlayer);
        patrol.AddTransitionState(FSMStateID.Dead, FSMTransitions.OutOfHealth);

        ShootState shoot = new ShootState(retreatDistance, spawnerScript);

        shoot.AddTransitionState(FSMStateID.Patrol, FSMTransitions.PlayerOutOfRange);
        shoot.AddTransitionState(FSMStateID.Retreat, FSMTransitions.PlayerTooClose);
        shoot.AddTransitionState(FSMStateID.Dead, FSMTransitions.OutOfHealth);

        RetreatState retreat = new RetreatState(navAgent, retreatDistance);

        retreat.AddTransitionState(FSMStateID.Shoot, FSMTransitions.CloserDistanceReached);
        retreat.AddTransitionState(FSMStateID.Dead, FSMTransitions.OutOfHealth);

        DeadState dead = new DeadState();

        AddFSMState(patrol);
        AddFSMState(shoot);
        AddFSMState(retreat);
        AddFSMState(dead);
    }
示例#2
0
    protected override void BuildFSM()
    {
        PatrolState patrol = new PatrolState(PatrolPoints, navAgent, agroDistance);

        patrol.AddTransitionState(FSMStateID.Shoot, FSMTransitions.SawPlayer);
        patrol.AddTransitionState(FSMStateID.Dead, FSMTransitions.OutOfHealth);

        ShootState shoot = new ShootState(chargeDistance, spawnerScript);

        shoot.AddTransitionState(FSMStateID.Patrol, FSMTransitions.PlayerOutOfRange);
        shoot.AddTransitionState(FSMStateID.Chase, FSMTransitions.PlayerTooClose);
        shoot.AddTransitionState(FSMStateID.Dead, FSMTransitions.OutOfHealth);

        ChaseState chase = new ChaseState(navAgent, chargeDistance);

        chase.AddTransitionState(FSMStateID.Shoot, FSMTransitions.PlayerOutOfRange);
        chase.AddTransitionState(FSMStateID.Dead, FSMTransitions.OutOfHealth);

        DeadState dead = new DeadState();

        AddFSMState(patrol);
        AddFSMState(shoot);
        AddFSMState(chase);
        AddFSMState(dead);
    }
示例#3
0
    protected override void BuildFSM()
    {
        //Other States Here

        PatrolState patrol = new PatrolState(this);

        patrol.AddTransitionState(FSMStateID.Investigate, FSMTransitions.HeardPlayer);
        patrol.AddTransitionState(FSMStateID.Shoot, FSMTransitions.SawPlayer);
        AddFSMState(patrol);

        InvestigateState investigate = new InvestigateState(this);

        investigate.AddTransitionState(FSMStateID.Patrol, FSMTransitions.FoundNothing);
        investigate.AddTransitionState(FSMStateID.Shoot, FSMTransitions.SawPlayer);
        AddFSMState(investigate);

        ShootState shoot = new ShootState();

        shoot.AddTransitionState(FSMStateID.Investigate, FSMTransitions.PlayerOutOfRange);
        AddFSMState(shoot);

        DeadState dead = new DeadState();

        AddFSMState(dead);
    }