public int GetCurrentHitablesCount(Hitable.HitableType hitableType) { int count; currentNumberOfHitables.TryGetValue(hitableType, out count); return(count); }
public int GetTotalHitablesCount(Hitable.HitableType hitableType) { int count; totalNumberOfHitables.TryGetValue(hitableType, out count); return(count); }
public void RegisterHitable(Hitable.HitableType hitableType, bool register) { int count; currentNumberOfHitables.TryGetValue(hitableType, out count); currentNumberOfHitables[hitableType] = (register ? count + 1 : count - 1); if (register) { int totalCount; totalNumberOfHitables.TryGetValue(hitableType, out totalCount); totalNumberOfHitables[hitableType] = totalCount + 1; } }
void OnHit(Hitable.HitableType hitType) { switch (hitType) { case Hitable.HitableType.Astroid: if (isAlive) { SetTexture(--currentHealth); if (currentHealth > 0) { damageParticles.Play(); _canTakeDamage = false; const float SHIELD_TIME = 3; canTakeDamageAgain(SHIELD_TIME); const float SHAKE_TIME = 0.3f; CameraControl.inst.shake(SHAKE_TIME); AudioManager.inst.playSound("Invulnerability"); } else { Explode(); } } break; case Hitable.HitableType.Repair: if (currentHealth < maxHealth) { SetTexture(++currentHealth); } UIManager.inst.showPowerup("Repair"); break; case Hitable.HitableType.Amplify: delay = Mathf.Max(0, delay - amplifyAmount); UIManager.inst.showPowerup("Amplify"); break; case Hitable.HitableType.Jump: _targetSpeed = jumpSpeed; StartCoroutine(RevertToDefaultSpeed(jumpSpeedDuration)); UIManager.inst.showPowerup("Light Speed"); break; } }