Exemple #1
0
    void Start()
    {
        MeshRenderer ms = GetComponent <MeshRenderer>();

        ms.enabled = false;
        turn1      = false;
        turn2      = false;
        turn3      = false;
        turn4      = false;
        wkA        = GetComponent <walkAround>();
    }
    Task ConfigureBehavior()
    {
        List <Task> taskList = new List <Task>();

        Task Human         = new IsTrue(creature.isHuman);
        Task Dog           = new IsTrue(creature.isDogPresent);
        Task NotHuman      = new IsFalse(creature.isHuman);
        Task NoDog         = new IsFalse(creature.isDogPresent);
        Task saveHuman     = new saveHuman(creature);
        Task walkAround    = new walkAround(creature);
        Task ShootAir      = new shootAir(creature);
        Task ShootHuman    = new shootHuman(creature);
        Task ShootCreature = new shootCreature(creature);
        Task petDog        = new petDog(creature);
        Task takeDog       = new takeDog(creature);


        taskList.Add(Human);
        taskList.Add(NoDog);
        taskList.Add(walkAround);
        taskList.Add(ShootAir);

        Sequence SpareTheHuman = new Sequence(taskList);

        taskList = new List <Task>();

        taskList.Add(NotHuman);
        taskList.Add(NoDog);
        taskList.Add(saveHuman);
        taskList.Add(ShootCreature);

        Sequence SaveTheHuman = new Sequence(taskList);

        taskList = new List <Task>();

        taskList.Add(Dog);
        taskList.Add(Human);
        taskList.Add(ShootHuman);
        taskList.Add(petDog);
        taskList.Add(takeDog);

        Sequence SaveTheDog = new Sequence(taskList);

        taskList = new List <Task>();

        taskList.Add(Dog);
        taskList.Add(NotHuman);
        taskList.Add(ShootCreature);
        taskList.Add(petDog);
        taskList.Add(takeDog);

        Sequence SaveTheDogFromMonster = new Sequence(taskList);

        taskList = new List <Task>();

        taskList.Add(SaveTheDog);
        taskList.Add(SpareTheHuman);
        taskList.Add(SaveTheHuman);
        taskList.Add(SaveTheDogFromMonster);


        Selector selector = new Selector(taskList);

        return(selector);
    }