public override void Interaction(ObjectInteractionController oicCaller, Collider other) { if (other.tag == Tags.player) { SplinePlayerCharacterController otherPcc = other.transform.GetComponent <SplinePlayerCharacterController>(); bool isHidden = otherPcc.currPlayerStatus[PlayerCharacterController.StatusListElement.HIDDEN]; if (!isHidden) { otherPcc.ChangeStatus(PlayerCharacterController.StatusListElement.ROOTED, true); otherPcc.ChangeStatus(PlayerCharacterController.StatusListElement.HIDDEN, true); //TpPlayerOut(hidePosition.position, otherPcc.transform.rotation, otherPcc); SoundManager.GetAudio(audioTPID).Play(); GameObject.Instantiate(Resources.Load("Prefabs/TPCloud"), pcc.transform.position, pcc.transform.rotation); otherPcc.transform.SetPositionAndRotation(hidePosition.position, otherPcc.transform.rotation); } else { otherPcc.ChangeStatus(PlayerCharacterController.StatusListElement.HIDDEN, false); otherPcc.ChangeStatus(PlayerCharacterController.StatusListElement.ROOTED, false); otherPcc.progress = otherPcc.lSpline.GetNearestProgressOnSpline(this.transform.position); //TpPlayerOut(otherPcc.lSpline.GetNearestPointOnSpline(this.transform.position), otherPcc.transform.rotation, otherPcc); SoundManager.GetAudio(audioTPID).Play(); GameObject.Instantiate(Resources.Load("Prefabs/TPCloud"), pcc.transform.position, pcc.transform.rotation); otherPcc.Move(otherPcc.transform.forward); } } }
private void FixedUpdate() { pic_charContr.Move(MovementDirectionCalc()); if (Input.GetButtonDown("Hide")) { pic_charContr.DoAction(SplinePlayerCharacterController.ActionListElement.HIDE); } else if (Input.GetButtonDown("Interact")) { pic_charContr.DoAction(SplinePlayerCharacterController.ActionListElement.INTERACT); } else if (Input.GetButtonDown("Dash")) { pic_charContr.DoAction(SplinePlayerCharacterController.ActionListElement.DASH); } else if (Input.GetButtonDown("Use")) { pic_charContr.DoAction(SplinePlayerCharacterController.ActionListElement.USE); } }
public override void Interaction(ObjectInteractionController oicCaller, Collider other) { if (other.tag == Tags.player) { SplinePlayerCharacterController otherPcc = other.transform.GetComponent <SplinePlayerCharacterController>(); bool isHidden = otherPcc.currPlayerStatus[PlayerCharacterController.StatusListElement.HIDDEN]; if (!isHidden) { otherPcc.ChangeStatus(PlayerCharacterController.StatusListElement.BEHINDPOT, true); otherPcc.ChangeStatus(PlayerCharacterController.StatusListElement.HIDDEN, true); deskProgress = deskSpline.GetNearestProgressOnSpline(otherPcc.transform.position); //otherPcc.transform.SetPositionAndRotation(deskSpline.GetNearestPointOnSpline(otherPcc.transform.position), // Quaternion.Euler(deskSpline.transform.TransformVector(deskSpline.GetDirection(deskProgress).normalized))); SoundManager.GetAudio(audioTPID).Play(); GameObject.Instantiate(Resources.Load("Prefabs/TPCloud"), pcc.transform.position, pcc.transform.rotation); float dotMagnitude = Vector3.Dot(otherPcc.transform.forward, Camera.main.transform.right); //Debug.Log("dotMagnitude:" + dotMagnitude); otherPcc.transform.SetPositionAndRotation(deskSpline.GetNearestPointOnSpline(otherPcc.transform.position), Quaternion.LookRotation(dotMagnitude * deskSpline.transform.TransformVector(deskSpline.GetDirection(deskProgress).normalized), Vector3.up)); } else { otherPcc.ChangeStatus(PlayerCharacterController.StatusListElement.HIDDEN, false); otherPcc.ChangeStatus(PlayerCharacterController.StatusListElement.BEHINDPOT, false); otherPcc.progress = otherPcc.lSpline.GetNearestProgressOnSpline(otherPcc.transform.position); SoundManager.GetAudio(audioTPID).Play(); GameObject.Instantiate(Resources.Load("Prefabs/TPCloud"), pcc.transform.position, pcc.transform.rotation); otherPcc.Move(otherPcc.transform.forward); } } }