private void Awake() { manager = GameObject.Find("Managers"); forinteraction = manager.GetComponent <interaction>(); //gazedAt = false; }
void Start() { action = false; newGoal(); agent = GetComponent <UnityEngine.AI.NavMeshAgent> (); agent.destination = goal; interacting = detection.GetComponent <interaction>(); }
interaction CreateInteraction(Intent intent, double sentimentScore, string text) { interaction iaction = new interaction(); interactionIntent iactionitem = new interactionIntent(); iactionitem.confidence = intent.score; iactionitem.name = intent.intent; iaction.interactionIntents.Add(iactionitem); iaction.text = text; iaction.sentiment = Convert.ToDecimal(sentimentScore); return(iaction); }
public void bowHit(GameObject enemy) { int damage; interaction interEnemy = enemy.GetComponent <interaction>(); damage = Random.Range(myStats.ranged_dmg_min, myStats.ranged_dmg_max); if (animator) { animator.SetTrigger("attack"); } interEnemy.applyDamage(damage); }
public void swordHit(GameObject enemy) { int damage; interaction interEnemy = enemy.GetComponent <interaction>(); //int sndfx; damage = Random.Range(myStats.melee_dmg_min, myStats.melee_dmg_max); //sndfx = Random.Range(0,8); //AudioSource.PlayClipAtPoint(meleeBattle[sndfx], transform.position); if (animator) { animator.SetTrigger("attack"); } interEnemy.applyDamage(damage); }
//Change l'etat d'interaction de l'humanoide public void setInteractionState(interaction newInteraction) { interactionState = newInteraction; }
//Comportement de l'IA sans interaction void updateWalk() { //Si on est arrivé à destination if(isArrive()) { //Si il ne s'agit pas d'une entrée d'escalator if(pathNodeTab[destPathNode].name != "PathNodeLink") { //On definit une autre destination newDestination(); //On l'envoie vers la destination walk (); } //Sinon on entre dans un escalator else { //On lui indique qu'il est en interaction avec un escalator interactionState = interaction.escalator; //On desactive son navMesh navMesh.enabled = false; //On passe l'animation en IDLE setState (0); //On actualise l'etage if(pathNodeTab [destPathNode].GetComponent<Escalator>().pathNodeOut.transform.position.y>transform.position.y) curFloor++; else curFloor--; } } }
//Verifie si le joueur a atteind le groupe void updateGoToGroupe() { Debug.Log ("J'y vais !"); if(Mathf.Abs(transform.position.x-navMesh.destination.x)<0.5f && Mathf.Abs(transform.position.z-navMesh.destination.z)<0.5f) { Debug.Log("Jsuis dans le groupe chef !"); //On passe l'animation en IDLE setState (0); //Et on change son interaction interactionState = interaction.inGroupe; } }
//Comportement de l'IA dans l'escalator void updateEscalator() { //On recupère la position de la fin de l'escalator Vector3 posPathNodeOut = pathNodeTab [destPathNode].GetComponent<Escalator>().pathNodeOut.transform.position; //Si l'humanoide a atteint la fin de l'escalator if(Mathf.Abs(posPathNodeOut.x - transform.position.x) < 0.1f && Mathf.Abs(posPathNodeOut.z - transform.position.z) < 0.1f) { //On recupere le nouveau tableau des pathNodes getPathNodeTab(); //On reactive le navMeshAgent navMesh.enabled = true; //On met fin a l'interaction avec l'escalator interactionState = interaction.nothing; //On choisi une nouvelle direction newDestination(); //On envoi l'humanoide vers cette destination walk (); //On definit si il marche ou il court setState (Random.Range(1,3)); } //Sinon on continu sur l'escalator else { transform.Translate(Vector3.Normalize((posPathNodeOut-transform.position))*Time.deltaTime*(pathNodeTab [destPathNode].GetComponent<Escalator>().speed), Space.World); } }
//Travaux à reprendre plustard // private List<GameObject> Magasins; // private int RandomMagasin; // public GameObject PlanTouchePrefab; //////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////// //Initialisation //////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////// // Use this for initialization void Start() { //Defini l'ID de l'humanoide if(ID == 0) ID = 1; else ID++; //Creation d'une variable d'etat synchronisé state = gameObject.AddComponent<SharedData>(); state.createData ("Humanoide" + ID.ToString ()); //Recupere l'Animator animControl = GetComponentInChildren<Animator>(); //Initialise le tableau des pathNodes pathNodeTab = new List<Transform>(); getPathNodeTab (); //Initialise le niveau d'interaction avec l'environement à nothing (aucune interaction à l'instanciation) interactionState = interaction.nothing; //Recupere le navMeshAgent navMesh = GetComponent<NavMeshAgent> (); //Generation aléatoire du point de destination lors du spawn et le fait aller à ce point destPathNode = Random.Range (0, pathNodeTab.Count); walk (); //Initialise son état (marche / course) setState (Random.Range(1,3)); //??? //Magasins = new List<GameObject>(); //Initialise le tableau des magasins qu'ils peuvent regarder //getMagasins(); }
// Use this for initialization void Start() { track_obj = GetComponent <SteamVR_TrackedObject>(); interact = this.GetComponent <interaction>(); kine = gripper.GetComponent <gripper_kinematic>(); }
private double[] finger_array; // Temp array to collect finger array values // Use this for initialization void Start() { manus_inpt = Manus_API.GetComponent <Manus_interpreter>(); interact = this.GetComponent <interaction>(); }