Use this guide to create or edit an Artillery prefab with all required ArtilleryView references.
Architecture Context
ArtilleryView combines logic from:
- BuildingView
- BuildingLevelStackView
- BuildingLevelObjectsView
Artillery visuals are driven by two systems:
- Team foundation visuals from _foundationPools
- Level visuals from _buildingLevels
Pre-Setup Checklist
- Root object has ArtilleryView component
- "_localTransform" is assigned
- "_aimNode" is assigned
- "_foundationPools" has entries for all teams
- "_buildingLevels" matches your level count
- "_rotateNode" and "_bulletNode" are assigned
- "_attackRange" is assigned to AttackRangeArtillery
- "_trajectoryLine" and "_trajectoryLineHolder" are assigned
Scene View Gizmos (BuildingView)
- BuildingView draws a wire sphere in the Scene view at this object transform position.
- Radius matches TargetView "_radius" (same footprint used for clicks and combat checks).
- Wire color matches "_teamID" so you can scan team placement in the editor.
- Turn on Gizmos in the Scene view toolbar if you do not see it.
Main Procedure
Step 1: Duplicate a Working Prefab
- Duplicate Assets/GorodiskiGames/TowerClash/ResourcesStatic/Prefabs/Building/Artillery.prefab.
- Rename the new prefab, for example ArtilleryVariant.prefab.
- Open the duplicated prefab in Prefab Mode.
Step 2: Verify Required Hierarchy Links
2.1. Confirm these object references in ArtilleryView:
- Transform (visual root) -> _localTransform
- AimNode -> _aimNode
- RotateNode -> _rotateNode
- BulletNode -> _bulletNode
- TrajectoryLineRenderer transform -> _trajectoryLineHolder
- TrajectoryLineRenderer LineRenderer -> _trajectoryLine
- AttackRangeArtillery (AttackRangeView) -> _attackRange
2.2. If any of these is null, aiming, spawning, or trajectory visuals will break.
Step 3: Configure Core Building Values
3.1. Set gameplay-related values in ArtilleryView:
- "_building" = Artillery
- "_teamID" = default team for initial state
- "_radius" = click/target footprint
- "_foundationHeight" and "_levelHeight" = vertical layout
- "_unitsCountDefault", "_unitsCountMax", "_levelMax" = gameplay limits
3.2. Recommended:
- Keep "_buildingLevels".Length >= "_levelMax"
- Use "_levelHeight" = 0 if level visuals are switched by "_buildingLevels" only
Step 4: Configure _foundationPools
4.1. Add one TeamPoolEntry per TeamIDType:
- Player
- Neutral
- Red
- Yellow
- Green
- Violet
- Magenta
- Cyan
4.2. For each entry, assign a ComponentPoolFactory that spawns the correct team foundation prefab.
4.3. Rules:
- Do not leave a team missing
- Do not duplicate team IDs
Step 5: Configure "_levelsPools" and "_roofPools"
5.1. In the current Artillery pattern, these are usually empty.
5.2. Use them only if you intentionally want runtime-instantiated floors/roof from pools.