2.9 KiB
2.9 KiB
| name | description |
|---|---|
| weapon-development | Develop and extend the VampireLike weapon system. Use when creating new weapons, updating weapon state machines, changing target selection/effects/data parsing, or integrating weapon behavior with shop, inventory, and entity flow. |
Weapon Development
Quick Start
- Read full baseline spec:
./references/WeaponDevelopmentSkill.md. - Confirm change scope:
- weapon runtime (
WeaponBase, concrete weapons) - state flow (
Idle,Check_OutRange,Check_InRange,Attack) - target selector (
ITargetSelector,TargetSelectorType) - effect layer (
IWeaponAttackEffect) - data contract (
DRWeapon,WeaponData)
- weapon runtime (
- Keep behavior compatibility with current gameplay loop and UI/event chain.
Source Map
- Weapon base:
../../Assets/GameMain/Scripts/Entity/EntityLogic/Weapon/WeaponBase.cs - Existing weapons:
../../Assets/GameMain/Scripts/Entity/EntityLogic/Weapon/WeaponKnife/../../Assets/GameMain/Scripts/Entity/EntityLogic/Weapon/WeaponHandgun/../../Assets/GameMain/Scripts/Entity/EntityLogic/Weapon/WeaponSlash.cs
- Selectors:
../../Assets/GameMain/Scripts/Entity/EntityLogic/Weapon/TargetSelector/
- Weapon data:
../../Assets/GameMain/Scripts/Entity/EntityData/Weapon/
- Entity show flow:
../../Assets/GameMain/Scripts/Entity/EntityExtension.cs
Non-Negotiable Invariants
- Do not duplicate logic already owned by
WeaponBase. - Keep state transitions explicit and non-blocking.
- Keep cooldown accumulation valid even when no target is found.
- Keep attack logic and visual effect logic decoupled.
- Use safe parsing (
TryParse+ defaults) for runtime weapon parameters. - Preserve compatibility with shop/inventory/UI refresh flow.
Change Recipes
Add a New Weapon
- Extend
WeaponTypewithout reordering existing enum values. - Add
WeaponXxxData : WeaponDatafor strong-typed fields. - Add
WeaponXxx : WeaponBaseand implement only weapon-specific behavior. - Build state files under
Weapon/WeaponXxx/with partial class layout. - Register display/data mapping path so
ShowWeaponcan instantiate correctly.
Add or Update a Target Selector
- Implement
ITargetSelector. - Update
TargetSelectorType. - Register creation in
WeaponBase.CreateSelector. - Validate target semantics with current-health rules where applicable.
Add or Update Attack Effect
- Implement
IWeaponAttackEffect. - Trigger effect from weapon attack state only.
- Keep damage resolution outside effect code.
Validation Checklist
- Weapon can be shown, attached, and updated without exceptions.
- State machine does not stall across target loss/reacquire.
- Cooldown and range checks match design expectation.
- Damage path and effect path remain decoupled.
- UI/shop/inventory interactions stay stable after the change.
- Update
./references/WeaponDevelopmentSkill.mdif contracts changed.