void Update() { // Find a partner. if (seekingPartner && partner == null) { GameObject[] potentials = GameObject.FindGameObjectsWithTag("Converser"); for (int i = 0; i < potentials.Length; i++) { if (potentials[i] != gameObject && (transform.position - potentials[i].transform.position).sqrMagnitude <= Mathf.Pow(converseDistance, 2)) { PartnerLink potentialPartner = potentials[i].GetComponent <PartnerLink>(); if (potentialPartner != null) { ConversationManger.Instance.StartConversation(this, potentialPartner); } } } } // Handle partners seperating. if (partner != null && seekingPartner) { // Show that partners are close to separating. float sqrDist = (transform.position - partner.transform.position).sqrMagnitude; if (sqrDist > Mathf.Pow(converseDistance * breakingThreshold, 2)) { ConversationManger.Instance.EndConversation(this, partner); if (partnerLine != null) { partnerLine.SetVertexCount(0); } } else if (sqrDist > Mathf.Pow(converseDistance * warningThreshold, 2)) { if (partnerLine != null) { partnerLine.SetWidth(partnerLineSize, partnerLineSize); partnerLineAlteredSize = partnerLineSize; partnerLine.SetVertexCount(2); partnerLine.SetPosition(0, transform.position); partnerLine.SetPosition(1, partner.transform.position); } } else { if (partnerLine != null) { partnerLineAlteredSize *= partnerLineShrink; partnerLine.SetWidth(partnerLineAlteredSize, partnerLineAlteredSize); partnerLine.SetVertexCount(2); partnerLine.SetPosition(0, transform.position); partnerLine.SetPosition(1, partner.transform.position); if (partnerLineAlteredSize / partnerLineSize < (1 - partnerLineShrink)) { partnerLine.SetVertexCount(0); } } } } }
// Use this for initialization void Awake() { if (partnerLink == null) { partnerLink = GetComponent <PartnerLink>(); } if (text == null) { text = GameObject.FindGameObjectWithTag("ConversationTitle").GetComponent <Text>(); } if (player == null && text != null) { Transform maybePlayer = text.transform; while (maybePlayer.tag != "Converser" && maybePlayer != transform.root) { maybePlayer = maybePlayer.parent; } if (maybePlayer.tag == "Converser") { player = maybePlayer.GetComponent <PartnerLink>(); } } if (text != null) { text.color = new Color(1f, 0f, 1f, 0); text.text = ""; } }
// Use this for initialization void Awake () { if (partnerLink == null) { partnerLink = GetComponent<PartnerLink>(); } if (text == null) { text = GameObject.FindGameObjectWithTag("ConversationTitle").GetComponent<Text>(); } if (player == null && text != null) { Transform maybePlayer = text.transform; while (maybePlayer.tag != "Converser" && maybePlayer != transform.root) { maybePlayer = maybePlayer.parent; } if (maybePlayer.tag == "Converser") { player = maybePlayer.GetComponent<PartnerLink>(); } } if (text != null) { text.color = new Color(1f, 0f, 1f, 0); text.text = ""; } }
public bool StartConversation(PartnerLink partner1, PartnerLink partner2) { // Find conversation and return false if not found or already in progress. Conversation startedConversation = FindConversation(partner1, partner2); if (startedConversation == null || startedConversation.inProgress) { return(false); } // Start conversation and setup parameters. startedConversation.inProgress = true; partner1.SetPartner(partner2); partner2.SetPartner(partner1); if (startedConversation.partner1Leads) { startedConversation.partner1.SetLeading(true); startedConversation.partner2.SetLeading(false); } else { startedConversation.partner1.SetLeading(false); startedConversation.partner2.SetLeading(true); } return(true); }
public bool StartConversation(PartnerLink partner1, PartnerLink partner2) { // Find conversation and return false if not found or already in progress. Conversation startedConversation = FindConversation(partner1, partner2); if (startedConversation == null || startedConversation.inProgress) { return false; } // Start conversation and setup parameters. startedConversation.inProgress = true; partner1.SetPartner(partner2); partner2.SetPartner(partner1); if (startedConversation.partner1Leads) { startedConversation.partner1.SetLeading(true); startedConversation.partner2.SetLeading(false); } else { startedConversation.partner1.SetLeading(false); startedConversation.partner2.SetLeading(true); } startedConversation.initiateDistance = Mathf.Min(partner1.converseDistance, partner2.converseDistance); startedConversation.warningDistance = Mathf.Min(partner1.converseDistance * partner1.warningThreshold, partner2.converseDistance * partner2.warningThreshold); startedConversation.breakingDistance = Mathf.Min(partner1.converseDistance * partner1.breakingThreshold, partner2.converseDistance * partner2.breakingThreshold); return true; }
void OnTriggerEnter(Collider collide) { if (collide.gameObject.tag == "Converser" && collide.gameObject != creator) { PartnerLink creatorLink = creator.GetComponent <PartnerLink>(); PartnerLink colliderLink = collide.gameObject.GetComponent <PartnerLink>(); if (creatorLink != null && colliderLink != null && creatorLink.Partner == colliderLink) { if (isHitOnce == false && isHit == false) { setHitOnce(); waiting = true; Invoke("setWaiting", 1.0f); } if (isHitOnce == true && waiting == false) { setHitOn(); } if (isHit == true) { setHitOn(); } if (allDone == false) { audio.Play(); } } } }
public bool StartConversation(PartnerLink partner1, PartnerLink partner2) { // Find conversation and return false if not found or already in progress. Conversation startedConversation = FindConversation(partner1, partner2); if (startedConversation == null || startedConversation.inProgress) { return false; } // Start conversation and setup parameters. startedConversation.inProgress = true; partner1.SetPartner(partner2); partner2.SetPartner(partner1); if (startedConversation.partner1Leads) { startedConversation.partner1.SetLeading(true); startedConversation.partner2.SetLeading(false); } else { startedConversation.partner1.SetLeading(false); startedConversation.partner2.SetLeading(true); } return true; }
public bool StartConversation(PartnerLink partner1, PartnerLink partner2) { // Find conversation and return false if not found or already in progress. Conversation startedConversation = FindConversation(partner1, partner2); if (startedConversation == null || startedConversation.inProgress) { return(false); } // Start conversation and setup parameters. startedConversation.inProgress = true; partner1.SetPartner(partner2); partner2.SetPartner(partner1); if (startedConversation.partner1Leads) { startedConversation.partner1.SetLeading(true); startedConversation.partner2.SetLeading(false); } else { startedConversation.partner1.SetLeading(false); startedConversation.partner2.SetLeading(true); } startedConversation.initiateDistance = Mathf.Min(partner1.converseDistance, partner2.converseDistance); startedConversation.warningDistance = Mathf.Min(partner1.converseDistance * partner1.warningThreshold, partner2.converseDistance * partner2.warningThreshold); startedConversation.breakingDistance = Mathf.Min(partner1.converseDistance * partner1.breakingThreshold, partner2.converseDistance * partner2.breakingThreshold); return(true); }
public bool ShouldYield(PartnerLink leader) { Vector3 toLeader = leader.transform.position - transform.position; bool far = toLeader.sqrMagnitude >= Mathf.Pow(leader.startYieldProximity + endYieldProximity, 2); bool behind = Vector3.Dot(toLeader, leader.mover.velocity) >= 0; return(!far || !behind); }
public Conversation FindConversation(PartnerLink partner1, PartnerLink partner2) { Conversation foundConversation = null; for (int i = 0; i < conversations.Count && foundConversation == null; i++) { if ((conversations[i].partner1 == partner1 && conversations[i].partner2 == partner2) || (conversations[i].partner1 == partner2 && conversations[i].partner2 == partner1)) { foundConversation = conversations[i]; } } return foundConversation; }
// Update is called once per frame void Update() { renderer.material.color = new Color(renderer.material.color.r, renderer.material.color.g, renderer.material.color.b, myAlpha); if (fading == true) { if (myAlpha >= 0) { myAlpha -= Time.deltaTime * fadeConst; } } if (bright == true) { if (myAlpha <= 1) { myAlpha += Time.deltaTime * fadeConst; } } transform.Rotate(rotVect * rotSpeed * Time.deltaTime); if (lilPoint1.GetComponent <LongDetail>().isHit&& lilPoint2.GetComponent <LongDetail>().isHit&& lilPoint3.GetComponent <LongDetail>().isHit&& lilPoint4.GetComponent <LongDetail>().isHit&& lilPoint5.GetComponent <LongDetail>().isHit&& lilPoint6.GetComponent <LongDetail>().isHit&& lilPoint7.GetComponent <LongDetail>().isHit&& lilPoint8.GetComponent <LongDetail>().isHit) { renderer.material.color = Color.yellow; //print("Good Point"); pointMade = true; rotSpeed = 200.0f; if (rotSpeed > 50.0f) { rotSpeed -= Time.deltaTime * timeConst; } audio.PlayOneShot(Gong); //rotVect.y = 2; BroadcastMessage("IsHitOff"); PartnerLink creatorLink = creator.GetComponent <PartnerLink>(); creatorLink.seekingPartner = false; LevelManager levelManager = GameObject.FindGameObjectWithTag("Globals").GetComponent <LevelManager>(); if (levelManager != null) { levelManager.LevelEvent(); } ConversationManager.Instance.EndConversation(creatorLink, creatorLink.Partner); } if (pointMade == true) { BroadcastMessage("TurnOff"); } }
public Conversation FindConversation(PartnerLink partner1, PartnerLink partner2) { Conversation foundConversation = null; for (int i = 0; i < conversations.Count && foundConversation == null; i++) { if ((conversations[i].partner1 == partner1 && conversations[i].partner2 == partner2) || (conversations[i].partner1 == partner2 && conversations[i].partner2 == partner1)) { foundConversation = conversations[i]; } } return(foundConversation); }
void Start() { if (mover == null) { mover = GetComponent<SimpleMover>(); } if (partnerLink == null) { partnerLink = GetComponent<PartnerLink>(); } if (tracer == null) { tracer = GetComponent<Tracer>(); } if (waypointContainer != null) { Waypoint[] waypointObjects = waypointContainer.GetComponentsInChildren<Waypoint>(); int startIndex = -1; for (int i = 0; i < waypointObjects.Length && startIndex < 0; i++) { if (waypointObjects[i].isStart) { startIndex = i; } } if (startIndex >= 0) { waypoints = new List<Waypoint>(); while (waypoints.Count < waypointObjects.Length) { if (startIndex > 0 && startIndex + waypoints.Count >= waypointObjects.Length) { startIndex = 0; } waypoints.Add(waypointObjects[startIndex + waypoints.Count]); } } } SeekNextWaypoint(); if (previous >= 0 && previous < waypoints.Count) { transform.position = waypoints[previous].transform.position; } for (int i = 0; i < waypoints.Count; i++) { waypoints[i].renderer.enabled = showWaypoints; } }
void Start() { if (mover == null) { mover = GetComponent <SimpleMover>(); } if (partnerLink == null) { partnerLink = GetComponent <PartnerLink>(); } if (tracer == null) { tracer = GetComponent <Tracer>(); } if (waypointContainer != null) { Waypoint[] waypointObjects = waypointContainer.GetComponentsInChildren <Waypoint>(); int startIndex = -1; for (int i = 0; i < waypointObjects.Length && startIndex < 0; i++) { if (waypointObjects[i].isStart) { startIndex = i; } } if (startIndex >= 0) { waypoints = new List <Waypoint>(); while (waypoints.Count < waypointObjects.Length) { if (startIndex > 0 && startIndex + waypoints.Count >= waypointObjects.Length) { startIndex = 0; } waypoints.Add(waypointObjects[startIndex + waypoints.Count]); } } } SeekNextWaypoint(); if (previous >= 0 && previous < waypoints.Count) { transform.position = waypoints[previous].transform.position; } for (int i = 0; i < waypoints.Count; i++) { waypoints[i].renderer.enabled = showWaypoints; } }
void Start() { if (mover == null) { mover = GetComponent <SimpleMover>(); } if (mover != null) { startMaxSpeed = mover.maxSpeed; } if (partnerLink == null) { partnerLink = GetComponent <PartnerLink>(); } }
void Start() { if (mover == null) { mover = GetComponent<SimpleMover>(); } if (mover != null) { startMaxSpeed = mover.maxSpeed; } if (partnerLink == null) { partnerLink = GetComponent<PartnerLink>(); } }
public void SetPartner(PartnerLink partner) { this.partner = partner; if (partner != null) { conversation = ConversationManger.Instance.FindConversation(this, partner); SendMessage("LinkPartner", SendMessageOptions.DontRequireReceiver); } else { conversation = null; SendMessage("UnlinkPartner", SendMessageOptions.DontRequireReceiver); } }
void Start() { if (mover == null) { mover = GetComponent <SimpleMover>(); } if (partnerLink == null) { partnerLink = GetComponent <PartnerLink>(); } if (tracer == null) { tracer = GetComponent <Tracer>(); } startSpeed = mover.maxSpeed; }
void Start() { if (mover == null) { mover = GetComponent<SimpleMover>(); } if (partnerLink == null) { partnerLink = GetComponent<PartnerLink>(); } if (tracer == null) { tracer = GetComponent<Tracer>(); } startSpeed = mover.maxSpeed; }
public bool EndConversation(PartnerLink partner1, PartnerLink partner2) { // Find conversation and return false if not found or not in progress. Conversation endedConversation = FindConversation(partner1, partner2); if (endedConversation == null || !endedConversation.inProgress) { return false; } endedConversation.inProgress = false; endedConversation.partner1.SetPartner(null); endedConversation.partner1.SetLeading(false); endedConversation.partner2.SetPartner(null); endedConversation.partner2.SetLeading(false); return true; }
public bool EndConversation(PartnerLink partner1, PartnerLink partner2) { // Find conversation and return false if not found or not in progress. Conversation endedConversation = FindConversation(partner1, partner2); if (endedConversation == null || !endedConversation.inProgress) { return(false); } endedConversation.inProgress = false; endedConversation.partner1.SetPartner(null); endedConversation.partner1.SetLeading(false); endedConversation.partner2.SetPartner(null); endedConversation.partner2.SetLeading(false); return(true); }
public Conversation[] FindConversations(PartnerLink participant) { List <Conversation> foundConversations = new List <Conversation>(); for (int i = 0; i < conversations.Count; i++) { if (conversations[i].partner1 == participant || conversations[i].partner2 == participant) { foundConversations.Add(conversations[i]); } } Conversation[] conversationArray = new Conversation[foundConversations.Count]; for (int i = 0; i < foundConversations.Count; i++) { conversationArray[i] = foundConversations[i]; } return(conversationArray); }
protected virtual void Start() { if (mover == null) { mover = GetComponent<SimpleMover>(); } if (tracer == null) { tracer = GetComponent<Tracer>(); } if (partnerLink == null) { partnerLink = GetComponent<PartnerLink>(); } if (tail != null) { tailTrigger = tail.trigger; } }
void OnTriggerEnter(Collider collide) { if (collide.gameObject.tag == "Converser" && collide.gameObject != creator) { PartnerLink creatorLink = creator.GetComponent <PartnerLink>(); PartnerLink colliderLink = collide.gameObject.GetComponent <PartnerLink>(); if (creatorLink != null && colliderLink != null && creatorLink.Partner == colliderLink) { setHitOn(); if (allDone == false) { audio.Play(); } Invoke("setHitOff", 10.0f); } } }
protected virtual void Start() { if (mover == null) { mover = GetComponent <SimpleMover>(); } if (tracer == null) { tracer = GetComponent <Tracer>(); } if (partnerLink == null) { partnerLink = GetComponent <PartnerLink>(); } if (tail != null) { tailTrigger = tail.trigger; } }
void Start() { if (mover == null) { mover = GetComponent<SimpleMover>(); } if (partnerLink == null) { partnerLink = GetComponent<PartnerLink>(); } if (tracer == null) { tracer = GetComponent<Tracer>(); } if (conversingSpeed == null) { conversingSpeed = GetComponent<ConversingSpeed>(); } startSpeed = mover.maxSpeed; headFill.transform.localScale = Vector3.zero; }
void Start() { if (mover == null) { mover = GetComponent <SimpleMover>(); } if (partnerLink == null) { partnerLink = GetComponent <PartnerLink>(); } if (tracer == null) { tracer = GetComponent <Tracer>(); } if (conversingSpeed == null) { conversingSpeed = GetComponent <ConversingSpeed>(); } startSpeed = mover.maxSpeed; headFill.transform.localScale = Vector3.zero; }
void OnTriggerEnter(Collider collide) { if (collide.gameObject.tag == "Converser" && collide.gameObject != creator) { PartnerLink creatorLink = creator.GetComponent <PartnerLink>(); PartnerLink colliderLink = collide.gameObject.GetComponent <PartnerLink>(); if (creatorLink != null && colliderLink != null && creatorLink.Partner == colliderLink) { isHit = true; renderer.material.color = Color.blue; if (isplayed == false) { audio.Play(); } isplayed = true; //collide.gameObject.BroadcastMessage("UnderstandPoint", informationFactor); } } }
public void SetPartner(PartnerLink partner) { this.partner = partner; if (partner != null) { linkBroken = false; timerTime = 5; conversation = ConversationManager.Instance.FindConversation(this, partner); SendMessage("LinkPartner", SendMessageOptions.DontRequireReceiver); // Makes Alpha of All Objects in PointsGroup 1 if (pointsGlobal != null) { pointsGlobal.SendMessage("PointsBright", SendMessageOptions.DontRequireReceiver); } } else { linkBroken = true; conversation = null; SendMessage("UnlinkPartner", SendMessageOptions.DontRequireReceiver); } }
public bool ShouldYield(PartnerLink leader) { Vector3 toLeader = leader.transform.position - transform.position; bool far = toLeader.sqrMagnitude >= Mathf.Pow(leader.startYieldProximity + endYieldProximity, 2); bool behind = Vector3.Dot(toLeader, leader.mover.velocity) >= 0; return !far || !behind; }
// Use this for initialization void Start() { partnerlink = GetComponent <PartnerLink>(); seeker = GetComponent <SimpleSeek>(); }
// Use this for initialization void Start () { partnerLink = GetComponent<PartnerLink>(); seeker = GetComponent<WaypointSeek>(); }
public Conversation[] FindConversations(PartnerLink participant) { List<Conversation> foundConversations = new List<Conversation>(); for (int i = 0; i < conversations.Count; i++) { if (conversations[i].partner1 == participant || conversations[i].partner2 == participant) { foundConversations.Add(conversations[i]); } } Conversation[] conversationArray = new Conversation[foundConversations.Count]; for (int i = 0; i < foundConversations.Count; i++) { conversationArray[i] = foundConversations[i]; } return conversationArray; }
// Use this for initialization void Start() { partnerLink = GetComponent <PartnerLink>(); seeker = GetComponent <WaypointSeek>(); }
// Use this for initialization void Start () { partnerlink = GetComponent<PartnerLink>(); seeker = GetComponent<SimpleSeek>(); }