Esempio n. 1
0
    // Start is called before the first frame update
    void Start()
    {
        clue_Count = 0;
        for (int i = 0; i < sideCharactersParent.transform.childCount; i++)
        {
            var childObject = sideCharactersParent.transform.GetChild(i).gameObject;
            if (childObject.CompareTag("Group"))
            {
                var child1 = childObject.transform.GetChild(0).gameObject;
                var child2 = childObject.transform.GetChild(1).gameObject;
                blackboardTrigger[child1] = false;
                alreadytalked[child1]     = false;
                blackboardTrigger[child2] = false;
                alreadytalked[child2]     = false;
            }
            else
            {
                blackboardTrigger[childObject] = false;
                alreadytalked[childObject]     = false;
            }
            sideCharacters.Add(childObject);
        }

        // initalizing blackborad
        blackboard.Add("move", false);     //mouse left click
        blackboard.Add("talk", false);     // right mouse click to talk

        behaviorAgent = new BehaviorAgent(this.BuildTreeRoot());
        BehaviorManager.Instance.Register(behaviorAgent);
        behaviorAgent.StartBehavior();
    }
    // Use this for initialization
    void Start()
    {
        MusicIntValue = 0;
        spawnPos [0]  = zombie1.transform.position;
        spawnPos [1]  = zombie1.transform.position + new Vector3(40, 0, 0);
        spawnPos [2]  = zombie1.transform.position + new Vector3(70, 0, 0);
        int spawnPoint = 0;

        spawnPoint             = Random.Range(0, 3);
        Zombie1InitialPosition = new Vector3(spawnPos[spawnPoint].x, spawnPos[spawnPoint].y, spawnPos[spawnPoint].z);
        print(spawnPoint + "\n");
        zombie1.GetComponent <SteeringController> ().Warp(Zombie1InitialPosition);

        spawnPos [0] = zombie.transform.position;
        spawnPos [1] = zombie.transform.position + new Vector3(60, 0, -180);
        spawnPos [2] = zombie.transform.position + new Vector3(90, 0, 0);
        spawnPoint   = 0;

        spawnPoint            = Random.Range(0, 3);
        ZombieInitialPosition = new Vector3(spawnPos[spawnPoint].x, spawnPos[spawnPoint].y, spawnPos[spawnPoint].z);
        print(spawnPoint + "\n");
        zombie.GetComponent <SteeringController> ().Warp(ZombieInitialPosition);

        //ZombieInitialPosition = zombie.transform.position;
        //Zombie1InitialPosition = zombie1.transform.position;
        offset        = participant.transform.position - camera.transform.position;
        behaviorAgent = new BehaviorAgent(this.BuildTreeRoot());
        BehaviorManager.Instance.Register(behaviorAgent);
        behaviorAgent.StartBehavior();
    }
    // Use this for initialization
    void Start()
    {
        behaviorAgent = new BehaviorAgent(this.BuildTreeRoot());
        BehaviorManager.Instance.Register(behaviorAgent);
        behaviorAgent.StartBehavior();


        //hunger = Random.Range(0, 20);
        //thirst = Random.Range(0, 15);
        //bladder = Random.Range(0, 5);

        if (bathrooms == null)
        {
            bathrooms = GameObject.FindGameObjectsWithTag("Bathroom");
        }
        if (water == null)
        {
            water = GameObject.FindGameObjectsWithTag("Water");
        }
        if (food == null)
        {
            food = GameObject.FindGameObjectsWithTag("Food");
        }

        PlayerPrefs.SetInt("Money", 250);
        PlayerPrefs.SetInt("Workers", 1);
    }
 protected void StartTree(
     Node root,
     BehaviorAgent.OnStatusChanged statusChanged = null)
 {
     this.Agent = new BehaviorAgent(root, statusChanged);
     this.Agent.BehaviorStart();
 }
