🎮 Gameplay Setup (Overview)
This section explains how to configure the camera, slingshot, level manager, intro/showcase, UI & ammo, and enemies in the SlingshotSquad Template.
Requirements
Unity (URP/2D)
LeanTween (DentedPixel) in the project
An EventSystem in the scene (and Physics2DRaycaster on the Main Camera if the slingshot receives pointer input in the 2D world)
Slingshot Camera Controller
Controls manual pan, orthographic zoom, lock to the slingshot, projectile follow, and showcase focus on arbitrary points.
How to set up
Select Main Camera and add
SlingshotCameraController.Drag the slingshot Transform into
slingshotFocus.Adjust movement limits to match your level bounds.
Key fields
Movement Limits →
minX/maxX/minY/maxYWorld-space bounds for camera movement.Manual Pan →
manualPanSpeedDrag speed for panning.Zoom Settings
minOrthoSize/maxOrthoSize→ zoom rangezoomStep/zoomDuration→ step amount and tween time
Focus & Follow Settings
focusTweenDuration→ tween time when locking to slingshot/targetsfollowLerpSpeed→ smoothing when following projectile
References
slingshotFocus→ focus point when callingLockToSlingshot()
Flow
Before launch:
LockToSlingshot()recenters the camera and triggersStartGame()on the Level Manager.During flight:
Follow(projectile)tracks the projectile.After impact/idle:
ReturnToSlingshot()recenters and restores manual pan.
Tips
If zoom “clips” at edges, either enlarge maxX/maxY or raise maxOrthoSize. Panning is disabled while SlingshotController.IsAiming is true.
Slingshot Controller
Handles aim, launch, trajectory dots, elastic band visuals, and integration with Level/Camera.
How to set up
Create a SlingshotRoot GameObject and add
SlingshotController.Assign
launchPoint(an Empty at the sling muzzle).Assign
directionDotPrefab(a small sprite/dot).If using pointer over world objects, add
Physics2DRaycasterto the Camera and ensure clickable objects have Collider2D.
Key fields
Launch Point →
launchPoint,launchAudioDirection Dots →
directionDotPrefab,dotCount,dotSpacingLaunch Settings →
minForce,maxForce,maxPullDistanceElastic Band →
elasticRenderer,elasticOffset,elasticThicknessElastic Clamp →
minVisualLength,maxVisualLength,stretchAxis
Launch flow
PointerDown → spawns the next projectile from Level
characterSequenceand locks camera to the slingshot.Drag → updates projectile position, stretches the band, and shows trajectory dots.
PointerUp → applies force (min–max), plays SFX, enables Skill, consumes active booster (if any), and calls Camera.Follow().
Tips
If pointer events don’t fire, verify EventSystem, Physics2DRaycaster on Camera, and Collider2D on the slingshot target. Tune maxPullDistance together with minForce/maxForce.
Level Manager
Orchestrates the level: score, stars, win/lose, projectile sequence, camera return, and rewards.
How to set up
Create LevelManager and add
SlingshotLevelManager.Fill:
enemyList(dragAngryEnemyinstances from the scene)characterSequence(array ofCharacterDatain shot order)ammoContainer(HUD reference)defaultPopup(score popup)
The Level Manager queries
LoadingManager(current map, ids, next map) and drivesUIGameplay.
Key fields
Star Thresholds →
pointsFor1Star/2Star/3StarCamera Return →
idleDamageTime(idle time with no damage to end the flight and decide outcome)Events →
OnLevelWin/OnLevelLose
Gameplay flow
Boot → if the map unlocks a character, shows the unlock panel, then runs
IntroShowcase.StartShowcase().Shot →
PopNextCharacter()returns the nextCharacterData; HUD ammo updates accordingly.Scoring →
AddScore()increments points and updates stars.Win/Lose
Win: all enemies dead and idle ≥
idleDamageTime.Lose: no ammo left and enemies still alive after
idleDamageTime.
Rewards/Progression → saves stars/highscore; applies XP/items; unlocks
nextMap.
Useful hooks
AOE damage:
ExplodeAt(pos, radius, dmg, vfx)Boosters:
FlagNextShotDoubleDamage(),AddExtraShot(CharacterData)Score popups:
ScorePopupSpawner.Spawn(...)
Intro Showcase
Moves the camera to a focusPoint, optionally changes zoom, waits, triggers enemy showcase (speech/audio), then returns to the slingshot.
How to set up
Add
IntroShowcaseto a GameObject.Set
focusPoint(an Empty at the target you want to highlight).Tune
travelSpeed,showcaseZoomSize,staySeconds.
Flow
StartShowcase()Computes travel time and calls
SlingshotCameraController.LockToPoint(...)Calls
SlingshotLevelManager.TriggerEnemyShowcase()After
staySeconds, restores zoom (if changed) andReturnToSling()
UI & Ammo
UIGameplay
Manages HUD (score), pause/resume, zoom buttons, boosters panel, return to home, skill hint, and the Active Booster HUD. It also shows the Unlock Character Panel with animation and spawns the character skill preview.
How to set up
Use a Canvas with
UIGameplay.Wire buttons (Pause/Resume/Zoom/Boosters/Home) and panels (Pause/Boosters/EndGame).
Assign
skillHint, Active Booster Root/Text, and Unlock panel fields.
Notes
Without an AudioManager, the code falls back to AudioSource.PlayClipAtPoint.
The Skill Hint is shown when the current projectile can use its skill and hidden on impact or after use.
AmmoContainer
Holds ammo icons and reorders them with a hop animation (LeanTween).
How to set up
Reference
AmmoContainerin the Level Manager.The Level Manager populates and removes icons automatically from the
characterSequence.
Fields
spacing,hopHeight,hopTime→ layout/animationGetIconTransform(i)→ used to display “unused” bonus popups over each icon
AngryEnemy (Impulse-Based Damage)
Enemies take damage based on collision impulse (mass × relative velocity), with thresholds and playable-graph animations.
How to set up
Ensure Collider2D + Rigidbody2D + Animator are present.
Tune
maxHitPoints,damageThreshold,damagePerImpulse.In Showcase, enable
showcaseEnabledand setspeechBubble/showcaseClipif you want intro speech/audio.
Key fields
Self Multiplier →
selfImpulseScale(scales incoming damage)Score →
scoreOnDeath(points on death)Playable Animations → presets idle/injured/win
VFX/SFX →
deathVfx,deathSfx
CharacterProjectile (Shot Core)
Reads stats from CharacterData, plays Idle/Launch/Death animations, handles collision grace time, post-collision skill window, impact SFX/VFX, and booster visuals.
Flow
SetupFromData(CharacterData) → pulls stats/FX/Skill; equips cosmetics using VisualMountPoints.
OnLaunch() → enables physics, Trail/Stamp, Launch animation, and opens the skill window.
OnCollisionEnter2D → respects grace/min speed, plays impact VFX/SFX, switches to Death animation, hides skill hint.
Key values (via CharacterData)
Damage:
baseDamage,impulseBonusFactor,damageMultiplierDespawn/Physics:
despawnDelay,sleepVelocityCollision:
collisionGraceTime,minImpactSpeedScoring:
bonusIfUnusedSkill:
skillData(executed inTriggerSpecialAbility())Visuals:
trailRendererPrefab,stampTrailPrefab,impactVfx, launch/impact SFX
✅ Quick Scene Checklist
Main Camera →
SlingshotCameraController(+Physics2DRaycasterif using pointer over 2D world)SlingshotRoot →
SlingshotController(launchPoint, dots, elastic)LevelManager →
SlingshotLevelManager(enemies,characterSequence,ammoContainer,defaultPopup)UI →
UIGameplay(score, panels, buttons, skill hint, active booster HUD) + AmmoContainerIntro →
IntroShowcasewithfocusPointAudio → optional AudioManager (fallback is built-in)
LeanTween → present in project
EventSystem → in scene
Suggested Defaults (Mobile)
Camera:
minOrthoSize=5,maxOrthoSize=9,zoomStep=1,followLerpSpeed=5–7Slingshot:
maxPullDistance=3,minForce=2,maxForce=15,dotCount=10,dotSpacing=0.2Level:
idleDamageTime=3s; stars at 10k / 25k / 40k for baselineProjectile (via CharacterData):
collisionGraceTime≈0.2s,sleepVelocity≈0.3,minImpactSpeed≈0.5
Troubleshooting
Pointer not working: ensure EventSystem, Physics2DRaycaster on Camera, and Collider2D on the clickable object.
Camera won’t follow/return: verify
slingshotFocusand camera event hooks.No trajectory dots: check
directionDotPrefabanddotCount > 0.No audio: without AudioManager, playback falls back to
AudioSource.PlayClipAtPoint.Animations not playing: confirm Animator/presets assigned and no PlayableGraph errors in Console.
Last updated