GET_STARTED.md 5.3 KB

🏒 Get Started in 5 Minutes

Quick Start Steps

1. Create the Puck (30 seconds)

  1. In Unity Hierarchy: Right-click → Create Empty → Name it "Puck"
  2. Select Puck → Inspector → Add Component → Search for "PuckController" → Add it
  3. Position it at your center ice (e.g., position: 0, 0.5, 0)
  4. ✅ Done! Puck will auto-create its visuals and physics

2. Tag Your Players (1 minute)

  1. In Unity: Edit → Project Settings → Tags & Layers
  2. Add two new tags:
    • HomeTeam
    • AwayTeam
  3. Select all your home team player GameObjects
  4. In Inspector → Tag dropdown → Select "HomeTeam"
  5. Select all your away team player GameObjects
  6. In Inspector → Tag dropdown → Select "AwayTeam"
  7. ✅ Done!

3. Create Faceoff Manager (30 seconds)

  1. In Hierarchy: Right-click → Create Empty → Name it "FaceoffManager"
  2. Select FaceoffManager → Add Component → "FaceoffManager"
  3. Drag your Puck GameObject into the "Puck" field in Inspector
  4. ✅ Done! Manager will auto-find players by their tags

4. TEST IT! (Press Play)

  1. Press Play button in Unity
  2. Press F key on keyboard
  3. Watch the faceoff happen!
  4. Check Console for outcome messages
  5. ✅ If you see faceoff outcome and puck moves → SUCCESS!

What You'll See

During Faceoff:

  • Console: "Faceoff starting..."
  • Players freeze briefly
  • Console: "Faceoff outcome: HomeWin / AwayWin / Struggle"
  • Puck moves (passed to defender OR bounces loose)
  • Players unfreeze

When Player Gets Puck:

  • Yellow rotating ring appears around them
  • Player can now shoot, pass, or carry

When Puck is Loose:

  • No ring visible
  • Puck slides freely on ice
  • First player to get close picks it up automatically

Troubleshooting

"Nothing happens when I press F"

  • Check Console for error messages
  • Make sure FaceoffManager has the Puck assigned
  • Verify you have players tagged HomeTeam and AwayTeam

"Puck doesn't move"

  • Check that PuckController has a Rigidbody (it creates one automatically)
  • Make sure puck Y position is above 0 (ice level)

"No centers found" error

  • Make sure ONE player on each team has Position = "C" (Center)
  • Check PlayerStats ScriptableObject for each center

"Players don't have yellow ring"

  • Make sure PlayerController.Start() runs
  • Check that possessionIndicator GameObject is created
  • Try stopping/starting play mode

Next Steps After Testing

5. Add Debug Visualization (Optional)

  1. Create Empty GameObject → Name it "DebugVisualizer"
  2. Add Component → "PuckDebugVisualizer"
  3. See possession ranges, trajectories, and on-screen info

6. Auto-Position Players (Optional)

  1. Create Empty GameObject → Name it "FaceoffPositioning"
  2. Add Component → "FaceoffPositioning"
  3. Right-click component → "Auto-Create Faceoff Spots"
  4. During play: Press 1 (center), 2 (home zone), 3 (away zone)

7. Integrate with Your Game

  1. Add Component → "GameFlowExample" to see complete integration
  2. Copy the patterns you need into your own GameManager
  3. Use faceoffManager.InitiateFaceoff(position) after goals, periods, etc.

Common Integration Patterns

Start game with faceoff:

void Start() {
    FaceoffManager manager = FindObjectOfType<FaceoffManager>();
    manager.StartFaceoff();
}

After a goal:

IEnumerator AfterGoal() {
    yield return new WaitForSeconds(3f); // Celebrate
    faceoffManager.StartFaceoff(); // Return to center
}

Check if player has puck:

if (player.HasPuck()) {
    // Do something
}

Make player shoot:

Vector3 toGoal = (goal.position - transform.position).normalized;
player.Shoot(toGoal, 1.0f);

Test Controls

During Play Mode:

Key Action
F Trigger faceoff
1 Position for center ice faceoff
2 Position for home zone faceoff
3 Position for away zone faceoff
G Simulate goal (if GameFlowExample added)

Success Checklist

After following steps 1-4, you should have:

  • Puck GameObject with PuckController
  • Players tagged as HomeTeam and AwayTeam
  • FaceoffManager with puck assigned
  • At least one Center (Position = C) on each team
  • Faceoff triggers when pressing F
  • Puck moves after faceoff
  • Yellow ring shows on player with puck

All checked?You're ready to go! 🎉


Need Help?

  1. Read the docs: FACEOFF_SYSTEM_README.md (detailed)
  2. Quick reference: QUICK_REFERENCE.md (cheat sheet)
  3. Check examples: GameFlowExample.cs (integration patterns)
  4. Validate setup: Add FaceoffSetupGuide component → Right-click → "Validate Setup"

What's Included

PuckController - Physics-based puck with auto-pickup
FaceoffManager - Complete faceoff system with 3 outcomes
PlayerController - Shoot, pass, check methods
Visual feedback - Yellow ring shows possession
Setup tools - Auto-setup and validation
Debug tools - Visualizers and on-screen info
Examples - Complete game flow integration
Documentation - Full guides and references

Total setup time: ~2 minutes
Ready for testing immediately!


Press F to faceoff! 🏒