Esempio n. 5
0
    /// <summary>
    /// Removes this event from the agent, restoring autonomy if appropriate
    /// </summary>
    /// <returns>true if the event is successfully detached</returns>
    private bool DetachFromAgent(BehaviorAgent agent)
    {
        // If we were the agent's current event, restore autonomy (even if the
        // agent has another pending event -- that event will just stop it)
        if (agent.CurrentEvent == this)
        {
            agent.EventFinished();
            agent.BehaviorStart();
        }

        // If we were a pending event, then the response depends
        if (agent.PendingEvent == this)
        {
            // Was the agent terminating because of us? If so, wait until it's
            // done terminating, and then restart it
            if (agent.AgentStatus == BehaviorAgent.Status.Terminating)
            {
                return(false);
            }

            // If the agent wasn't terminating, restart it if it's idle and then
            // clear the pending event
            if (agent.AgentStatus == BehaviorAgent.Status.Idle)
            {
                agent.BehaviorStart();
            }
            agent.PendingEvent = null;
            // Don't worry if another pending event swoops in and replaces us,
            // it'll handle the agent whether its terminating, running, or idle
        }

        return(true);
    }
Esempio n. 6
0
 void Start()
 {
     doors         = false;
     behaviorAgent = new BehaviorAgent(this.BuildTreeRoot());
     BehaviorManager.Instance.Register(behaviorAgent);
     behaviorAgent.StartBehavior();
 }
Esempio n. 7
0
 // Use this for initialization
 void Start()
 {
     guard         = gameObject;
     anim          = guard.GetComponent <Animator>();
     behaviorAgent = new BehaviorAgent(this.BuildTreeRoot());
     BehaviorManager.Instance.Register(behaviorAgent);
     behaviorAgent.StartBehavior();
 }
    // Start is called before the first frame update
    void Start()
    {
        aggression = new Val <float>(() => aggressionFloat);

        behaviorAgent = new BehaviorAgent(this.BuildTreeRoot());
        BehaviorManager.Instance.Register(behaviorAgent);
        behaviorAgent.StartBehavior();
    }
    // Use this for initialization
    void Start()
    {
        //moods = new string[people.Length];

        behaviorAgent = new BehaviorAgent(BuildTreeRoot());
        BehaviorManager.Instance.Register(behaviorAgent);
        behaviorAgent.StartBehavior();
    }
    void Start()
    {
        charMec = participant.GetComponent<BehaviorMecanim>();

        behaviorAgent = new BehaviorAgent(this.BuildTreeRoot());
        BehaviorManager.Instance.Register(behaviorAgent);
        behaviorAgent.StartBehavior();
    }
Esempio n. 11
0
 /// <summary>
 /// Kills either the agent's personal tree or current event,
 /// returning true iff the agent is ready to run this event
 /// </summary>
 private bool PrepareAgent(BehaviorAgent agent)
 {
     if (agent.CurrentEvent == null)
         return agent.BehaviorStop();
     return agent.CurrentEvent.EventKill();
     // TODO: For debugging, might want to make sure the agent isn't
     // running both an event and its own tree. - AS
 }
Esempio n. 12
0
  void Start()

  {
      behaviorAgent = new BehaviorAgent(this.ConversationTree());

      BehaviorManager.Instance.Register(behaviorAgent);

      behaviorAgent.StartBehavior();
  }
 // Use this for initialization
 void Start()
 {
     behaviorAgent = new BehaviorAgent (this.BuildTreeRoot ());
     BehaviorManager.Instance.Register (behaviorAgent);
     behaviorAgent.StartBehavior ();
     //behaviorAgent1 = new BehaviorAgent(this.BuildTreeRoot1());
     //BehaviorManager.Instance.Register(behaviorAgent1);
     //behaviorAgent1.StartBehavior();
 }
Esempio n. 14
0
    void Start()
    {
        behaviorAgent = new BehaviorAgent(this.BuildTreeRoot());
        BehaviorManager.Instance.Register(behaviorAgent);
        behaviorAgent.StartBehavior();

        thirst  = UnityEngine.Random.Range(0, 30);
        hunger  = UnityEngine.Random.Range(0, 25);
        bladder = UnityEngine.Random.Range(0, 15);
    }
 // Use this for initialization
 void Start()
 {
     characters.Add(participant1);
     characters.Add(participant2);
     int sizeofList = characters.Count;
     print (sizeofList);
     count = 0;
     behaviorAgent = new BehaviorAgent (this.BuildTreeRoot ());
     BehaviorManager.Instance.Register (behaviorAgent);
     behaviorAgent.StartBehavior ();
 }
