Exemplo n.º 1
0
    // Use this for initialization
    void Start()
    {
        states = new List <State>();
        //Patroll state
        List <Transition> patrolltrans = new List <Transition>();

        patrolltrans.Add(new SeeMonsterTrans(gameObject));
        PatrollState patroll = new PatrollState(gameObject, patrolltrans);

        states.Add(patroll);

        //Scream state
        List <Transition> screamtrans = new List <Transition>();

        screamtrans.Add(new SeeMonsterTrans(gameObject));
        screamtrans.Add(new SeeAngerTrans(gameObject));
        screamtrans.Add(new TimePassTrans(gameObject, 25f, "sleep"));
        ScreamState scream = new ScreamState(gameObject, screamtrans, 10f);

        states.Add(scream);

        //Sleep state
        List <Transition> sleeptrans = new List <Transition>();

        sleeptrans.Add(new TimePassTrans(gameObject, 40f, "patroll"));
        SleepState sleep = new SleepState(gameObject, sleeptrans);

        states.Add(sleep);

        initialState        = patroll;
        currentState        = patroll;
        triggeredTransition = null;
        gameObject.GetComponent <GraphPathFollowing>().astar_target = null;      //Set to null just in case
        initialSpeed = gameObject.GetComponent <Agent>().maxSpeed;
    }
Exemplo n.º 2
0
    // Use this for initialization
    void Start()
    {
        states = new List <State>();
        //Patroll state
        List <Transition> patrolltrans = new List <Transition>();

        patrolltrans.Add(new SeeMonsterTrans(gameObject));
        patrolltrans.Add(new PushedTrans(gameObject));         //is being pushed
        patrolltrans.Add(new TimePassTrans(gameObject, 30f, "patrollonce"));
        PatrollState patroll = new PatrollState(gameObject, patrolltrans);

        states.Add(patroll);

        //Patroll once state
        List <Transition> patrolloncetrans = new List <Transition>();

        patrolloncetrans.Add(new SeeMonsterTrans(gameObject));
        patrolloncetrans.Add(new PushedTrans(gameObject));         //is being pushed
        patrolloncetrans.Add(new TimePassTrans(gameObject, 15f, "patroll"));
        PatrollOnceState patrollonce = new PatrollOnceState(gameObject, patrolloncetrans);

        states.Add(patrollonce);

        //Flee state
        List <Transition> fleetrans = new List <Transition>();

        fleetrans.Add(new SeeMonsterTrans(gameObject));
        fleetrans.Add(new PushedTrans(gameObject));         //is being pushed
        fleetrans.Add(new TimePassTrans(gameObject, 15f, "patroll"));
        FleeState flee = new FleeState(gameObject, fleetrans, 10f);

        states.Add(flee);

        //Waypoint decision state
        List <Transition> waypointtrans = new List <Transition>();

        waypointtrans.Add(new PushedTrans(gameObject));
        waypointtrans.Add(new StopAndTimePassTrans(gameObject, 7f, "flee"));
        WaypointState waypoint = new WaypointState(gameObject, waypointtrans, 12f);

        states.Add(waypoint);

        //Dizzy state
        List <Transition> dizzytrans = new List <Transition>();

        dizzytrans.Add(new StopAndTimePassTrans(gameObject, 1f, "waypoint"));
        DizzyState dizzy = new DizzyState(gameObject, dizzytrans, 3f);

        states.Add(dizzy);

        initialState        = patroll;
        currentState        = patroll;
        triggeredTransition = null;
        gameObject.GetComponent <GraphPathFollowing>().astar_target = null;      //Set to null just in case
        initialSpeed = gameObject.GetComponent <Agent>().maxSpeed;
    }
