Exemplo n.º 1
0
    //enters astral form when in prisoner
    public IEnumerator enterAstral()
    {
        canSwap = false;
        //Prisoner to Julia
        Vector3         juliaNewPosition = currentlyPossessing.transform.position;
        CapsuleCollider prisonerCapsule = currentlyPossessing.GetComponent <CapsuleCollider>();
        Vector3         capsuleStart = currentlyPossessing.transform.position, capsuleEnd = Vector3.zero;

        capsuleStart.y += prisonerCapsule.height;
        capsuleEnd      = capsuleStart;
        capsuleEnd.y   -= prisonerCapsule.height;

        //make sure to spawn julia in a place where there is no collisions
        if (!Physics.CapsuleCast(capsuleStart, capsuleEnd, prisonerCapsule.radius / 1.5f, currentlyPossessing.transform.forward, 1))
        {
            juliaNewPosition += currentlyPossessing.transform.forward;
            Debug.Log("forward");
        }
        else if (!Physics.CapsuleCast(capsuleStart, capsuleEnd, prisonerCapsule.radius / 1.5f, currentlyPossessing.transform.forward * -1, 1))
        {
            juliaNewPosition += (currentlyPossessing.transform.forward * -1);
            Debug.Log("back");
        }
        else if (!Physics.CapsuleCast(capsuleStart, capsuleEnd, prisonerCapsule.radius / 1.5f, currentlyPossessing.transform.right, 1))
        {
            juliaNewPosition += currentlyPossessing.transform.right;
            Debug.Log("right");
        }
        else if (!Physics.CapsuleCast(capsuleStart, capsuleEnd, prisonerCapsule.radius / 1.5f, currentlyPossessing.transform.right * -1, 1))
        {
            juliaNewPosition += (currentlyPossessing.transform.right * -1);
            Debug.Log("left");
        }
        //make him her a little higher so she doesnt fall through the floor
        juliaNewPosition.y += 1;
        yield return(new WaitForSeconds(transitionP(currentlyPossessing, false)));

        prisonerCamera.gameObject.SetActive(false);
        Julia.gameObject.SetActive(true);
        Julia.transform.position = juliaNewPosition;
        yield return(new WaitForSeconds(transitionJ(true)));

        Julia.startControlling();
        canSwap = true;
    }
Exemplo n.º 2
0
 private void sendEscapeCall()
 {
     prisoner.GetComponent <Prisoner>().escape = true;
 }