Esempio n. 16
0
 // Use this for initialization
 void Start()
 {
     tomIsHere      = false;
     callingDaniel  = false;
     doorOpen       = false;
     danielAnimator = Daniel.GetComponent <Animator> ();
     doorAnimator   = door.GetComponent <Animator> ();
     behaviorAgent  = new BehaviorAgent(this.BuildTreeRoot());
     BehaviorManager.Instance.Register(behaviorAgent);
     behaviorAgent.StartBehavior();
     lightToSwitch4.enabled = false;
     lightToSwitch5.enabled = false;
 }
Esempio n. 17
0
    /// <summary>
    /// Injects this event as the next pending event for the
    /// given agent
    /// </summary>
    private void InjectEvent(BehaviorAgent agent)
    {
        // Either kill the active event or suspend the agent
        if (agent.CurrentEvent != null)
            agent.CurrentEvent.EventKill();
        else
            agent.BehaviorStop();

        // Kill any pending event and just replace it
        if (agent.PendingEvent != null)
            agent.PendingEvent.EventKill();
        agent.PendingEvent = this;
    }
    Vector3 axis = Vector3.up; // Rotation axis, here it the yaw axis

    // Use this for initialization
    void Start()
    {
        behaviorAgent = new BehaviorAgent(this.BuildTreeRoot());
        BehaviorManager.Instance.Register(behaviorAgent);
        behaviorAgent.StartBehavior();
        timer = wanderTimer;
        Dictionary <string, List <string> > BehaviourTreeAffordanceDictionary = environmentSetup.BehaviourTreeAffordanceDictionary;
        List <GameObject> gameObjectList = environmentSetup.gameObjectList;

        if (BehaviourTreeAffordanceDictionary.ContainsKey(BehaviourTree))
        {
            items = BehaviourTreeAffordanceDictionary[BehaviourTree];
        }
    }
Esempio n. 19
0
    // Use this for initialization
    void Start()
    {
        part1 = participant1.GetComponent <BehaviorMecanim> ();
        part2 = participant2.GetComponent <BehaviorMecanim> ();
        part3 = participant3.GetComponent <BehaviorMecanim> ();

        canvasLight.GetComponent <CanvasGroup>().alpha = 0;
        canvasTV.GetComponent <CanvasGroup>().alpha    = 0;
        behaviorAgent = new BehaviorAgent(this.BuildTreeRoot());
        BehaviorManager.Instance.Register(behaviorAgent);
        behaviorAgent.StartBehavior();

        Player = GameObject.Find("Player");
    }
Esempio n. 20
0
    // Use this for initialization
    void Start()
    {
        Vector3 doorPosition    = door.transform.position;
        Vector3 doorPositionNew = doorPosition + new Vector3(3.0F, 0, 0);

        door.transform.position = doorPositionNew;

        behaviorAgent1 = new BehaviorAgent(this.BuildTreeRoot()[0]);
        BehaviorManager.Instance.Register(behaviorAgent1);
        behaviorAgent2 = new BehaviorAgent(this.BuildTreeRoot()[1]);
        BehaviorManager.Instance.Register(behaviorAgent2);
        // behaviorAgent3 = new BehaviorAgent(this.BuildTreeRoot()[2]);
        // BehaviorManager.Instance.Register(behaviorAgent3);
        behaviorAgent1.StartBehavior();
        behaviorAgent2.StartBehavior();
        //  behaviorAgent3.StartBehavior();
    }
Esempio n. 21
0
        private FirefighterPartner(Vector3 position, float heading)
        {
            Firefighter = new Firefighter(position, heading);
            Firefighter.Equipment.SetEquipped <FireGearEquipment>(false);
            Firefighter.AI.IsEnabled = false;
            Firefighter.Deleted     += OnPedDeleted;

            Blip        = new Blip(Firefighter.Ped);
            Blip.Sprite = BlipSprite.Friend;
            Blip.Scale  = 0.65f;
            Blip.Color  = Color.FromArgb(180, 0, 0);
            Blip.Name   = "Firefighter Partner";

            BehaviorAgent = new BehaviorAgent(Firefighter.Ped);
            BehaviorAgent.Blackboard.Set <int>("partnerSeatIndex", GetAllPartners()?.Length ?? 0);
            BehaviorAgent.Blackboard.Set <Firefighter>("partnerFirefighterInstance", Firefighter);

            RegisterFirefighterPartner(this);
        }
