Esempio n. 1
0
    static Node TalkToChar(GameObject hero, GameObject enemy)
    {
        Selector sp = new Selector();

        foreach (var entry in StoryIBT.blackboardTrigger)
        {
            sp.Children.Add(
                new Selector(
                    new Sequence(new LeafAssert(() => StoryIBT.ComeBack(entry.Key) && StoryIBT.CheckTrigger(entry.Key)),
                                 StoryIBT.inquireAndRespond(entry.Key, "Believe me, I am telling you the truth, that's all the information I had - second response"),
                                 new LeafInvoke(() => StoryIBT.blackboard["talk"] = false)
                                 ),
                    new Sequence(new LeafAssert(() => StoryIBT.CheckTrigger(entry.Key)),
                                 entry.Key.GetComponent <BehaviorMecanim>().Node_OrientTowards(enemy.transform.position),
                                 entry.Key.GetComponent <BehaviorMecanim>().ST_PlayHandGesture("POINTING", 2500),
                                 StoryIBT.inquireAndRespond(entry.Key, "Hmm, I've heard of such a man.... (common)"),
                                 StoryIBT.inquireAndRespond(entry.Key, Replymessages[(new System.Random()).Next(3)]),
                                 entry.Key.GetComponent <BehaviorMecanim>().Node_OrientTowards(hero.transform.position),
                                 new LeafInvoke(() => StoryIBT.blackboard["talk"]       = false),
                                 new LeafInvoke(() => StoryIBT.alreadytalked[entry.Key] = true),
                                 new LeafInvoke(() => StoryIBT.clue_Count += 1)
                                 ))
                );
        }

        return(sp);
    }
        private static Node HeroKillsEnemy(GameObject status)
        {
            return(new Sequence(
                       new LeafInvoke(() => Debug.Log("Hero Wins")),
                       StoryIBT.inquireAndRespond(hero, "It time you met you met your creator"),
                       new SequenceParallel(
                           hero.GetComponent <BehaviorMecanim>().ST_PlayHandGesture("Pistolaim", 6000),
                           enemy.GetComponent <BehaviorMecanim>().ST_PlayHandGesture("HANDSUP", 3000)
                           ),

                       // hero says - f**k you
                       enemy.GetComponent <BehaviorMecanim>().ST_PlayBodyGesture("DYING", 50000),
                       new LeafInvoke(() => status.GetComponent <Text>().text = "Hero Wins")
                       ));
        }
        private static Node EnemyKillsHero(GameObject status)
        {
            return(new Sequence(
                       new LeafInvoke(() => Debug.Log("Enemy Wins")),

                       TakeOutGun(enemy),
                       StoryIBT.inquireAndRespond(enemy, "You have always been too slow"),
                       new SequenceParallel(
                           enemy.GetComponent <BehaviorMecanim>().ST_PlayHandGesture("Pistolaim", 3000),
                           // enemy says - too slow, f**k you
                           hero.GetComponent <BehaviorMecanim>().ST_PlayBodyGesture("DYING", 50000)
                           ),
                       StoryIBT.inquireAndRespond(enemy, "This is not your silly movie, Hero's don't win here"),
                       // sad hero cries and dies
                       new LeafInvoke(() => status.GetComponent <Text>().text = "Enemy Wins")
                       ));
        }
Esempio n. 4
0
    protected static Node interactWithMob(GameObject hero, GameObject enemy)
    {
        return(new Selector(
                   // outer if
                   new Sequence(new LeafAssert(() => StoryIBT.blackboard["talk"]),
                                new Sequence(hero.GetComponent <BehaviorMecanim>().ST_PlayHandGesture("Wave", 800),
                                             new LeafWait(1000), StoryIBT.inquireAndRespond(hero, greeting[(new System.Random()).Next(3)]),
                                             new LeafWait(1000), StoryIBT.inquireAndRespond(hero, "I am the Hero of this area. My name is Daniel San. Can I trouble you for some info?"),
                                             new LeafWait(1000), StoryIBT.inquireAndRespond(hero, Askmessages[(new System.Random()).Next(3)]),
                                             new LeafWait(1000),
                                             TalkToChar(hero, enemy),
                                             new LeafWait(1000),
                                             hero.GetComponent <BehaviorMecanim>().ST_PlayHandGesture("CHESTPUMPSALUTE", 500))

                                ),
                   // outer else
                   new LeafInvoke(() => RunStatus.Success)

                   ));
    }
        public static Node Get(GameObject heroObj, GameObject enemyObj, GameObject apartment_door, GameObject status)
        {
            hero  = heroObj;
            enemy = enemyObj;

            // door
            return(new Sequence(
                       GotoEnemyHouse(apartment_door.transform.position),
                       new LeafWait(500),

                       StoryIBT.inquireAndRespond(heroObj, "I can feel it in my gut, he's hiding here..."),
                       new LeafWait(500),
                       TakeOutGun(hero),
                       new LeafWait(200),
                       OpenDoorIkAnim(apartment_door: apartment_door),
                       new LeafWait(500),

                       new
                       SelectorParallel( //go inside the house with piston holding up and stop whenever either of them succeeds
                           hero.GetComponent <BehaviorMecanim>().ST_PlayHandGesture("Pistolaim", 10000),
                           GoInsideHouse(apartment_door)
                           ),
                       hero.GetComponent <BehaviorMecanim>().ST_TurnToFace(enemy.transform.position),
                       new LeafWait(400),
                       StoryIBT.inquireAndRespond(heroObj, "Finally, Here you are! You have no idea how long I have been looking for you Johnny"),
                       new LeafWait(400),
                       enemy.GetComponent <BehaviorMecanim>().ST_TurnToFace(hero.transform.position),
                       StoryIBT.inquireAndRespond(heroObj, "I have come to avenge Mr. Miyagi's death. It's time you paid for your sins"),
                       new LeafWait(400),
                       // focus camera on the enemy
                       // Random selection, who kills whom
                       new RandomSelector(
                           HeroKillsEnemy(status),
                           EnemyKillsHero(status)
                           )));
        }