public void Damaged() { if (!m_bNoDamage) { // 受傷後的無敵時間 if (remainUltimateTime > 0f) { return; } sprite.Flash(); if (random.Next(1, 100) < systemDamageRate) { int indexOfSystemId = MathUtility.RandomWithWeights(random, systemLevels); if (systemLevels[indexOfSystemId] > 0) { systemLevels[indexOfSystemId]--; } RefreshSystemValues(); OnDamaged?.Invoke((SystemId)indexOfSystemId); } remainUltimateTime = ultimateTime; } }
public void TakeDamage(float fDamage) { m_fHP -= fDamage; m_oRobotSprite.Flash(); if (m_fHP <= 0.0f) { Destroy(gameObject); } }