Esempio n. 22
0
    // Use this for initialization
    void Start()
    {
        GameObject[] person;
        person = GameObject.FindGameObjectsWithTag("Player");

        GameObject[] points;
        person = GameObject.FindGameObjectsWithTag("meeting_point");
        Transform[] meeting_point = new Transform[points.Length];
        int         i             = 0;

        foreach (GameObject point in points)
        {
            meeting_point[i] = point.GetComponent <Transform>();
            i++;
        }

        behaviorAgent = new BehaviorAgent(this.BuildTreeRoot());
        BehaviorManager.Instance.Register(behaviorAgent);
        behaviorAgent.StartBehavior();
    }
Esempio n. 23
0
    // Use this for initialization
    void Start()
    {
        participants    = new GameObject[num];
        participants[0] = participant0;
        participants[1] = participant1;
        participants[2] = participant2;
        participants[3] = participant3;

        chairs    = new Transform[4];
        chairs[0] = chair0;
        chairs[1] = chair1;
        chairs[2] = chair2;
        chairs[3] = chair3;

        center.x = 13;
        center.y = 1;
        center.z = 23;

        behaviorAgent = new BehaviorAgent(this.BuildTreeRoot());
        BehaviorManager.Instance.Register(behaviorAgent);
        behaviorAgent.StartBehavior();
    }
Esempio n. 24
0
        public static void BehaviorTreePedTasks()
        {
            GameFiber.Sleep(250);

            Ped ped = new Ped("s_m_y_cop_01", Game.LocalPlayer.Character.GetOffsetPositionFront(20f), Game.LocalPlayer.Character.Heading);

            ped.BlockPermanentEvents = true;
            ped.Inventory.GiveNewWeapon(WeaponHash.CarbineRifle, -1, true);


            BehaviorTask root = new Selector(
                new GetNearestPedToAgent(new BlackboardSetter <Ped>("nearestPedTarget", BlackboardMemoryScope.Tree), 100, 15.0f, (p) => p.IsAlive,
                                         new Sequence(
                                             new EntityExists(new BlackboardGetter <Entity>("nearestPedTarget", BlackboardMemoryScope.Tree)),
                                             new ShootAt(3000, FiringPattern.BurstFireRifle, new BlackboardGetter <Entity>("nearestPedTarget", BlackboardMemoryScope.Tree))
                                             )
                                         ),
                new StatefulSequence(
                    new GoToPosition(Game.LocalPlayer.Character.GetOffsetPosition(new Vector3(-10f, 25f, 0f)), 10f, 2.0f),
                    new GoToPosition(Game.LocalPlayer.Character.GetOffsetPosition(new Vector3(-10f, 45f, 0f)), 10f, 2.0f),
                    new GoToPosition(Game.LocalPlayer.Character.GetOffsetPosition(new Vector3(10f, 45f, 0f)), 10f, 2.0f),
                    new GoToPosition(Game.LocalPlayer.Character.GetOffsetPosition(new Vector3(10f, 25f, 0f)), 10f, 2.0f)
                    )
                );

            BehaviorTree tree = new BehaviorTree(root);

            BehaviorAgent pedAgent = new BehaviorAgent(ped);

            while (true)
            {
                GameFiber.Sleep(250);

                tree.ExecuteOn(pedAgent);
            }
        }
Esempio n. 25
0
 // Use this for initialization
 void Start()
 {
     behaviorAgent = new BehaviorAgent(this.BuildTreeRoot());
     BehaviorManager.Instance.Register(behaviorAgent);
     behaviorAgent.StartBehavior();
     //GameObject party = GameObject.Find("Updater");
     //PartyBehavior partyBool = party.GetComponent<PartyBehavior>();
 }
