// Update is called once per frame void Update() { time += Time.deltaTime; #if UNITY_EDITOR if (Input.GetMouseButtonDown(0)) { StartCoroutine(JetRoutine(effect)); } if (Input.GetMouseButtonDown(1)) { Debug.Log("슈터의 사용을 중지합니다"); this.enabled = false; item.state = Item.Usage.IDEL; } #else if (Input.touchCount > 0) { StartCoroutine(JetRoutine(effect)); } //한번에 두개의 터치가 들어오면 if (Input.touchCount >= 2) { Debug.Log("슈터의 사용을 중지합니다"); this.enabled = false; InGameUIControl.GetInstance().SimpleMassagePanel.SetActive(false); } #endif }
void Start() { scoreText = GameManager.GetInstance().score; dialog = InGameUIControl.GetInstance().dialog; uiControl = InGameUIControl.GetInstance(); gm = GameManager.GetInstance(); }
public void CloseThis() { gameObject.SetActive(false); if (gameObject.name == "VideoWindow") { InGameUIControl.GetInstance().VideoOver(GameObject.Find(ItemManager.items["elevator"].name).GetComponent <UnityEngine.Video.VideoPlayer>()); SoundManger.instance.musicSource.volume = .3f; } }
public static InGameUIControl GetInstance() { if (!instance) { instance = GameObject.FindObjectOfType(typeof(InGameUIControl)) as InGameUIControl; if (!instance) { Debug.LogError("There needs to be one active MyClass script on a GameObject in your scene."); } } return(instance); }
IEnumerator JetRoutine(GameObject _effect) { UnExtinguishable = false; Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit hit; //if (Physics.Raycast(ray, out hit)) if (Physics.Raycast(ray, out hit)) { #else IEnumerator JetRoutine(GameObject _effect) { UnExtinguishable = false; for (int i = 0; i < Input.touchCount; i++) { tempTouches = Input.GetTouch(0); } //Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); Ray touchRay = Camera.main.ScreenPointToRay(tempTouches.position); RaycastHit hit; //if (Physics.Raycast(ray, out hit)) if (Physics.Raycast(touchRay, out hit)) { #endif //부딪힌게 불이면 끈다. if (hit.collider.tag == "fire") { SoundManger.instance.RandomizeSfx(soundEffects); //물을 쓰고, 기름에 의한 화재일 경우 끄지 못한다. if (hit.collider.gameObject.transform.parent && hit.collider.gameObject.transform.parent.name == ItemManager.items["oilStove"].name && this.effect.name == "waterEffect") { Debug.Log("끌수없는 불입니다."); UnExtinguishable = true; } if (!UnExtinguishable) { ParticleSystem ps = hit.collider.gameObject.GetComponent <ParticleSystem>(); Fire fire = hit.collider.gameObject.GetComponent <Fire>(); fire.enabled = true; var col = ps.colorOverLifetime; col.enabled = true; var psMain = ps.main; psMain.loop = false; fire.isExtinguished = true; //불을 껐다는걸 불에게 알린다. extinguishedCount++; //끈 불의 갯수 세기(미션스크립트에 넘겨주기 위함) if (extinguishedCount > 10) { Debug.Log("끈 불의 수가 10개가 넘음"); extinguishedCount = 0; } GameObject effect = Instantiate(_effect, hit.transform.position, Quaternion.identity); effect.GetComponent <ParticleSystem>().Play(); //파티클시스템(소화기분말)의 수명만큼 기다리다가 파괴한다. yield return(new WaitForSeconds(effect.GetComponent <ParticleSystem>().main.duration)); Destroy(effect); //한번 소화기 혹은 모래를 사용했으니 카운터를 올린다. mouseCounter++; if (mouseCounter > limitJetCount) // 사용횟수제한만큼 사용하면 { this.enabled = false; mouseCounter = 0; InGameUIControl uiCtrl = InGameUIControl.GetInstance(); //uiCtrl.DiscardSlot(); //다쓰면 슬롯을 비움 if (!ismassageActivated) { InGameUIControl uiControl = InGameUIControl.GetInstance(); uiControl.simpleMassage.text = gameObject.name + "을(를) 전부 소모하였습니다."; uiControl.SimpleMassagePanel.SetActive(true); ismassageActivated = true; } } } } } yield return(null); }