//! Actions for when the State starts. // Set the Camera inside the state to be Active, overlaying the Main Camera used at InGameState, // close all dialogs that might be enabled. public override void OnStartRun() { //Opens inventory TODO: is it still going to be always open? GameObject.Find("InventoryManager").GetComponent <InventoryManager> ().changeList(0); cameraState.gameObject.SetActive(true); cameraState.depth = 2; Debug.Log("Starting LIA state"); //Set active the interaction canvas accordingly to the type of step switch (progressController.StepType) { case TypeOfStep.CompoundClass: checkCompoundClassCanvas.SetActive(true); checkCompoundClassCanvas.GetComponentInChildren <ToggleGroup>().SetAllTogglesOff(); break; case TypeOfStep.WhatCompound: whatCompoundAnswer.text = ""; GameObject.Find("GameController").GetComponent <HUDController> ().LockKeys(true); checkWhatCompoundCanvas.SetActive(true); break; case TypeOfStep.MolarityCheck: molarityAnswer.text = ""; GameObject.Find("GameController").GetComponent <HUDController> ().LockKeys(true); checkMolarityValueCanvas.SetActive(true); break; case TypeOfStep.GlasswareCheck: checkGlasswareCanvas.SetActive(true); break; } HudText.SetText(""); }
public void UpdateCookies() { if (cookies_text) { cookies_text.SetText("" + EconomyMan.Instance.Cookies); } }
//! Actions for when the State starts. /*! Set the Camera inside the state to be Active, overlaying the Main Camera used at InGameState, * close all dialogs that might be enabled. */ public override void OnStartRun() { cameraState.gameObject.SetActive(true); cameraState.depth = 2; HudText.SetText(""); GetComponentInParent <WorkBench>().OnStartRun(); }
public void UpdateDiamonds() { if (diamonds_text) { diamonds_text.SetText("" + EconomyMan.Instance.Diamonds); } }
//! Does the interaction. /*! Fades the camera and starts the equipment state. */ public override void Interact() { callInteract = true; HudText.SetText(""); GetComponent <BoxCollider>().enabled = false; Debug.Log("here start interact"); Interacting = true; }
//! Actions for when the State starts. /*! Set the Camera inside the state to be Active, overlaying the Main Camera used at InGameState, * close all dialogs that might be enabled. */ public override void OnStartRun() { //cameraState.enabled = true; //cameraState.GetComponent<AudioListener> ().enabled = true; //cameraState.depth = 2; HudText.SetText(""); returnPosition(); }
//! Is called when the collider other enters the trigger. /*! This message is sent to the trigger collider and the rigidbody * that the trigger collider belongs to, and the rigidbody that touches the trigger.*/ void OnTriggerEnter(Collider other) { Debug.Log(other.name); if (other.name == "Player" && allowGetData) { HudText.SetText("Aperte " + keyToUse.ToString() + " para pegar as folhas da impressora."); } }
//! Actions for when the State starts. /*! Set the Camera inside the state to be Active, overlaying the Main Camera used at InGameState, * does the animation to open the cupboard left door and enable the UI Canvas. */ public override void OnStartRun() { //GameObject.Find ("Journal").GetComponent<JournalController> ().checkJournalItem (0); cameraState.gameObject.SetActive(true); HudText.SetText(""); leftDoor.Open(); canvasUI.GetComponent <Canvas>().enabled = true; //UIScrollList.transform.parent.GetComponent<ScrollRect>().verticalScrollbar.value = 1; }
//! Actions for when the State starts. /*! Set the Camera inside the state to be Active, overlaying the Main Camera used at InGameState, * does the animation to open the cupboard left door and enable the UI Canvas. */ public override void OnStartRun() { cameraState.gameObject.SetActive(true); HudText.SetText(""); leftDoor.Open(); canvasUI.GetComponent <Canvas>().enabled = true; //UIScrollList.transform.parent.GetComponent<ScrollRect>().verticalScrollbar.value = 1; }
void OnTriggerEnter(Collider other) { if (other.tag == "Player") { allowChangeScene = true; if (isSolid) { HudText.SetText("Aperte " + keyToUse.ToString() + " para pegar " + solidName + "."); } else { HudText.SetText("Aperte " + keyToUse.ToString() + " para pegar " + objectName + "."); } } }
//! Message for interaction with the machine. /*! Is sent to the trigger collider and the rigidbody that the trigger collider belongs to, and to the rigidbody that touches the trigger.*/ void OnTriggerEnter(Collider other) { if (other.tag == "Player") { allowChangeScene = true; if (string.IsNullOrEmpty(machineName)) { HudText.SetText("Aperte " + keyToUse.ToString() + " para usar o aparelho."); } else { HudText.SetText("Aperte " + keyToUse.ToString() + " para usar " + machineName + "."); } } }
//! Does the interaction. /*! Fades the camera and starts the equipment state. */ public override void Interact() { callInteract = true; HudText.SetText(""); GetComponent <BoxCollider>().enabled = false; //arrumar a posição do player player.transform.position = newPosition; //Ativar o Timed Input do botão Action ActionButton.GetComponent <TimedInputObject>().enabled = true; phMeterButton.GetComponent <CanvasGroup>().alpha = 1f; canvasLigarMedir.GetComponent <CanvasGroup>().alpha = 0.5f; map.GetComponent <TimedInputObject>().enabled = false; exit.GetComponent <TimedInputObject>().enabled = false; exit.GetComponent <CanvasGroup>().alpha = 0f; gameControler.GetComponent <HUDController>().mapBlocked = true; dicaLocomotionCanvas.GetComponent <CanvasGroup>().alpha = 0f; dicaLocomotionCanvas.enabled = false; DisplayY.GetComponent <CanvasGroup>().alpha = 0f; setinha.gameObject.SetActive(true); LigarButton.enabled = true; MedirButton.enabled = true; Interacting = true; }
public void SetCookies(int _cookies) { cookies.SetText("" + _cookies); }
//! Setup of reagent liquid in all machines. public void Setup(string reagent, float concentration) { Compound realReagent = CompoundFactory.GetInstance().GetCupboardCompound(reagent) as Compound; if (realReagent == null) { Debug.LogWarning("Reagent not seted in database"); return; } allowShowFloat = false; allowShowTexture = false; bool showFloat = false; switch (myType) { default: { setupFloat = 0f; setupTexture = null; allowShowFloat = false; allowShowTexture = false; } break; case MACHINES.CONDUTIVIMETER: { setupFloat = realReagent.Conductibility; showFloat = true; InventoryController inventory = FindObjectOfType(typeof(InventoryController)) as InventoryController; } break; case MACHINES.SPCTROPHOTOMETER_UV: { setupTexture = realReagent.uvSpecter; allowShowTexture = true; InventoryController inventory = FindObjectOfType(typeof(InventoryController)) as InventoryController; } break; case MACHINES.SPCTROPHOTOMETER_IR: { setupTexture = realReagent.irSpecter; allowShowTexture = true; InventoryController inventory = FindObjectOfType(typeof(InventoryController)) as InventoryController; } break; case MACHINES.TURBIDOMETER: { setupFloat = realReagent.Turbidity; showFloat = true; InventoryController inventory = FindObjectOfType(typeof(InventoryController)) as InventoryController; } break; } if (showFloat) { resultFloat *= concentration; string errorStringForm = "0"; if (errorPrecision > 0) { errorStringForm = "0."; for (int i = 0; i < errorPrecision; i++) { errorStringForm += "0"; } } textResult.text = applyErrorInFloat(resultFloat).ToString(errorStringForm); } if (allowShowTexture) { setupTexture = ChartGenerator.GenerateWithTextureConectingDots(setupTexture, concentration, 0.8f); HudText.SetText("O grafico foi Impresso!"); GameObject.FindObjectOfType <PrinterUse>().SendFileToPrinter(setupTexture); timeToShowPrintTextAcc = Time.time; } }
void Update() { if (inInteraction) { motor.movement.velocity = Vector3.zero; transform.position = lastPosition; currentDelay += Time.deltaTime; if (currentDelay > delayInteract) { currentDelay = 0; inInteraction = false; } return; } // Get the input vector from kayboard or analog stick Vector3 directionVector = new Vector3(Input.GetAxis("Horizontal"), 0, Input.GetAxis("Vertical")); if (directionVector != Vector3.zero) { // Get the length of the directon vector and then normalize it // Dividing by the length is cheaper than normalizing when we already have the length anyway float directionLength = directionVector.magnitude; directionVector = directionVector / directionLength; // Make sure the length is no bigger than 1 directionLength = Mathf.Min(1.0f, directionLength); // Make the input vector more sensitive towards the extremes and less sensitive in the middle // This makes it easier to control slow speeds when using analog sticks directionLength = directionLength * directionLength; // Multiply the normalized direction vector by the modified length directionVector = directionVector * directionLength; } // Apply the direction to the CharacterMotor if (!keysLocked) { motor.inputMoveDirection = transform.rotation * directionVector; //motor.inputJump = Input.GetButton ("Jump"); } // Implements Raycast to get which object is being Hit and how to interact with it. Ray cameraRay = Camera.main.ScreenPointToRay(new Vector3(Screen.width / 2, Screen.height / 2, Mathf.Infinity)); RaycastHit hitInfo; if (Physics.Raycast(cameraRay, out hitInfo, Mathf.Infinity)) { bool nameReset = false; if (hitInfo.collider.GetComponent <AccessEquipmentBehaviour> ()) { if (hitInfo.collider.gameObject.Equals(lastHit.collider.gameObject)) { nameReset = true; hitInfo.collider.GetComponent <AccessEquipmentBehaviour> ().SetTrigger(true); HudText.SetText(hitInfo.collider.GetComponent <AccessEquipmentBehaviour> ().equipName); if (hitInfo.distance > 3) { hitInfo.collider.GetComponent <AccessEquipmentBehaviour> ().setCanvasAlpha(1f); } else { hitInfo.collider.GetComponent <AccessEquipmentBehaviour> ().setCanvasAlpha(0.5f * hitInfo.distance - 0.5f); } } else if (lastHit.collider.GetComponent <AccessEquipmentBehaviour> () != null) { lastHit.collider.GetComponent <AccessEquipmentBehaviour> ().SetTrigger(false); } } else if (lastHit.collider.GetComponent <AccessEquipmentBehaviour> () != null) { lastHit.collider.GetComponent <AccessEquipmentBehaviour> ().SetTrigger(false); } if (hitInfo.collider.GetComponent <InteractObjectBase> () && hitInfo.distance <= distanceToInteract) { if (Input.GetKeyDown(KeyCode.E)) { hitInfo.collider.GetComponent <InteractObjectBase> ().Interact(); if (!hitInfo.collider.GetComponent <AccessEquipmentBehaviour> ()) { gameObject.GetComponent <PlayerAnimation> ().PlayInteractAnimation(); } inInteraction = true; lastPosition = transform.position; } HudText.SetText(interactText); } else { if (!nameReset) { HudText.EraseText(); } } //show information about the object lastHit = hitInfo; } //State Machine for the different uses of input //HUD components: /*if (Input.GetKeyDown (KeyCode.Escape)) { * hudController.menu.Pause (); * } * if(Input.GetKeyDown(hudController.journalKey)&&!hudController.lockKey){ * hudController.CallTabletTrigger(); * } * if ((Input.GetKeyDown (hudController.inventoryKey))&&!hudController.lockKey) { * hudController.CallInventoryTrigger(); * } * if((Input.GetKeyDown(hudController.mapKey))&&!hudController.lockKey){ * hudController.CallMapTrigger(); * } * * //End of states * if (gameController.GetCurrentState () == gameController.gameStates [0]) { * * }*/ }
public override void OnEnter() { bestScoreText.SetText("" + DataMan.Instance.userData.BestScore); scoreText.SetText("" + DataMan.Instance.userData.LastScore); //cookiesText.SetText("" + DataMan.Instance.userData.Cookies); }
//! Uses of reagent liquid in all machines. public void Use(string reagent, float concentration) { Compound realReagent = CompoundFactory.GetInstance().GetCupboardCompound(reagent) as Compound; if (realReagent == null) { Debug.LogWarning("Reagent not seted in database"); return; } switch (myType) { case MACHINES.PHMETER: { resultFloat = realReagent.PH; allowShowFloat = true; allowShowTexture = false; } break; case MACHINES.CONDUTIVIMETER: { resultFloat = realReagent.Conductibility - setupFloat; allowShowFloat = true; allowShowTexture = false; } break; case MACHINES.SPCTROPHOTOMETER_UV: { resultTexture = realReagent.uvSpecter; allowShowFloat = false; allowShowTexture = true; } break; case MACHINES.SPCTROPHOTOMETER_IR: { resultTexture = realReagent.irSpecter; allowShowFloat = false; allowShowTexture = true; } break; case MACHINES.SPCTROPHOTOMETER_FLAME: { resultTexture = Resources.Load <Texture2D>("specter/grafico_sem_fitting"); //resultTexture = realReagent.flameSpecter; allowShowFloat = false; allowShowTexture = true; } break; case MACHINES.POLARIMETER: { resultFloat = realReagent.Polarizability; allowShowFloat = true; allowShowTexture = false; } break; case MACHINES.HPLC: { resultTexture = realReagent.hplc; allowShowFloat = false; allowShowTexture = true; } break; case MACHINES.REFRATOMETER: { resultFloat = realReagent.Refratometer; allowShowFloat = true; allowShowTexture = false; } break; case MACHINES.TURBIDOMETER: { resultFloat = realReagent.Turbidity - setupFloat; allowShowFloat = true; allowShowTexture = false; } break; } InventoryController inventory = FindObjectOfType(typeof(InventoryController)) as InventoryController; //!Prints the chart if (allowShowTexture) { resultTexture = ChartGenerator.GenerateWithTextureConectingDots(resultTexture, concentration, 0.8f); GameObject.FindObjectOfType <PrinterUse>().SendFileToPrinter(setupTexture); HudText.SetText("O grafico foi Impresso!"); timeToShowPrintTextAcc = Time.time; } if (allowShowFloat) { resultFloat *= concentration; } }