Esempio n. 26
0
 /// <summary>
 /// Kills either the agent's personal tree or current event,
 /// returning true iff the agent is ready to run this event
 /// </summary>
 private bool PrepareAgent(BehaviorAgent agent)
 {
     if (agent.CurrentEvent == null)
         return agent.BehaviorStop();
     return agent.CurrentEvent.EventKill();
     // TODO: For debugging, might want to make sure the agent isn't
     // running both an event and its own tree. - AS
 }
    // Use this for initialization
    void Start()
    {
        participants = new GameObject[num];
        participants[0] = participant0;
        participants[1] = participant1;
        participants[2] = participant2;
        participants[3] = participant3;

        chairs = new Transform[4];
        chairs[0] = chair0;
        chairs[1] = chair1;
        chairs[2] = chair2;
        chairs[3] = chair3;

        center.x = 13;
        center.y = 1;
        center.z = 23;

        behaviorAgent = new BehaviorAgent (this.BuildTreeRoot ());
        BehaviorManager.Instance.Register (behaviorAgent);
        behaviorAgent.StartBehavior ();
    }
 // Use this for initialization
 void Start()
 {
     behaviorAgent = new BehaviorAgent (this.BehaviorTree());
     BehaviorManager.Instance.Register (behaviorAgent);
     behaviorAgent.StartBehavior ();
 }
    // Use this for initialization
    void Start()
    {
        //anim = GetComponent<Animator> ();
        //rbody = GetComponent<Rigidbody> ();
        //agent = GetComponent<NavMeshAgent> ();

        behaviorAgent = new BehaviorAgent (this.TreeRoot ());
        BehaviorManager.Instance.Register (behaviorAgent);
        behaviorAgent.StartBehavior ();

        inputH = 0f;
        inputV = 0f;
        run = false;
        channel = false;
        jump = false;
        userControlled = false;
    }
Esempio n. 30
0
    /// <summary>
    /// Injects this event as the next pending event for the
    /// given agent
    /// </summary>
    private void InjectEvent(BehaviorAgent agent)
    {
        // Either kill the active event or suspend the agent
        if (agent.CurrentEvent != null)
            agent.CurrentEvent.EventKill();
        else
            agent.BehaviorStop();

        // Kill any pending event and just replace it
        if (agent.PendingEvent != null)
            agent.PendingEvent.EventKill();
        agent.PendingEvent = this;
    }
Esempio n. 31
0
 void Start()
 {
     theGuy = new BehaviorAgent(this.BuildTreeRoot());
     BehaviorManager.Instance.Register(theGuy);
     theGuy.StartBehavior();
 }
Esempio n. 32
0
 // Use this for initialization
 void Start()
 {
     dialog.text = "It's unwise to jaywalk across a busy street. Someone could get hurt!";
     hitStatus = 0;
     behaviorAgent = new BehaviorAgent(this.BuildTreeRoot());
     BehaviorManager.Instance.Register(behaviorAgent);
     behaviorAgent.StartBehavior();
 }
Esempio n. 33
0
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.E) == true)
        {
            Val<Vector3> P1Pos = Val.V(() => person1.transform.position);
            Val<Vector3> P2Pos = Val.V(() => person2.transform.position);
            Val<Vector3> P3Pos = Val.V(() => deltrese.transform.position);

            agent = new BehaviorAgent(conversationTree(P1Pos, P2Pos, P3Pos));
            BehaviorManager.Instance.Register(agent);
            agent.StartBehavior();
        }
    }
    // Use this for initialization
    void Start()
    {
        MusicIntValue = 0;
        spawnPos [0] = zombie1.transform.position;
        spawnPos [1] = zombie1.transform.position + new Vector3 (40, 0, 0);
        spawnPos [2] = zombie1.transform.position +  new Vector3 (70, 0, 0);
        int spawnPoint = 0;

        spawnPoint = Random.Range(0, 3);
        Zombie1InitialPosition = new Vector3(spawnPos[spawnPoint].x,spawnPos[spawnPoint].y,spawnPos[spawnPoint].z);
        print (spawnPoint + "\n");
        zombie1.GetComponent<SteeringController> ().Warp (Zombie1InitialPosition);

        spawnPos [0] = zombie.transform.position;
        spawnPos [1] = zombie.transform.position + new Vector3 (60, 0, -180);
        spawnPos [2] = zombie.transform.position +  new Vector3 (90, 0, 0);
        spawnPoint = 0;

        spawnPoint = Random.Range(0, 3);
        ZombieInitialPosition = new Vector3(spawnPos[spawnPoint].x,spawnPos[spawnPoint].y,spawnPos[spawnPoint].z);
        print (spawnPoint + "\n");
        zombie.GetComponent<SteeringController> ().Warp (ZombieInitialPosition);

        //ZombieInitialPosition = zombie.transform.position;
        //Zombie1InitialPosition = zombie1.transform.position;
        offset = participant.transform.position - camera.transform.position;
        behaviorAgent = new BehaviorAgent (this.BuildTreeRoot ());
        BehaviorManager.Instance.Register (behaviorAgent);
        behaviorAgent.StartBehavior ();
    }
