void OnTriggerEnter2D(Collider2D target) { if (target.gameObject.tag == "Player") { StateChanger.RevertToDefaultState(); } }
void OnCollisionEnter2D(Collision2D colInfo) { if (colInfo.collider.gameObject.tag == "Player") { StateChanger.RevertToDefaultState(); } }
void OnCollisionEnter2D(Collision2D colInfo) { if (colInfo.collider.gameObject.tag == "Player") { //anim.SetBool("death",true); StateChanger.RevertToDefaultState(); } }
void CallBack(int e) { CurrentEnergy -= e; Text.text = $"{Mathf.RoundToInt((CurrentEnergy / (float)MaxEnergy) * 100.0f)}%"; if (CurrentEnergy <= 0.0f) { StateChanger.RevertToDefaultState(); } else { Image.fillAmount = Mathf.RoundToInt((CurrentEnergy / (float)MaxEnergy) * 24) / 24.0f; } }
void Watch() { while (true) { try { if (LoadAndValidate()) { StateChanger.RevertToDefaultState(); Text.Buffer = string.Join("\n", attributes.Select(u => $"{u.Key}={u.Value}")); Text.BufferLoaded = true; } if (IsErrored) { IsErrored = false; } } catch (InvalidAttributesFileException ex) { if (!IsErrored) { IsErrored = true; } if (ex.Message != lastError) { lastError = ex.Message; } } catch (Exception ex) { Debug.LogError($"Watcher died: {ex.Message}"); } finally { Thread.Sleep(1000); } } }