Posts

Showing posts from May, 2025

Bug Fixing and Game Over

Game Over Logic (GameManager.cs): Added a CheckGameOver() method that listens for player-death events and displays the endgame UI when one team is eliminated. Team Assignment Storage (ChooseTeam.cs): Introduced AssignTeamToGameManager(int teamId) to pass the local player’s team selection into GameManager for later game-over evaluation. Gun Pickup Mechanic (GunPickup.cs): Created an OnTriggerEnter(Collider other) handler that detects the player collider, shows a “Press E to Pickup” GUI label, and assigns the weapon prefab to the player. Health Notification (Health.cs): Implemented health tracking with a currentHealth field; when it reaches zero, the script calls GameManager.Instance.PlayerDied(playerId) . Mouse-Look Ownership Fix (MouseLook.cs): Wrapped all Input.GetAxis calls inside if(photonView.IsMine) so only the local player’s camera responds to mouse movement. Spawn Script Separation (SpawnIn.cs): Extracted the waiting-room spawn logic into its own SpawnIn.cs , instan...

Animations and Weapons

Placeholder Animations Setup: Assigned a placeholder character prefab and created blend-tree animations driven by BlendV (forward/back) and BlendH (strafe) parameters in Movement.cs , ensuring smooth directional movement. Animation Rigging Integration: Imported Unity’s Animation Rigging package; in  ChangeWeapons.cs , configured TwoBoneIKConstraint components ( leftHand , rightHand ) and updated their targets when swapping weapons, so hands correctly grip each gun . Weapon Change Script: Developed ChangeWeapons.cs to manage an array of weapon GameObjects and corresponding IK targets. Players can cycle weapons with right-click or scroll wheel; on switch, the script deactivates all weapons, activates the selected one, reassigns IK targets, then calls rig.Build() to rebuild the rig . Multiplayer Animation Sync: Leveraged Photon PUN RPCs to broadcast weapon-change events and IK adjustments so all clients update animations and hand poses in real time. // Movement.cs – blend-tre...