Esempio n. 35
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown (KeyCode.F)) {
            fightOrScare = 0;
        }

        if (Input.GetKeyDown (KeyCode.B)) {
            fightOrScare = 1;
        }

        if (Input.GetKey (KeyCode.LeftShift) || Input.GetKey (KeyCode.RightShift)) {
            if (Input.GetKeyDown (KeyCode.H)) {
                antagonist = Hero;
                selectedAntagonist = 0;
            }
            if (Input.GetKeyDown (KeyCode.Alpha1) || Input.GetKeyDown (KeyCode.Keypad1)) {
                antagonist = EvilKnight1;
                selectedAntagonist = 1;
            }
            if (Input.GetKeyDown (KeyCode.Alpha2) || Input.GetKeyDown (KeyCode.Keypad2)) {
                antagonist = EvilKnight2;
                selectedAntagonist = 2;
            }
            if (Input.GetKeyDown (KeyCode.Alpha3) || Input.GetKeyDown (KeyCode.Keypad3)) {
                antagonist = EvilKnight3;
                selectedAntagonist = 3;
            }
            if (Input.GetKeyDown (KeyCode.Alpha4) || Input.GetKeyDown (KeyCode.Keypad4)) {
                antagonist = EvilKnight4;
                selectedAntagonist = 4;
            }
            if (Input.GetKeyDown (KeyCode.Alpha5) || Input.GetKeyDown (KeyCode.Keypad5)) {
                antagonist = EvilKnight9;
                selectedAntagonist = 5;
            }
            if (Input.GetKeyDown (KeyCode.Alpha6) || Input.GetKeyDown (KeyCode.Keypad6)) {
                antagonist = EvilKnight10;
                selectedAntagonist = 6;
            }
            if (Input.GetKeyDown (KeyCode.Alpha7) || Input.GetKeyDown (KeyCode.Keypad7)) {
                antagonist = EvilKnight11;
                selectedAntagonist = 7;
            }
            if (Input.GetKeyDown (KeyCode.Alpha8) || Input.GetKeyDown (KeyCode.Keypad8)) {
                antagonist = EvilKnight12;
                selectedAntagonist = 8;
            }
            if (Input.GetKeyDown (KeyCode.G)) {
                antagonist = Goblin;
                selectedAntagonist = 9;
            }
            if (Input.GetKeyDown (KeyCode.S)) {
                antagonist = Skeleton1;
                selectedAntagonist = 10;
            }
        } else {
            if (Input.GetKeyDown (KeyCode.H)) {
                protagonist = Hero;
                selectedProtagonist = 0;
                cameraSelect = 1;
            }
            if (Input.GetKeyDown (KeyCode.Alpha1) || Input.GetKeyDown (KeyCode.Keypad1)) {
                protagonist = EvilKnight1;
                selectedProtagonist = 1;
                cameraSelect = 1;
            }
            if (Input.GetKeyDown (KeyCode.Alpha2) || Input.GetKeyDown (KeyCode.Keypad2)) {
                protagonist = EvilKnight2;
                selectedProtagonist = 2;
                cameraSelect = 1;
            }
            if (Input.GetKeyDown (KeyCode.Alpha3) || Input.GetKeyDown (KeyCode.Keypad3)) {
                protagonist = EvilKnight3;
                selectedProtagonist = 3;
                cameraSelect = 1;
            }
            if (Input.GetKeyDown (KeyCode.Alpha4) || Input.GetKeyDown (KeyCode.Keypad4)) {
                protagonist = EvilKnight4;
                selectedProtagonist = 4;
                cameraSelect = 1;
            }
            if (Input.GetKeyDown (KeyCode.Alpha5) || Input.GetKeyDown (KeyCode.Keypad5)) {
                protagonist = EvilKnight9;
                selectedProtagonist = 5;
                cameraSelect = 1;
            }
            if (Input.GetKeyDown (KeyCode.Alpha6) || Input.GetKeyDown (KeyCode.Keypad6)) {
                protagonist = EvilKnight10;
                selectedProtagonist = 6;
                cameraSelect = 1;
            }
            if (Input.GetKeyDown (KeyCode.Alpha7) || Input.GetKeyDown (KeyCode.Keypad7)) {
                protagonist = EvilKnight11;
                selectedProtagonist = 7;
                cameraSelect = 1;
            }
            if (Input.GetKeyDown (KeyCode.Alpha8) || Input.GetKeyDown (KeyCode.Keypad8)) {
                protagonist = EvilKnight12;
                selectedProtagonist = 8;
                cameraSelect = 1;
            }
            if (Input.GetKeyDown (KeyCode.G)) {
                protagonist = Goblin;
                selectedProtagonist = 9;
                cameraSelect = 1;
            }
            if (Input.GetKeyDown (KeyCode.S)) {
                protagonist = Skeleton1;
                selectedProtagonist = 10;
                cameraSelect = 1;
            }
        }

        if (Input.GetKeyDown (KeyCode.C)) {
            if (cameraSelect == 0) {
                cameraSelect = 1;
            } else {
                cameraSelect = 0;
            }
        }

        if (cameraSelect == 0) {
            CameraView.transform.position = new Vector3 (250, 600, -200);
            CameraView.transform.eulerAngles = new Vector3 (60, 0, 0);
        } else {
            CameraView.transform.position = protagonist.transform.position + new Vector3 (0, 200, 0);
            CameraView.transform.eulerAngles = protagonist.transform.eulerAngles + new Vector3 (90, 0, 0);
        }

        if (Input.GetKeyDown(KeyCode.Return))
        {
            BehaviorAgent.StopBehavior();
            BehaviorAgent = new BehaviorAgent(this.BuildTreeRoot());
            BehaviorManager.Instance.Register(BehaviorAgent);
            BehaviorAgent.StartBehavior();
        }
    }
