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 LevelSetupChangeFLoor(ref ChangeFloorData gfc) { GameObject player = GameObject.FindGameObjectWithTag(Tags.player); SplinePlayerCharacterController spcc = player.GetComponent <SplinePlayerCharacterController>(); if (gd_currentLevel == null) { gd_currentLevel = SaveManager.LoadFile(saveName); } if (spcc.currPlayerObjectStatus[Dictionaries.ItemName.SCREWDRIVER] || gd_currentLevel.isScrewUnlocked || (gd_nextLevel != null && gd_nextLevel.isScrewUnlocked)) { spcc.currPlayerObjectStatus[Dictionaries.ItemName.SCREWDRIVER] = true; if (gd_currentLevel != null) { gd_currentLevel.isScrewUnlocked = true; SaveManager.Save(gd_currentLevel, saveName); } if (gd_nextLevel != null) { gd_nextLevel.isScrewUnlocked = true; } } SetUpSPCC(spcc, ref gd_currentLevel); if (gfc != null) { ChangeFloorInteractionController[] cficList = GameObject.FindObjectsOfType <ChangeFloorInteractionController>(); if (cficList.Length > 0) { ChangeFloorInteractionController correctCFIC = null; foreach (ChangeFloorInteractionController curCFIC in cficList) { if (curCFIC.floorDoorNum == gfc.floorDoorNum) { correctCFIC = curCFIC; } } if (correctCFIC != null) { PositionPlayer(correctCFIC.transform, spcc); SplineCameraController mCC = Camera.main.GetComponent <SplineCameraController>(); if (mCC != null) { mCC.currCameraPos = correctCFIC.nextCameraPosition; } spcc.ChangeStatus(PlayerCharacterController.StatusListElement.NINJA, gfc.isNinja); } else { Debug.LogError("Correct CFIC not Found"); } } } gfc = null; }
private void PrivModifiedMove(Vector3 direction, ObjectInteractionController oicCaller, Collider other) { SplinePlayerCharacterController otherPcc = other.transform.GetComponent <SplinePlayerCharacterController>(); float dotMagnitude = Vector3.Dot(plantSpline.transform.TransformVector(plantSpline.GetDirection(plantProgress).normalized), direction); if (!otherPcc.currPlayerStatus[PlayerCharacterController.StatusListElement.ROOTED]) { if (Math.Abs(dotMagnitude) > 0.05f) { // Lerp-Rotate the rigidbody toward the direction //Debug.Log(Time.timeSinceLevelLoad+" - SplineDir " + plantSpline.GetDirection(plantProgress).normalized // +"playerDir"+ direction); //plantProgress = plantSpline.GetLengthAtDistFromParametric(Math.Sign(dotMagnitude) * otherPcc.charSpeed * Time.deltaTime, plantProgress); //Vector3 newPosition = plantSpline.GetPoint(plantProgress); //Quaternion targetRotation = Quaternion.LookRotation(Math.Sign(dotMagnitude) * plantSpline.GetDirection(plantProgress).normalized, Vector3.up); //Quaternion newRotation = Quaternion.Lerp(otherPcc.pcc_rigidbody.rotation, targetRotation, otherPcc.turnSmooth); //transform.SetPositionAndRotation(newPosition, newRotation); //otherPcc.pcc_animator.SetFloat("Speed", 4.5f, otherPcc.speedDamptime, Time.deltaTime); plantProgress = plantSpline.GetLengthAtDistFromParametric(Math.Sign(dotMagnitude) * otherPcc.charSpeed * Time.deltaTime, plantProgress); Vector3 newPosition = plantSpline.GetPoint(plantProgress); Quaternion targetRotation = Quaternion.LookRotation(Math.Sign(dotMagnitude) * plantSpline.transform.TransformVector(plantSpline.GetDirection(plantProgress).normalized), Vector3.up); Quaternion newRotation = Quaternion.Lerp(otherPcc.pcc_rigidbody.rotation, targetRotation, otherPcc.turnSmooth); otherPcc.transform.SetPositionAndRotation(newPosition, newRotation); transform.position = otherPcc.transform.position + (this.transform.position - hidePosition.position); //otherPcc.pcc_animator.SetFloat("Speed", 5.7f, otherPcc.speedDamptime, Time.deltaTime); otherPcc.ChangeStatus(PlayerCharacterController.StatusListElement.HIDDEN, false); } else { otherPcc.pcc_animator.SetFloat("Speed", 0f, otherPcc.speedDamptime, Time.deltaTime); } } else { if (Math.Abs(dotMagnitude) > 0.05f) { otherPcc.transform.rotation = Quaternion.LookRotation(Math.Sign(dotMagnitude) * plantSpline.GetDirection(plantProgress).normalized, Vector3.up); otherPcc.pcc_animator.SetFloat("Speed", 0f, otherPcc.speedDamptime, Time.deltaTime); } } }
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); } } }
public override void Interaction(ObjectInteractionController oicCaller, Collider other) { if (other.tag == Tags.player) { SplinePlayerCharacterController otherPcc = other.transform.GetComponent <SplinePlayerCharacterController>(); bool isReading = otherPcc.currPlayerStatus[PlayerCharacterController.StatusListElement.READING]; if (isReading) { if (textMan.isPaused) { textMan.NextTextPart(); } else if (textMan.isFinished) { otherPcc.ChangeStatus(PlayerCharacterController.StatusListElement.READING, false); otherPcc.ChangeStatus(PlayerCharacterController.StatusListElement.ROOTED, false); textMan.textComp.text = ""; textMan.gameObject.SetActive(false); //textMan.transform.parent.gameObject.SetActive(false); } else { textMan.ForceText(); } } else { // Start reading otherPcc.ChangeStatus(PlayerCharacterController.StatusListElement.READING, true); otherPcc.ChangeStatus(PlayerCharacterController.StatusListElement.ROOTED, true); //textMan.textComp.text = text; textMan.gameObject.SetActive(true); //textMan.transform.parent.gameObject.SetActive(true); textMan.TypeText(text); } } }
protected override void ModifiedMove(Vector3 direction, ObjectInteractionController oicCaller, Collider other) { if (other.tag == Tags.player) { SplinePlayerCharacterController otherPcc = other.transform.GetComponent <SplinePlayerCharacterController>(); bool isBehindPot = otherPcc.currPlayerStatus[PlayerCharacterController.StatusListElement.BEHINDPOT]; if (isBehindPot) { otherPcc.ChangeStatus(PlayerCharacterController.StatusListElement.HIDDEN, true); PrivModifiedMove(direction, oicCaller, other); } else { otherPcc.ImplementedMove(direction); } } }
public void SetUpSPCC(SplinePlayerCharacterController spcc, ref GameData gdd) { spcc.currPlayerObjectStatus[Dictionaries.ItemName.SCREWDRIVER] = gdd.isScrewUnlocked; spcc.currPlayerObjectStatus[Dictionaries.ItemName.LAXATIVE] = gdd.isLaxaUnlocked; spcc.ChangeStatus(PlayerCharacterController.StatusListElement.NINJA, gdd.isNinja); }