//----------------------------------------------------------------------------------------------------------------------------------------------- private void OnTriggerEnter(Collider other) { if (other.gameObject.CompareTag("Player")) { other.gameObject.transform.position = transform.GetChild(0).gameObject.transform.position; //TODO ESTO HABRÍA QUE QUITARLO MAS ADELANTE, ES UN APAÑO PARA PODER DECIDIR SI EL PORTAL LLEVA A INGAME (DESDE EL FILE SELECTOR), ES PROVISIONAL if (sendsIngame) { gameStateDataScriptRef.SetSceneState(GameStateScript.SceneState.INGAME); } //----------------------------------------------------------------------------------------------------------------------------------------------- } }
void FixedUpdate() { if (gameStateDataScriptRef.GetSceneState() == GameStateScript.SceneState.INGAME) //This update section only works if we're INGAME: { //print(input.getInput("Pause")); //Pause input: if (input.getInput("Pause") != 0) { gameStateDataScriptRef.PauseGame(!gameStateDataScriptRef.gamePaused); gameStateDataScriptRef.SetSceneState(GameStateScript.SceneState.OPTIONS); } pressedBaseInteraction = input.isPressed("BaseInteraction"); /// PASSIVE INTERACTION (Sphere Light) Collider[] hitColliders = Physics.OverlapSphere(CylindricLight.transform.position, GetComponent <PlayerLight>().lightSphere.range - 3); //(Sphere center, Radius) int tmp = 0; for (int i = 0; i < hitColliders.Length; i++) { if (hitColliders[i].isTrigger) { if (hitColliders[i].gameObject.CompareTag("PlayerLight")) { continue; } switch (hitColliders[i].gameObject.tag) { case "LightOrb": if (input.isPressed("LightMax")) { hitColliders[i].GetComponent <LightOrb>().ChargeOrb(Color.white, amount); //Attempt to charge the light orb if we are expanding the player light sphere radius (Default white from player white ray) } else if (input.isPressed("BaseInteraction")) { hitColliders[i].GetComponent <LightOrb>().SubtractFromOrb(); //Attempt to subtract energy from the light orb if we press Q } break; case "BlackInsect": BlackInsect(hitColliders[i]); break; case "Mirror": //if (pressedBaseInteraction != 0 && prevBaseInteraction == 0) { FindObjectOfType<CameraScript>().setFocus(hitColliders[i].gameObject); } //if (pressedBaseInteraction && !prevBaseInteraction) { hitColliders[i].GetComponentInParent<MirrorRotateController>().Toggle(); } break; case "OpticalFiber": // Make closest node work (switching reverse or not): hitColliders[i].GetComponentInParent <OpticalFiber>().SetClosestNode(transform); // Charge optical fiber: if (input.isPressed("LightMax")) { hitColliders[i].GetComponent <OpticalFiber_Node>().AddCharge(amount); } //else if (input.isPressed("BaseInteraction")) hitColliders[i].GetComponentInParent<OpticalFiber>().StartPlayerMode(transform); break; default: break; } tmp++; } } prevBaseInteraction = pressedBaseInteraction; } /* * else if (gameStateDataScriptRef.GetSceneState() == GameStateScript.SceneState.FILESELECT) //This update section only works if we're in FILESELECT: * { ++timer; * * if (input.getInput("Horizontal") != 0 && timer > selectDelay) * { * highlightedFile[0] = !highlightedFile[0]; * timer = 0; * } * else if (input.getInput("Vertical") != 0 && timer > selectDelay) * { * highlightedFile[1] = !highlightedFile[1]; * timer = 0; * } * * boatOutlinesOff(); * * //FILE SELECTOR: * if (highlightedFile[0] == false && highlightedFile[1] == false) * { * highlightedFilenum = 1; * FileSelectorBoat1.GetComponentInChildren<cakeslice.Outline>().enabled = true; * } * else if (highlightedFile[0] == true && highlightedFile[1] == false) * { * highlightedFilenum = 2; * FileSelectorBoat2.GetComponentInChildren<cakeslice.Outline>().enabled = true; * } * else if (highlightedFile[0] == false && highlightedFile[1] == true) * { * highlightedFilenum = 3; * FileSelectorBoat3.GetComponentInChildren<cakeslice.Outline>().enabled = true; * } * if (highlightedFile[0] == true && highlightedFile[1] == true) * { * highlightedFilenum = 4; * FileSelectorBoat4.GetComponentInChildren<cakeslice.Outline>().enabled = true; * } * * //INSERT LOAD SELECTED FILE HERE: * if (input.getInput("Submit") != 0) * { * //Provisional stuff for now: * boatOutlinesOff(); * gameStateDataScriptRef.SetSceneState(GameStateScript.SceneState.INGAME); * * transform.position = BaseWorldSpawnRef.transform.position; * } * }*/ }