Esempio n. 36
0
 // Start is called before the first frame update
 void Start()
 {
     behaviorAgent = new BehaviorAgent(this.BuildTreeRoot());
     BehaviorManager.Instance.Register(behaviorAgent);
 }
 // Use this for initialization
 void Start()
 {
     behaviorAgent = new BehaviorAgent(BuildTreeRoot());
     BehaviorManager.Instance.Register(behaviorAgent);
     behaviorAgent.StartBehavior();
 }
 // Use this for initialization
 void Start()
 {
     behaviorAgent = new BehaviorAgent(this.BuildTreeRoot());
     print(cop_Wander1);
     BehaviorManager.Instance.Register(behaviorAgent);
     behaviorAgent.StartBehavior();
 }
 // Use this for initialization
 void Start()
 {
     CopClicked = Val.V(() => new GameObject());
     behaviorAgent = new BehaviorAgent (this.BehaviorTree());
     BehaviorManager.Instance.Register (behaviorAgent);
     behaviorAgent.StartBehavior ();
 }
Esempio n. 40
0
 // Use this for initialization
 void Start()
 {
     mainEvent = false;
     behaviorAgent = new BehaviorAgent(this.BuildTreeRoot());
     behaviorAgent2 = new BehaviorAgent(this.event2());
     BehaviorManager.Instance.Register(behaviorAgent);
     BehaviorManager.Instance.Register(behaviorAgent2);
     behaviorAgent.StartBehavior();
 }
Esempio n. 41
0
    /*
        0 = time runs out;
        1 = pan reaches jane;
        2 = jane reaches boat;
        3 = befriends boy and dances it out;
    */
    void Start()
    {
        /* Timer on the game to limit ending */
        startTime = Time.time;
        gameTime = 60;
        remainingTime = gameTime - (Time.time - startTime);

        /*
            Collect ALL the lost boys:
            - remember to tag all the objects before this
            Find ALL the spots in which they play in
        */
        lostboys = GameObject.FindGameObjectsWithTag ("Lostboy");

        for (int i = 0; i < lostboys.Length; i++) {
            Debug.Log("Lostboy "+i+" is named "+lostboys[i].name);
        }

        playspotObs = GameObject.FindGameObjectsWithTag ("Playspot");
        playspots = new Transform[playspotObs.Length];
        for (int i = 0; i < playspotObs.Length; i++) {
            playspots[i] = playspotObs[i].transform;
            //Debug.Log("Playspot "+i+" is at "+playspots[i].position.x);
        }
        broFound = false;

        ending = -1;
        characterMarker = -1;
        beginningArcMarker = true;
        checkBoyMarker = false;
        unityChanMarker = false;
        signalMarker = false;
        endingMarker = false;

        selectedLostBoy = lostboys[0];
        checkThisBrother = lostboys[0];

        brotherIndex = Random.Range(0, lostboys.Length);

        unityChan.GetComponent<UnitySteeringController>().maxSpeed = 20;
        jane.GetComponent<UnitySteeringController>().maxSpeed = 20;

        behaviorAgent = new BehaviorAgent (this.BuildTreeRoot ());
        BehaviorManager.Instance.Register (behaviorAgent);
        behaviorAgent.StartBehavior ();
    }
 //============================
 // Use this for initialization
 void Start()
 {
     currentArc = Arcs.Intro;
     behaviorAgent = new BehaviorAgent (this.InteractiveBehaviorTree());
     BehaviorManager.Instance.Register (behaviorAgent);
     behaviorAgent.StartBehavior ();
 }
