private void SetTalkingState() { float myScreenSector = vizTrack.getCurrentScreenSector().x; float sectors = gc.screenDivisions; if (myScreenSector < edgeSectorCount || sectors - myScreenSector <= edgeSectorCount) { myTalkStatus = TalkingState.WILLING_TO_CONVERSE; } else { myTalkStatus = TalkingState.TALKING_AMONG_SELVES; } }
private void SetTalkingState() { if (state != State.WALKING_TO_THEATER) { float myScreenSector = vizTrack.getCurrentScreenSector().x; float sectors = gc.screenDivisions; if (myScreenSector < edgeSectorCount || sectors - myScreenSector <= edgeSectorCount) { state = State.WILLING_TO_CONVERSE; } else { state = State.SOLO_IGNORING_STAN; } } }
void Update() { if (Input.GetKeyDown("9")) { Debug.Log(DistanceToNearestTownie()); } if (!stanBehaviour.IsDesperate()) { if (shouldFollowCamera) { if (reachedDestination) { waitTimeElapsed = 0f; talkingToTownperson = false; //if (camCon.ObjectOnScreenWithTag(townieTag) && DistanceToNearestTownie() < talkingDistance) //{ // talkingToTownperson = true; // GameObject nearestTownie = NearestOnScreenTownie(); // if (nearestTownie.transform.position.x > transform.position.x) // { // //transform.Translate(movementSpeed * Time.deltaTime, 0f, 0f); // lookDirection = Direction.RIGHT; // } // else // { // //transform.Translate(-movementSpeed * Time.deltaTime, 0f, 0f); // lookDirection = Direction.LEFT; // } //} } else { talkingToTownperson = false; } if (!vizTrack.checkVisible()) { reachedDestination = false; waitTimeElapsed += Time.deltaTime; } else { townieOnScreen = camCon.ObjectOnScreenWithTag(townieTag); if (townieOnScreen) { Debug.Log("Can see townperson"); } currentScreenSector = vizTrack.getCurrentScreenSector(); if (Mathf.Abs(transform.position.x - cam.transform.position.x) < DistFromCenter) { reachedDestination = true; } else { reachedDestination = false; } } if (!reachedDestination && waitTimeElapsed > cameraFollowDelay) { if (cam.transform.position.x > transform.position.x) { transform.Translate(movementSpeed * Time.deltaTime, 0f, 0f); lookDirection = Direction.RIGHT; } else { transform.Translate(-movementSpeed * Time.deltaTime, 0f, 0f); lookDirection = Direction.LEFT; } } if (camCon.ObjectOnScreenWithTag(townieTag) && DistanceToNearestTownie() < talkingDistance) { talkingToTownperson = true; GameObject nearestTownie = NearestOnScreenTownie(); nearestTownie.transform.parent.gameObject.GetComponent <TownspersonController>().StartRisingConviction(); if (nearestTownie.transform.position.x > transform.position.x) { //transform.Translate(movementSpeed * Time.deltaTime, 0f, 0f); lookDirection = Direction.RIGHT; } else { //transform.Translate(-movementSpeed * Time.deltaTime, 0f, 0f); lookDirection = Direction.LEFT; } } else { GameObject nearestTownie = NearestOnScreenTownie(); if (nearestTownie) { nearestTownie.transform.parent.gameObject.GetComponent <TownspersonController>().StopRisingConviction(); } talkingToTownperson = false; } } } else if (stanBehaviour.IsDesperate()) { } }