public override Status start(EntityKnowledgeFacade entity, UInt32 request, FaceEntityParam parameters, StaticObject paramsOut) { // just call the update function as all the code is in it GameObject[] charact = GameObject.FindGameObjectsWithTag("Character"); nbrEntity = charact.Length; return(update(entity, request, parameters, paramsOut, 0f)); }
public override Status start(EntityKnowledgeFacade entity, UInt32 request, DisplayBubbleParam parameters, StaticObject paramsOut) { SpeechBubble bubble = entity.entity.GetComponent <SpeechBubble>(); bubble.bubbleText = parameters.BubbleText != "none"?parameters.BubbleText:""; return(Status.succeeded); }
// called when the action is cancelled // nothing special to do public override Status cancel(EntityKnowledgeFacade entity, UInt32 request, GotoEntityParam parameters, float dt) { NavMeshAgent nav = entity.entity.GetComponent <NavMeshAgent>(); nav.Stop(); return(Status.canceled); }
// called when the action is cancelled // nothing special to do public override Status cancel(EntityKnowledgeFacade entity, UInt32 request, StopParticipateParam parameters, float dt) { if (entity.entity == null) { return(Status.canceled); } return(Status.canceled); }
// called when the action is cancelled // nothing special to do public override Status cancel(EntityKnowledgeFacade entity, UInt32 request, AlignParam parameters, float dt) { if (entity.entity == null) { return(Status.canceled); } entity.entity.SendMessage("AlignStop", SendMessageOptions.DontRequireReceiver); return(Status.canceled); }
public override Status update(EntityKnowledgeFacade entity, UInt32 request, StopParticipateParam parameters, StaticObject paramsOut, float dt) { if (entity.getKnowledge().getInt("Events.inEvent") == 0) { entity.getKnowledge().setInt("Events.inEvent", 1); } if (entity.getKnowledge().getInt("IP.inIP") == 0) { entity.getKnowledge().setInt("IP.inIP", 1); } return(Status.succeeded); }
// called when the action is cancelled // nothing special to do public override Status cancel(EntityKnowledgeFacade entity, UInt32 request, GotoParam parameters, float dt) { if (!entity.entity) { return(Status.canceled); } NavMeshAgent Agent = entity.entity.GetComponent <NavMeshAgent>(); Stop(Agent); entity.entity.SendMessage("GotoStop", SendMessageOptions.DontRequireReceiver); return(Status.canceled); }
public override Status update(EntityKnowledgeFacade entity, UInt32 request, AlignParam parameters, StaticObject paramsOut, float dt) { Quaternion actual = entity.entity.transform.rotation; float dif = Mathf.Abs(Mathf.DeltaAngle(actual.eulerAngles.y, parameters.orientation)); if (dif <= parameters.threshold) { entity.entity.SendMessage("AlignStop", SendMessageOptions.DontRequireReceiver); return(Status.succeeded); } entity.entity.transform.rotation = Quaternion.Lerp(actual, Quaternion.Euler(0, parameters.orientation, 0), 2f * dt); return(Status.running); }
public override Status start(EntityKnowledgeFacade entity, UInt32 request, GotoParam parameters, StaticObject paramsOut) { // just call the update function as all the code is in it NavMeshAgent Agent = entity.entity.GetComponent <NavMeshAgent>(); if (!Agent.enabled) { Agent.enabled = true; } Agent.SetDestination(parameters.target); Agent.Resume(); entity.entity.SendMessage("GotoStart", parameters.target, SendMessageOptions.DontRequireReceiver); return(Status.running); }
public override Status update(EntityKnowledgeFacade entity, UInt32 request, BubbleInteractionParam parameters, StaticObject paramsOut, float dt) { if (entity.entity.GetComponentInChildren <MessageDisplayer>() != null && entity.entity.GetComponentInChildren <MessageDisplayer>().enabled) { entity.entity.GetComponentInChildren <MessageDisplayer>().SetMessage(parameters.text); } if (entity.entity.GetComponentInChildren <Message3DDisplayer>() != null && entity.entity.GetComponentInChildren <Message3DDisplayer>().enabled) { if (parameters.text == "none") { parameters.text = ""; } tm = entity.entity.GetComponentInChildren <TextMesh>(); tm.text = parameters.text; } return(Status.succeeded); }
// called when the action is cancelled // nothing special to do public override Status cancel(EntityKnowledgeFacade entity, UInt32 request, BubbleInteractionParam parameters, float dt) { if (entity.entity == null) { return(Status.canceled); } if (entity.entity.GetComponentInChildren <MessageDisplayer>() != null && entity.entity.GetComponentInChildren <MessageDisplayer>().enabled) { entity.entity.GetComponentInChildren <MessageDisplayer>().SetMessage("none"); } if (entity.entity.GetComponentInChildren <Message3DDisplayer>() != null && entity.entity.GetComponentInChildren <Message3DDisplayer>().enabled) { entity.entity.GetComponentInChildren <TextMesh>().text = ""; } return(Status.canceled); }
public override Status update(EntityKnowledgeFacade entity, UInt32 request, FaceEntityParam parameters, StaticObject paramsOut, float dt) { if (parameters.targetEntity != "none") { for (uint i = 0; i < nbrEntity; i++) { if (i != entity.entity.entityID) { Aname = entity.getEntityKnowledge(i).getString("name"); if (Aname == parameters.targetEntity) { entity.getEntityKnowledge(i).retrieve(entity.getEntityKnowledge(i).getProperty("position"), out position); } } } } if (parameters.targetID != -1) { index = (uint)parameters.targetID; entity.getEntityKnowledge(index).retrieve(entity.getEntityKnowledge(index).getProperty("position"), out position); } if (parameters.pos != Vector3.zero) { position = parameters.pos; } // get the transform of the entity asked to face Transform self = entity.entity.transform; // create a quaternion to look along the direction of the targetPosition Quaternion lookAt = Quaternion.LookRotation((position - self.position).normalized); // slowly rotate toward it self.rotation = Quaternion.RotateTowards(self.rotation, lookAt, 180f * dt); // if almost facing ... if (RotationEquals(self.rotation, lookAt)) { // then it is time to end the facing return(Status.succeeded); } // else we will continue rotating return(Status.running); }
public override Status update(EntityKnowledgeFacade entity, UInt32 request, GotoParam parameters, StaticObject paramsOut, float dt) { NavMeshAgent Agent = entity.entity.GetComponent <NavMeshAgent>(); if (isArrived(entity.entity.transform.position, parameters, Agent)) //|| finished[request] ) { Stop(Agent); entity.entity.SendMessage("GotoStop", SendMessageOptions.DontRequireReceiver); return(Status.succeeded); } /*if (entity.getKnowledge().getInt("Events.inEvent") == 0 && entity.getKnowledge().getBool("Positioning.begin") == false) * { * entity.entity.SendMessage("GotoStop", SendMessageOptions.DontRequireReceiver); * return Status.succeeded; * }*/ //if (entity.entity.GetComponentInChildren<MessageDisplayer>() != null) // entity.entity.GetComponentInChildren<MessageDisplayer>().SetMessage("none"); // Debug.Log ("set dest at update"); Agent.SetDestination(parameters.target); return(Status.running); }
public override Status update(EntityKnowledgeFacade entity, UInt32 request, GotoEntityParam parameters, StaticObject paramsOut, float dt) { if (parameters.target != "none") { for (uint i = 0; i < nbrEntity; i++) { if (i != entity.entity.entityID) { Aname = entity.getEntityKnowledge(i).getString("name"); if (Aname == parameters.target) { entity.getEntityKnowledge(i).retrieve(entity.getEntityKnowledge(i).getProperty("position"), out position); if (parameters.location == true) { entity.getKnowledge().setString("location", "none"); entity.getKnowledge().setString("interactName", "none"); entity.getKnowledge().setString("destination", Aname); } } } } } if (parameters.targetID != -1) { index = (uint)parameters.targetID; entity.getEntityKnowledge(index).retrieve(entity.getEntityKnowledge(index).getProperty("position"), out position); if (parameters.location == true) { entity.getKnowledge().setString("location", "none"); entity.getKnowledge().setString("interactName", "none"); //entity.getKnowledge().setString("destination", Aname); } } //index = (uint)parameters.target; //Debug.Log(index); //entity.getEntityKnowledge(index).retrieve(entity.getEntityKnowledge(index).getProperty("position"), out position); GameObject self = entity.entity.gameObject; NavMeshAgent nav = entity.entity.GetComponent <NavMeshAgent>(); // Create a vector from the enemy to the last sighting of the player. Vector3 sightingDeltaPos = position - self.transform.position; // If the the last personal sighting of the player is not close... if (sightingDeltaPos.sqrMagnitude > 4f) { // ... set the destination for the NavMeshAgent to the last personal sighting of the player. nav.destination = position; } if (sightingDeltaPos.sqrMagnitude < parameters.threshold) { nav.Stop(); if (parameters.location == true) { entity.getKnowledge().setString("location", Aname); entity.getKnowledge().setString("interactName", Aname); entity.getKnowledge().setString("destination", "none"); } return(Status.succeeded); } /*for(uint i = 0; i < nbrEntity; i++){ * if(entity.getEntityKnowledge(i).getBool("interruption") == true) * { * nav.Stop(); * return Status.succeeded; * } * }*/ return(Status.running); }
public override Status start(EntityKnowledgeFacade entity, UInt32 request, AlignParam parameters, StaticObject paramsOut) { // just call the update function as all the code is in it entity.entity.SendMessage("AlignStart", parameters.orientation, SendMessageOptions.DontRequireReceiver); return(update(entity, request, parameters, paramsOut, 0f)); }
// called when the action is cancelled // nothing special to do public override Status cancel(EntityKnowledgeFacade entity, UInt32 request, FaceEntityParam parameters, float dt) { return(Status.canceled); }
public override Status start(EntityKnowledgeFacade entity, UInt32 request, BubbleInteractionParam parameters, StaticObject paramsOut) { mlv.Simulation.instance.knowledgeFramework.getGlobalWorkingKnowledge().setString("LifeScene", "none"); return(update(entity, request, parameters, paramsOut, 0f)); }
public override Status start(EntityKnowledgeFacade entity, UInt32 request, GotoEntityParam parameters, StaticObject paramsOut) { // just call the update function as all the code is in it nbrEntity = Simulation.instance.knowledgeFramework.getGlobalWorkingKnowledge().getInt("nbrEntity"); return(update(entity, request, parameters, paramsOut, 0f)); }
public override Status update(EntityKnowledgeFacade entity, UInt32 request, DisplayBubbleParam parameters, StaticObject paramsOut, float dt) { return(Status.failed); }
public override Status update(EntityKnowledgeFacade entity, UInt32 request, DebugParam parameters, StaticObject outParam, float dt) { return(Status.succeeded); }
public override Status start(EntityKnowledgeFacade entity, UInt32 request, DebugParam parameters, StaticObject outParam) { Debug.Log(parameters.outputMessage); return(Status.succeeded); }
public override Status start(EntityKnowledgeFacade entity, UInt32 request, StopParticipateParam parameters, StaticObject paramsOut) { // just call the update function as all the code is in it return(update(entity, request, parameters, paramsOut, 0f)); }