Esempio n. 43
0
 void Start()
 {
     participant.GetComponent<UnitySteeringController>().maxSpeed = 1;
     behaviorAgent = new BehaviorAgent (this.BuildTreeRoot ());
     BehaviorManager.Instance.Register (behaviorAgent);
     behaviorAgent.StartBehavior ();
 }
 // Use this for initialization
 void Start()
 {
     behaviorAgent = new BehaviorAgent (ST_RideSnail (snailDest));				//this.ST_PushBox(boxPushPoint, offPlatformCharacter)); //InteractiveBehaviorTree());
     BehaviorManager.Instance.Register (behaviorAgent);
     behaviorAgent.StartBehavior ();
 }
Esempio n. 45
0
    /// <summary>
    /// Removes this event from the agent, restoring autonomy if appropriate
    /// </summary>
    /// <returns>true if the event is successfully detached</returns>
    private bool DetachFromAgent(BehaviorAgent agent)
    {
        // If we were the agent's current event, restore autonomy (even if the
        // agent has another pending event -- that event will just stop it)
        if (agent.CurrentEvent == this)
        {
            agent.EventFinished();
            agent.BehaviorStart();
        }

        // If we were a pending event, then the response depends
        if (agent.PendingEvent == this)
        {
            // Was the agent terminating because of us? If so, wait until it's
            // done terminating, and then restart it
            if (agent.AgentStatus == BehaviorAgent.Status.Terminating)
                return false;

            // If the agent wasn't terminating, restart it if it's idle and then
            // clear the pending event
            if (agent.AgentStatus == BehaviorAgent.Status.Idle)
                agent.BehaviorStart();
            agent.PendingEvent = null;
            // Don't worry if another pending event swoops in and replaces us,
            // it'll handle the agent whether its terminating, running, or idle
        }

        return true;
    }
    // Use this for initialization
    void Start()
    {
        GameObject[] person;
        person = GameObject.FindGameObjectsWithTag("Player");

        GameObject[] points;
        person = GameObject.FindGameObjectsWithTag("meeting_point");
        Transform[] meeting_point = new Transform[points.Length];
        int i = 0;
        foreach(GameObject point in points){
            meeting_point[i] = point.GetComponent<Transform>();
            i++;
            }

        behaviorAgent = new BehaviorAgent (this.BuildTreeRoot ());
        BehaviorManager.Instance.Register (behaviorAgent);
        behaviorAgent.StartBehavior ();
    }
 // Use this for initialization
 void Start()
 {
     behaviorAgent = new BehaviorAgent (this.BuildTreeRoot ());
     BehaviorManager.Instance.Register (behaviorAgent);
     behaviorAgent.StartBehavior ();
     acts = new GameObject[]{ GameObject.Find ("act1"), GameObject.Find ("act2"), GameObject.Find ("act3"), GameObject.Find ("act4") };
 }
Esempio n. 48
0
 public void Awake()
 {
     behaviorAgent = new BehaviorAgent(this.BuildTreeRoot());
 }
    // Use this for initialization
    void Start()
    {
        participants = new GameObject[5];
        participants[0] = participant1;
        participants[1] = participant2;
        participants[2] = participant3;
        participants[3] = participant4;
        participants[4] = participant5;

        selectedParticipant = 0;

        behaviorAgent = new BehaviorAgent(this.BuildTreeRoot());
        BehaviorManager.Instance.Register(behaviorAgent);
        behaviorAgent.StartBehavior();
    }
Esempio n. 50
0
 // Use this for initialization
 void Start()
 {
     for (int i = 0; i < 11; i++) {
         aliveStatus [i] = 1;
     }
     BehaviorAgent = new BehaviorAgent(this.BuildTreeRoot());
     BehaviorManager.Instance.Register(BehaviorAgent);
     BehaviorAgent.StartBehavior();
 }