/* * //check performace later * void OnTriggerStay(Collider other) * { * * if (other.tag == "Traveller") { * currentTarget = other.gameObject; * interactionText.text = "Hold X to transfer light to Traveller"; * return; * } * * if (other.tag == "Monster") { * currentTarget = other.gameObject; * interactionText.text = "Press X to stun Monster"; * return; * } * * * if (other.tag == "Switch") { * currentTarget = other.gameObject; * interactionText.text = "Press X to interact with Light Source"; * return; * } * * * } */ void OnTriggerEnter(Collider other) { // Debug.Log(other.name); // if (other.tag == "Monster") { //add to array //monsters.Add(other.gameObject); // } if (other.tag == "Traveller") { targetTraveller = other.gameObject; //interactionText.text = "Hold X to transfer light to Traveller"; interactionPopUp.SetActive(true); Vector3 popUpLocation = other.gameObject.transform.position; popUpLocation.y = popUpLocation.y + textVerticalOffset; popUpController.updateWorldObjectTransform(popUpLocation); return; } if (other.tag == "Monster") { //currentTarget = other.gameObject; targetMonster = other.gameObject; //interactionText.text = "Press X to stun Monster"; interactionPopUp.SetActive(true); Vector3 popUpLocation = other.gameObject.transform.position; popUpLocation.y = popUpLocation.y + textVerticalOffset; popUpController.updateWorldObjectTransform(popUpLocation); return; } if (other.tag == "LampLight") { currentTarget = other.gameObject; //interactionText.text = "Press X to interact with Light Source"; interactionPopUp.SetActive(true); Vector3 popUpLocation = other.gameObject.transform.position; popUpLocation.y = popUpLocation.y + textVerticalOffset; popUpController.updateWorldObjectTransform(popUpLocation); return; } }
/* * void OnTriggerEnter(Collider other) { * Debug.Log("") * * if (other.tag == "LampLight") { * currentTarget = other.gameObject; * //interactionText.text = "Press X to interact with Light Source"; * interactionPopUp.SetActive(true); * Vector3 popUpLocation = other.gameObject.transform.position; * popUpLocation.y = popUpLocation.y + textVerticalOffset; * popUpController.updateWorldObjectTransform(popUpLocation); * //controlLureImage(); * * lScript = other.GetComponent<lightSourceController>(); * if (lScript == null) * Debug.Log("Could not get lscript"); * * lScript.turnOnWorldPaths(); * lScript.turnOnPaths(); * } * * } */ void OnTriggerStay(Collider other) { if (other.tag == "Traveller" && healUnlocked) { targetTraveller = other.gameObject; travellerHealth tHealth = targetTraveller.GetComponent <travellerHealth>(); if (tHealth == null) { Debug.Log("Could not get traveller health script"); } if (tHealth.currentHealth != tHealth.startingHealth) { canHeal = true; //canHeal = true; //interactionText.text = "Hold X to transfer light to Traveller"; // travHealingBar.SetActive(true); Vector3 popUpLocation = other.gameObject.transform.position; popUpLocation.y = popUpLocation.y + textVerticalOffset; popUpController3.updateWorldObjectTransform(popUpLocation); travHealingBarController.updateWorldObjectTransform(popUpLocation); if (isHealing) { //popUpText3.fontSize = 80; //popUpText3.text = "Healing"; interactionPopUp3.SetActive(false); travHealingBar.SetActive(true); //travhealing } else { interactionPopUp3.SetActive(true); if (pController.getResource() > 0) { popUpText3.fontSize = 80; popUpText3.text = "Hold to Heal"; } else { popUpText3.fontSize = 80; popUpText3.text = "Not Enough!"; } //controlLureImage(); //return; } } else { interactionPopUp3.SetActive(false); travHealingBar.SetActive(false); canHeal = false; } return; } if (other.tag == "LampLight") { //Debug.Log("at lamp light"); if (currentTarget != other.gameObject) //new lamp entered radius but old hasnt left { if (lScript != null) { if (lScript.getCurrentLightType() == 0) { //lScript.setMiniMapPathColor(0); lScript.turnOffPaths(); //Debug.Log("turning off)"); } lScript.turnOffWorldPaths(); lScript.switcherScript.setDefault(); } } currentTarget = other.gameObject; //interactionPopUp.SetActive(true); /* * Vector3 popUpLocation = other.gameObject.transform.position; * popUpLocation.y = popUpLocation.y + textVerticalOffset; * popUpController.updateWorldObjectTransform(popUpLocation); */ lScript = other.GetComponent <lightSourceController>(); if (lScript.getCurrentLightType() != 0 && restrictRecover) { interactionPopUp.SetActive(false); return; } interactionPopUp.SetActive(true); if (lScript == null) { Debug.Log("Could not get lscript"); } lScript.turnOnWorldPaths(); lScript.turnOnPaths(); lScript.switcherScript.sethighlight(); return; } if (other.tag == "Monster") { EnemyMovement monScript = other.gameObject.GetComponent <EnemyMovement>(); if (monScript == null) { Debug.Log("Could not find monscript"); } //monScript.popUp2.SetActive(true); Vector3 popUpLocation = other.gameObject.transform.position; popUpLocation.y = popUpLocation.y + textVerticalOffset; monScript.popUp2.GetComponent <WorldSpaceObjectController>().updateWorldObjectTransform(popUpLocation); } /* * if (other.tag == "Monster" && stunUnlocked) { * * * //currentTarget = other.gameObject; * //targetMonster = other.gameObject; * //interactionText.text = "Press X to stun Monster"; * //interactionPopUp2.SetActive(true); * //Vector3 popUpLocation = other.gameObject.transform.position; * //popUpLocation.y = popUpLocation.y +textVerticalOffset; * ////popUpController2.updateWorldObjectTransform(popUpLocation); * //controlLureImage(); * //return; * * * * * EnemyMovement monScript = other.gameObject.GetComponent<EnemyMovement>(); * if (monScript == null) { * Debug.Log("Could not find monscript"); * } * //else * if (!monScript.getIsStunned()) { * * if (!monstersInRange.Contains(other.gameObject)){ * monstersInRange.Add(other.gameObject); * } * monScript.popUp.SetActive(true); * // monScript.popUp2.SetActive(false); * Vector3 popUpLocation = other.gameObject.transform.position; * popUpLocation.y = popUpLocation.y +textVerticalOffset; * monScript.popUp.GetComponent<WorldSpaceObjectController>().updateWorldObjectTransform(popUpLocation); * Text monText = monScript.popUp.GetComponentInChildren<Text>(); * if (pController.getResource() >= 20){ // change to public var later * * monText.fontSize = 100; * monText.text = "Stun"; * } * * else { * monText.fontSize = 80; * monText.text = "Not Enough!"; * } * * return; * * } * else { * monScript.popUp.SetActive(false); * monScript.popUp2.SetActive(true); * * Vector3 popUpLocation = other.gameObject.transform.position; * popUpLocation.y = popUpLocation.y + textVerticalOffset; * monScript.popUp2.GetComponent<WorldSpaceObjectController>().updateWorldObjectTransform(popUpLocation); * * monstersInRange.Remove(other.gameObject); * } * * * * * } * */ }