public void setStartAndEndInfo(Tuple3 <Pos, WayReference, Vector3> startInfo, Tuple3 <Pos, WayReference, Vector3> endInfo, Setup.PersonSetup personality, Pos targetPos) { setWaypointsInfo(personality); path = Game.calculateCurrentPaths(startInfo.First, endInfo.First, null, wayPoints, false, true); walkPath = Misc.posToVector3(path); this.targetPos = targetPos; InformationHuman informationHuman = GetComponent <InformationHuman> (); PubSub.publish("TargetPOI(" + targetPos.Id + "):Add", informationHuman); if (path.Count == 1) { Destroy(gameObject); return; } // Rotate human... Pos pos1 = path [0]; Pos pos2 = path [1]; Pos lastPos = path [path.Count - 1]; Pos secondToLastPos = path [path.Count - 2]; WayReference startWay = startInfo.Second; if (personality != null && personality.startVector != null || startWay.hasNodes(pos1, pos2)) { walkPath.RemoveAt(0); path.RemoveAt(0); } walkPath.Insert(0, startInfo.Third); path.Insert(0, Game.createTmpPos(startInfo.Third)); endWay = endInfo.Second; if (endWay.hasNodes(secondToLastPos, lastPos)) { walkPath.RemoveAt(walkPath.Count - 1); path.RemoveAt(path.Count - 1); } walkPath.Add(endInfo.Third); path.Add(Game.createTmpPos(endInfo.Third)); // Adjust position to side of bigger ways adjustPositionsOnBiggerWays(path, walkPath, startWay, endWay); DebugFn.DebugPath(walkPath); Vector3 vec1 = walkPath [0]; Vector3 vec2 = walkPath [1]; positionHuman(vec1); rotateHuman(vec2, vec1); walkPath.RemoveAt(0); }
private static bool checkInformationHuman(Objective objective) { InformationHuman human = getInformationHuman(objective.targetId); if (human != null) { switch (objective.key) { case "distance": return(human.distance >= objective.value); // TODO - More here - money, mood? } } return(false); }
private static InformationHuman getInformationHuman(long targetId) { if (!cachedHumans.ContainsKey(targetId)) { GameObject human = GameObject.Find("Human (id:" + targetId + ")"); if (human != null) { InformationHuman informationHuman = human.GetComponent <InformationHuman> (); cachedHumans.Add(targetId, informationHuman); informationHuman.getInformation(); } } if (cachedHumans.ContainsKey(targetId)) { return(cachedHumans [targetId]); } return(null); }
public PROPAGATION onMessage(string message, object data) { if (message == "TargetPOI(" + node.Id + "):Add") { InformationHuman personGoingHere = (InformationHuman)data; peopleGoingHere.Add(personGoingHere); return(PROPAGATION.STOP_IMMEDIATELY); } else if (message == "TargetPOI(" + node.Id + "):Remove") { InformationHuman personGoingHere = (InformationHuman)data; peopleGoingHere.Remove(personGoingHere); return(PROPAGATION.STOP_IMMEDIATELY); } else if (message == "gameIsReady") { adjustPOIIconAfterAnimationsDone(); } return(PROPAGATION.DEFAULT); }