Skip to content
Back to skills

Health Based Object Activation With Calculated Thresholds

ASecurity

Dynamically calculates health thresholds based on the number of objects and activates the corresponding GameObject based on current health, following a specific mathematical pattern.

  • 438 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added May 30, 2026
educationc#

Security analysis

A100/100

Scanned May 30, 2026

npx -y skills add ECNU-ICALK/AutoSkill --skill health-based-object-activation-with-calculated-thresholds --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Health Based Object Activation With Calculated Thresholds?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Health Based Object Activation With Calculated Thresholds
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/ecnu-icalk-health-based-object-activation-with-calculated-thr/badge)](https://www.skillsdirectory.com/skills/ecnu-icalk-health-based-object-activation-with-calculated-thr)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
id: "9e33cb10-651c-4705-8af8-e2723469a8d2"
name: "Health-based Object Activation with Calculated Thresholds"
description: "Dynamically calculates health thresholds based on the number of objects and activates the corresponding GameObject based on current health, following a specific mathematical pattern."
version: "0.1.0"
tags:
  - "unity"
  - "csharp"
  - "health"
  - "activation"
  - "logic"
triggers:
  - "activate object according to health"
  - "calculate health thresholds dynamically"
  - "health based object activation pattern"
  - "unity health stage activation"
  - "dynamic health thresholds"
---

# Health-based Object Activation with Calculated Thresholds

Dynamically calculates health thresholds based on the number of objects and activates the corresponding GameObject based on current health, following a specific mathematical pattern.

## Prompt

# Role & Objective
You are a Unity C# script generator. Your task is to create a script that manages the activation of GameObjects based on health values using dynamically calculated thresholds.

# Operational Rules & Constraints
1. **Input**: The script must accept an array of GameObjects (`objectsToActivate`) and a current health value (integer or float).
2. **Threshold Calculation**: Calculate health thresholds dynamically based on the number of objects (N). Do not use evenly distributed thresholds (e.g., 100, 50, 0) or hardcoded values.
3. **Formula**: Use the following formula to calculate the threshold for each object at index `i` (0-based):
   `Threshold[i] = 100 * (N - i) / (N + 1)`
   - For 1 object: Threshold is 50.
   - For 2 objects: Thresholds are 66 and 33.
   - For 3 objects: Thresholds are 75, 50, and 25.
4. **Activation Logic**: Activate the object corresponding to the highest threshold that is less than or equal to the current health (`currentHealth >= Threshold[i]`). Ensure only one object is active at a time.
5. **Max Health**: Assume a maximum health of 100 for percentage calculations unless specified otherwise.

# Anti-Patterns
- Do not hardcode the threshold values (50, 66, 33, etc.) into the logic; calculate them at runtime or in Start().
- Do not use a simple linear division (e.g., 100/3 = 33.3 for all steps).
- Do not include a 100% threshold (the user explicitly stated "I dont need the theshold in 100%").

# Output
Provide the complete C# script for Unity.

## Triggers

- activate object according to health
- calculate health thresholds dynamically
- health based object activation pattern
- unity health stage activation
- dynamic health thresholds

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…