public override void OnInspectorGUI() { DrawDefaultInspector(); dnp = target as DebugNearestPoint; SplineLine spline = dnp.spline; Vector3 position = dnp.transform.position; DrawDebug("Nearest Progress :", spline.GetNearestProgressOnSpline(position).ToString()); }
private void Awake() { this.isModifyingMove = true; SpawnButton(); //hidePosition.position = plantSpline.GetNearestPointOnSpline(this.transform.position) - this.transform.position; if (plantSpline != null) { plantProgress = plantSpline.GetNearestProgressOnSpline(this.transform.position); } else { Debug.Log("ERROR: NO Spline for plant :" + transform.position.ToString()); } }
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); } } }