コード例 #1
0
    public virtual void Start()
    {
        RefRigidbody = GetComponent <Rigidbody>();
        RefSphere    = GetComponent <SphereCollider>();
        Neighbors    = new List <Agent>();
        FSM          = new StateMachine.StateMachine();



        InitialState initial = new InitialState(this);
        GroupState   group   = new GroupState(this);
        ExitState    exit    = new ExitState(this);

        JoinGroupTransition JG = new JoinGroupTransition();

        JG.SetTargetState(group);
        ExitTriggerTransition ET = new ExitTriggerTransition();

        ET.SetTargetState(exit);
        ExitFormationTransition EF = new ExitFormationTransition();

        EF.SetTargetState(group);

        initial.AddTransitions(JG);
        group.AddTransitions(ET);
        exit.AddTransitions(EF);

        FSM.AddState(initial);
        FSM.AddState(group);
        FSM.AddState(exit);

        FSM.Start(initial);
    }