void Update() { if (Vector2.Distance(Player.transform.position, transform.position) < 0.7f) { IsPlayerExited = false; Character1.IndicatorOn(); if (moveScript.activate) { GameObject.Find("AudioSystem").GetComponent <AudioSystem>().CallSound(1, 0.8f); moveScript.activate = false; if (On == false) { Anim.SetBool("On", true); On = true; } else { Anim.SetBool("On", false); On = false; } } } else if (!IsPlayerExited) { IsPlayerExited = true; Character1.IndicatorOff(); } }
void Update() //Обновление скрипта { if ((Vector2.Distance(heartPos.position, playerPos.position) < 1f)) { IsPlayerExited = false; Character1.IndicatorOn(); if (Input.GetKeyDown(KeyCode.E) || moveScript.activate) { { Heart.SetBool("Heart", false); Character1.HP = 100; GameObject.Find("AudioSystem").GetComponent <AudioSystem>().CallSound(1, 0.8f); Character1.IndicatorOff(); Destroy(this); } } } else if (!IsPlayerExited) { IsPlayerExited = true; Character1.IndicatorOff(); } //если дистанция между игроком и сердцем меньше 0.6 юнита И кнопка "Е" нажат, то }
void OnTriggerStay2D(Collider2D col) { if (col.CompareTag("Player")) { CanDo = true; Character1.IndicatorOn(); } }
private void OnTriggerStay2D(Collider2D collision) { if (collision.CompareTag("Player")) { Character1.IndicatorOn(); if (moveScript.activate) { moveScript.activate = false; EventSavingSystem.SaveAll(collision.gameObject.transform.position.x, collision.gameObject.transform.position.y); GameObject.Find("AudioSystem").GetComponent <AudioSystem>().CallSound(2, 0.8f); gameObject.GetComponent <Animator>().SetBool("Saved", true); titre.SetActive(true); Character1.IndicatorOff(); Destroy(this); } } }
void Update() //Обновление скрипта { if (Vector2.Distance(transform.position, playerPos.position) < 0.9f) { Character1.IndicatorOn(); IsPlayerExited = false; if ((Input.GetKeyDown(KeyCode.E) || moveScript.activate && !Enabled)) { totem.SetBool("fired", true); GameObject.Find("AudioSystem").GetComponent <AudioSystem>().CallSound(7, 0.8f); Enabled = true; Wall.counttoop = Wall.counttoop * 10 + key; if (Wall.countconst == Wall.counttoop) { GameObject.Find("AudioSystem").GetComponent <AudioSystem>().CallSound(10, 0.8f); Wall.Open(); } moveScript.activate = false; return; } } else if (!IsPlayerExited) { IsPlayerExited = true; Character1.IndicatorOff(); } if (Vector2.Distance(transform.position, playerPos.position) < 0.9f) { Character1.IndicatorOn(); IsPlayerExited = false; if ((Input.GetKeyDown(KeyCode.E) || moveScript.activate && Enabled)) { totem.SetBool("fired", false); Wall.counttoop = Wall.counttoop / 10; Enabled = false; moveScript.activate = false; return; } } else if (!IsPlayerExited) { IsPlayerExited = true; Character1.IndicatorOff(); } ChangeOrder.ChangeLayerOrder(rend, transform, playerPos); }
void OnTriggerStay2D(Collider2D col) { if (!IsLock) { if (moveScript.activate && Stay) { StopAllCoroutines(); moveScript.activate = false; Dialog.disableImage(); IsLock = true; checkcomm = false; Dialog.TextArea.text = ""; return; } return; } if ((type == 2 || type == 5 || type == 6) && col.CompareTag(tagg)) { Character1.IndicatorOn(); } switch (type) { case 1: //простой комментарий или неактиваруемый диалог if (col.CompareTag(tagg) && checkcomm == true) { if (Stay && checkcomm == true) { moveScript.moveyes = false; moveScript.hero.speed = 0; } moveScript.activate = false; StartCoroutine(Dialog.Dialogue(Dialog.masDial[mas[0]], masvoice, masav[0], 0.05f, t)); checkcomm = false; } break; case 2: //вечный комментарий активируемый if (col.CompareTag(tagg) && (Input.GetKeyDown(KeyCode.E) || moveScript.activate)) { if (Stay && checkcomm == true) { moveScript.moveyes = false; moveScript.hero.speed = 0; } moveScript.activate = false; StartCoroutine(Dialog.Dialogue(Dialog.masDial[mas[0]], masvoice, masav[0], 0.05f, t)); } break; case 3: //Диалог наступательный удаляется if (col.CompareTag(tagg) && checkcomm == true) { if (Stay && checkcomm == true) { moveScript.moveyes = false; moveScript.hero.speed = 0; } moveScript.activate = false; StartCoroutine(Dialog.Dialogue3(Dialog.masDial, masvoice, masav, mas, 0.05f, t)); checkcomm = false; } break; case 4: //Титры if (col.CompareTag(tagg) && checkcomm == true) { StartCoroutine(Dialog.Titres(Dialog.masDial[mas[0]], 0.05f, t)); checkcomm = false; moveScript.activate = false; } break; case 5: //Диалог активируемый удаляется if ((moveScript.activate || Input.GetKeyDown(KeyCode.E)) && col.CompareTag(tagg) && checkcomm == true) { if (Stay && checkcomm == true) { moveScript.moveyes = false; moveScript.hero.speed = 0; } moveScript.activate = false; StartCoroutine(Dialog.Dialogue3(Dialog.masDial, masvoice, masav, mas, 0.05f, t)); checkcomm = false; } break; case 6: //Диалог активируемый НЕ удаляется if ((moveScript.activate || Input.GetKeyDown(KeyCode.E)) && col.CompareTag(tagg) && checkcomm == true) { if (Stay && checkcomm == true) { moveScript.moveyes = false; moveScript.hero.speed = 0; } moveScript.activate = false; StartCoroutine(Dialog.Dialogue3(Dialog.masDial, masvoice, masav, mas, 0.05f, t)); } checkcomm = true; break; } }