QUICK_REFERENCE.md 3.1 KB

Faceoff System - Quick Reference

🎯 Quick Start (3 Steps)

  1. Create Puck: GameObject → Add PuckController
  2. Tag Teams: HomeTeam / AwayTeam tags on players
  3. Create Manager: GameObject → Add FaceoffManager → Link puck

Test: Press F in play mode


🏒 Key Concepts

Puck States

  • Loose → Free on ice, anyone can grab
  • Carried → Attached to player

Faceoff Outcomes

  • Home Win → Puck to home defender
  • Away Win → Puck to away defender
  • Struggle → Puck bounces loose, scramble!

Possession Indicator

  • Yellow ring = Player has puck
  • Ring rotates for visibility

💻 Code Examples

Start a Faceoff

FaceoffManager manager = FindObjectOfType<FaceoffManager>();
manager.InitiateFaceoff(centerIcePosition);

Check Who Has Puck

if (playerController.HasPuck())
{
    // Player has possession
}

Shoot

Vector3 goalDirection = (goal.position - transform.position).normalized;
playerController.Shoot(goalDirection, powerMultiplier: 1.0f);

Pass

PlayerController teammate = FindBestTeammate();
playerController.Pass(teammate);

Body Check

PlayerController opponent = GetNearbyOpponent();
playerController.Check(opponent); // May dislodge puck

🔧 Common Adjustments

Make Faceoffs More Random

FaceoffManager.cs line ~30:

[SerializeField] private float struggleChance = 0.5f; // 50% struggles

Change Pickup Range

PuckController.cs line ~14:

[SerializeField] private float possessionRadius = 2.0f; // Easier pickup

Adjust Ice Friction

PuckController.cs line ~17:

[SerializeField] private float friction = 0.1f; // Slides further

🐛 Quick Fixes

Puck won't pickup:

  • Add trigger collider to player
  • Check player tag (HomeTeam/AwayTeam)

Faceoff won't start:

  • Verify each team has a Center (Position = C)
  • Check tags are correct

No visual indicator:

  • PlayerController.Start() must run
  • Check possessionIndicator GameObject created

📊 Stat Weights (Faceoffs)

Stat Weight Impact
Strength 30% Physical win
Stick Handling 30% Puck control
Awareness 20% Read the drop
Agility 20% Quick reaction

🎮 Testing Checklist

  • Press F → Faceoff starts
  • Console shows outcome (Home/Away/Struggle)
  • Puck moves after faceoff
  • Yellow ring appears on player with puck
  • Puck can be picked up when loose
  • Both teams have centers tagged correctly

📁 Files Created

  1. PuckController.cs - Puck physics & possession
  2. FaceoffManager.cs - Faceoff logic & sequencing
  3. PlayerController.cs - Updated with puck methods
  4. FaceoffSetupGuide.cs - Auto-setup helper
  5. PuckDebugVisualizer.cs - Debug visualization
  6. FACEOFF_SYSTEM_README.md - Full documentation

🚀 Next Steps

  1. Test faceoff with F key
  2. Adjust stats on center players
  3. Watch console for outcome messages
  4. Try different faceoff positions
  5. Integrate with your game loop

Need help? Check FACEOFF_SYSTEM_README.md for detailed docs!