public void TakeDamage() { if (!isInvincible) { Light.LightDown(); isInvincible = true; StartCoroutine(Invincibility()); StartCoroutine(BlinkDamage()); } }
void OnTriggerStay2D(Collider2D other) { if (other.transform.tag == "HideSpace") { if (Input.GetKey(KeyCode.E)) { playerLight.LightDown(); //玩家隐藏 isHide = true; //--------UI提示信息 } else { playerLight.LightUp(); print("LightUp"); isHide = false; } } }
void playerEnergy() { float flag = 0; if (playDeathTime <= 0) { playerLight.LightDown(); foreach (var go in Energy) { go.SetActive(false); } StartCoroutine(PlayerDied()); playDeathTime = 0; } //Update Energy UI flag = 10 - playDeathTime / 10.0f; for (int i = Energy.Length - 1; i > Energy.Length - flag; i--) { Energy[i].SetActive(false); } if (playDeathTime >= 60) { enemy.SetSpeed(playerMove.moveSpeed * 1.0f, 0); playerLight.HighLevel(); } if (playDeathTime < 60 && playDeathTime >= 20) { enemy.SetSpeed(playerMove.moveSpeed * 1.5f, 1); playerLight.NormalLevel(); } if (playDeathTime < 20) { enemy.SetSpeed(playerMove.moveSpeed * 2.0f, 2); playerLight.LowLevel(); } }