Exemple #1
0
    void Awake()
    {
        SetupMachine(PursuitStates.inactive);

        HashSet<Enum> inactiveTransitions = new HashSet<Enum>();
        inactiveTransitions.Add(PursuitStates.approach);
        AddTransitionsFrom(PursuitStates.inactive, inactiveTransitions);
        AddAllTransitionsTo(PursuitStates.inactive);

        HashSet<Enum> approachTransitions = new HashSet<Enum>();
        approachTransitions.Add(PursuitStates.seek);
        approachTransitions.Add(PursuitStates.flee);
        AddTransitionsFrom(PursuitStates.approach, approachTransitions);

        AddAllTransitionsFrom(PursuitStates.seek);

        HashSet<Enum> attackTransitions = new HashSet<Enum>();
        attackTransitions.Add(PursuitStates.seek);
        attackTransitions.Add(PursuitStates.flee);
        AddTransitionsFrom(PursuitStates.attack, attackTransitions);

        HashSet<Enum> fleeTransitions = new HashSet<Enum>();
        fleeTransitions.Add(PursuitStates.approach);
        fleeTransitions.Add(PursuitStates.inactive);
        fleeTransitions.Add(PursuitStates.flee);
        AddTransitionsFrom(PursuitStates.flee, fleeTransitions);

        StartMachine(PursuitStates.inactive);

        hasFled = false;
        doesFlee = true;
        _swinging = false;

        entity = GetComponent<Entity>();
        MoveFSM = GetComponent<MovementFSM>();
        combatFSM = GetComponent<CombatFSM>();
        _abilityManager = GetComponent<AbilityManager>();
        _animationController = GetComponent<AnimationController>();
        _soundManager = GetComponent<EntitySoundManager>();
        _collider = GetComponent<CapsuleCollider>();
    }
Exemple #2
0
 // Use this for initialization
 void Start()
 {
     AttackFSM = GetComponent<CombatFSM>();
 }
    // Use this for initialization
    void Start()
    {
        targetPosition = Vector3.zero;
        agent = GetComponent<NavMeshAgent>();

        entity = GetComponent<PlayerEntity>();
        moveFSM = GetComponent<MovementFSM>();
        combatFSM = GetComponent<CombatFSM>();
    }