Exemplo n.º 3
0
    // Use this for initialization
    void Start()
    {
        states = new List <State>();
        //Transitions for patroll state
        List <Transition> patrolltrans = new List <Transition>();

        patrolltrans.Add(new GetSignalTrans(gameObject));
        patrolltrans.Add(new SeeMonsterTrans(gameObject));
        PatrollState patroll = new PatrollState(gameObject, patrolltrans);

        states.Add(patroll);

        //Transitions for pursue state
        List <Transition> pursuetrans = new List <Transition>();

        pursuetrans.Add(new GetSignalTrans(gameObject));
        pursuetrans.Add(new StopSeeMonsterTrans(gameObject));
        PursueState pursue = new PursueState(gameObject, pursuetrans, 12f);

        states.Add(pursue);

        //Transitions for look for state
        List <Transition> looktrans = new List <Transition>();

        looktrans.Add(new GetSignalTrans(gameObject));
        looktrans.Add(new SeeMonsterTrans(gameObject));
        looktrans.Add(new TimePassTrans(gameObject, 7f, "patroll"));
        LookForState look = new LookForState(gameObject, looktrans, 10f);

        states.Add(look);

        //Transitions for eat state
        List <Transition> eattrans = new List <Transition>();

        eattrans.Add(new FoodDisappearsTrans(gameObject));
        GoToSignalState eat = new GoToSignalState(gameObject, eattrans, 9f);

        states.Add(eat);

        initialState        = patroll;
        currentState        = patroll;
        triggeredTransition = null;
        gameObject.GetComponent <GraphPathFollowing>().astar_target = null;      //Set to null just in case
        initialSpeed = gameObject.GetComponent <Agent>().maxSpeed;
    }
Exemplo n.º 4
0
    // Use this for initialization
    void Start()
    {
        states = new List <State>();
        //Patroll state
        List <Transition> patrolltrans = new List <Transition>();

        patrolltrans.Add(new SeeMonsterTrans(gameObject));
        patrolltrans.Add(new GetSignalTrans(gameObject));
        //patrolltrans.Add(new HearNoiseTrans(gameObject));
        PatrollState patroll = new PatrollState(gameObject, patrolltrans);

        states.Add(patroll);

        //Search noise state (not active)
        //List<Transition> searchnoisetrans = new List<Transition>();
        //searchnoisetrans.Add(new SeeMonsterTrans(gameObject));
        //searchnoisetrans.Add(new GetSignalTrans(gameObject));
        //searchnoisetrans.Add(new StopAndTimePassTrans(gameObject,3f,"patroll"));
        //SearchNoiseState search = new SearchNoiseState(gameObject, searchnoisetrans,9f);
        //states.Add(search);

        //Search Disgust (go to signal state)
        List <Transition> searchdisgusttrans = new List <Transition>();

        searchdisgusttrans.Add(new SeeMonsterTrans(gameObject));
        searchdisgusttrans.Add(new StopAndTimePassTrans(gameObject, 1f, "searchlocation"));
        GoToSignalState gotosignal = new GoToSignalState(gameObject, searchdisgusttrans, 10f);

        states.Add(gotosignal);

        //Search location state
        List <Transition> searchlocationtrans = new List <Transition>();

        searchlocationtrans.Add(new SeeMonsterTrans(gameObject));
        searchlocationtrans.Add(new GetSignalTrans(gameObject));
        searchlocationtrans.Add(new StopAndTimePassTrans(gameObject, 2f, "patroll"));       //No hay nadie en el punto
        SearchLocationState searchLocation = new SearchLocationState(gameObject, searchlocationtrans, 10f);

        states.Add(searchLocation);

        //Pursue state
        List <Transition> pursuetrans = new List <Transition>();

        pursuetrans.Add(new StopSeeMonsterTrans(gameObject));
        pursuetrans.Add(new ReachTrans(gameObject));
        PursueState pursue = new PursueState(gameObject, pursuetrans, 11f);

        states.Add(pursue);

        //Look for state
        List <Transition> looktrans = new List <Transition>();

        looktrans.Add(new SeeMonsterTrans(gameObject));
        looktrans.Add(new TimePassTrans(gameObject, 7f, "pursuerwaypoint"));
        LookForState look = new LookForState(gameObject, looktrans, 11f);

        states.Add(look);

        //Push Fear state
        List <Transition> pushtrans = new List <Transition>();

        pushtrans.Add(new StopSeeMonsterTrans(gameObject));
        //pushtrans.Add(new TimePassTrans(gameObject,3f,"patroll"));
        PushState push = new PushState(gameObject, pushtrans);

        states.Add(push);

        //Nearest pursuer waypoint state
        List <Transition> waypointtrans = new List <Transition>();

        waypointtrans.Add(new SeeMonsterTrans(gameObject));
        waypointtrans.Add(new StopAndTimePassTrans(gameObject, 2f, "patroll"));
        PursuerWaypointState pursuerwaypoint = new PursuerWaypointState(gameObject, waypointtrans, 11f);

        states.Add(pursuerwaypoint);

        initialState = patroll;
        currentState = patroll;
        //TEST
        //currentState = push;
        //
        triggeredTransition = null;
        gameObject.GetComponent <GraphPathFollowing>().astar_target = null;      //Set to null just in case
        initialSpeed = gameObject.GetComponent <Agent>().maxSpeed;
    }