//swaps to the specified prisoner public IEnumerator swap(Prisoner curPrisoner) { //Julia to prisoner if (astralForm && (currentlyPossessing == null)) { canSwap = false; Vector3 turnDirection = curPrisoner.gameObject.transform.position - Julia.gameObject.transform.position; turnDirection.Normalize(); Julia.stopControlling(); yield return(StartCoroutine(HOTween.To(Julia.gameObject.transform, turnSpeed, "rotation", Quaternion.LookRotation(turnDirection)).WaitForCompletion())); //Fly from current position to prisoner Vector3 endFlyPos = new Vector3(curPrisoner.gameObject.transform.position.x, (curPrisoner.gameObject.transform.position.y + 1f), curPrisoner.gameObject.transform.position.z); yield return(StartCoroutine(HOTween.To(Julia.gameObject.transform, flyThroughSpeed, "position", endFlyPos).WaitForCompletion())); //wait for julia out animation to finish yield return(new WaitForSeconds(transitionJ(false))); Julia.gameObject.SetActive(false); //wait for prisoner in animation to finish yield return(new WaitForSeconds(transitionP(curPrisoner, true))); //pan the camera out from pivot StartCoroutine(panFromHead(curPrisoner)); //Prisoner to Prisoner } else if (!astralForm && (currentlyPossessing != null)) { canSwap = false; Julia.gameObject.transform.position = currentlyPossessing.transform.position; Vector3 turnDirection = curPrisoner.gameObject.transform.position - currentlyPossessing.gameObject.transform.position; turnDirection.Normalize(); Julia.transform.GetComponent <SimpleMouseRotator>().enabled = false; //wait for prisoner out animation to finish yield return(new WaitForSeconds(transitionP(currentlyPossessing, false))); //Fly from prisoner to prisoner, prisonerCamera.gameObject.SetActive(false); Julia.gameObject.SetActive(true); transitionJ(true); yield return(StartCoroutine(HOTween.To(Julia.gameObject.transform, turnSpeed, "rotation", Quaternion.LookRotation(turnDirection)).WaitForCompletion())); Vector3 endFlyPos = new Vector3(curPrisoner.gameObject.transform.position.x, (curPrisoner.gameObject.transform.position.y + 1f), curPrisoner.gameObject.transform.position.z); yield return(StartCoroutine(HOTween.To(Julia.gameObject.transform, flyThroughSpeed, "position", endFlyPos).WaitForCompletion())); prisonerCamera.gameObject.SetActive(true); transitionJ(false); Julia.gameObject.SetActive(false); //wait for in animation to finish yield return(new WaitForSeconds(transitionP(curPrisoner, true))); //pan the camera out from pivot StartCoroutine(panFromHead(curPrisoner)); } }
private IEnumerator astralUp() { Vector3 up = julia.gameObject.transform.position; up.y += 1.5f; yield return(StartCoroutine(HOTween.To(julia.gameObject.transform, 0.5f, new TweenParms().Prop("position", up).Ease(EaseType.EaseOutQuad)).WaitForCompletion())); curPosIndex = 0; julia.stopControlling(); selectPris2Poss(possMaster.getInventory()[0]); }