💉 Dive into the bloodstream and join the fight against pesky viruses! 🌟 In this fast-paced Virtual Reality adventure, you’ll take on the role of a skilled defender armed with virtual daggers, eliminating invading threats with precision. 🗡️ Inspired by the challenges of the pandemic, this Unity-built game immerses players in a thrilling battle for immunity. 🩺 Optimized for Oculus headsets, all it takes is one click on ‘Start’ to embark on a unique and interactive VR experience that’s both exhilarating and unforgettable! 🎮✨
🦠StartInG Screens🧫
💡Starting Script💡
This script handles game setup 🎮 and interaction logic 🧬 for a VR experience:
- Global Variables 🌐 (via ApplicationData): Stores key game data like virus speed, count, and injector states for use across scenes.
Ray Interaction 🔦:
 - Detects when the player's ray touches the start object.
- Changes ray color (🔴 for active, 🟢 for idle) and activates a light 💡 for visual feedback. Dynamically scales the ray to match the interaction distance.
Haptic Feedback ✋: 
- Briefly vibrates the controller when interacting with the start object for tactile immersion.
Scene Transition 🚪: 
- Loads the next scene ("CoronaLoading") when the player presses the trigger 🎯 or the B key (for testing).
Interactive Start Mechanic ⚡: 
Combines raycasting, collider triggers, and user input to kick off the main game.
🎮The Game Begins🎮
🧬Single virus script🧬
This script manages the behavior of a single virus 🦠 in your VR game:
Key Functions:
Randomized Movement 🎲:
- When the virus spawns, it moves in a random direction at a speed determined by the global SpeedFactor (set in ApplicationData).
- Ensures movement isn't too slow by setting minimum thresholds for X, Y, and Z directions.
Dynamic Forces 🌪️:
- Applies constant force and torque (rotation) to simulate chaotic, lifelike virus movement in 3D space.
Collision Handling 💥:
Detects when the virus is hit by an injector (projectile):
- Destroys the virus and the injector upon collision.
- Spawns an explosion effect at the virus's position.
Updates the global virus count (HowManyViruses--) to track game progress.
This script creates dynamic, interactive, and destructible viruses 🦠 that react to player actions, adding challenge and immersion to the gameplay. Would you like help tweaking or enhancing it? 😊
Wall Bounce Script
Features 🌟
Virus Bounce 🦠➡️🏓:

- Viruses ("corona") hitting walls bounce back in random directions with speed from SpeedFactor. Minimum thresholds ensure lively movement.
Realistic Chaos 🔄:

- Adds force (movement) and torque (spin) for dynamic, chaotic motion.
Destroy Injectors 💥:

- Injectors ("injector") hitting walls are destroyed to clean up missed shots.
Flow 🚀
Collision Detection: 
- Virus: Calculates random bounce direction and applies forces.
- Injector: Gets destroyed on impact.

Explosion Script
Key Features:
Automatic Explosion Cleanup 🧹
- As soon as the explosion is instantiated, the script schedules its destruction using the Invoke method.
- The DeleteExplosion method is set to execute after 3 seconds, ensuring the explosion effect is visible for a brief period before being removed.
Optimization and Efficiency ⚡
- Without this script, explosion GameObjects would remain in the scene indefinitely, leading to memory usage issues and unnecessary clutter.
- By automatically destroying the explosion object, the script prevents performance degradation, especially in scenes with frequent explosions.
Modular Design 🔄
- The DeleteExplosion function encapsulates the logic for destroying the explosion. This keeps the code organized and allows for easy adjustments, such as changing the delay duration.
Game Manager Script
Key Features
Spawns Viruses 🦠
- Creates a set number of viruses at random positions when the game starts. Displays the remaining virus count on the screen.
Injector Gameplay 💉
- Left & Right Injectors: Attach to the controllers.
- Firing: Press the trigger to shoot the injector with sound and force.
- Reloading: Automatically loads a new injector after firing.
Win Condition 🎉
- Destroys viruses one by one.
- When all viruses are gone, the game switches to the win scene.
How It Works
Start():
- Spawns viruses randomly.
- Prepares the first injectors for both hands.
Update():
- Keeps the virus counter updated.
- Tracks injector movement and firing for both controllers:
- 🖐 Left Hand: Fires/reloads when left trigger is pressed.
- ✋ Right Hand: Fires/reloads when right trigger is pressed.
- - Checks if all viruses are gone → moves to victory scene.
Reloading:
Automatically creates a new injector for each hand after firing.

This script makes the game dynamic by spawning viruses 🦠, controlling injectors 💉, and handling win conditions 🎯. Perfect for intense VR gameplay! 🎮
The End
Come take a look!
You can find this project and many more in my Github repositories!
Back to Top