| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
A collection of useful Unity scripts for common game development tasks.
Added six powerful systems to enhance your Unity projects:
Added five utility scripts to enhance game development:
Create empty GameObjects in your scene for the managers:
Attach the respective scripts to these GameObjects
For CameraController:
For HealthSystem:
For TooltipManager:
For DialogueSystem:
For ObjectPooler:
For SaveSystem:
For QuestSystem:
For AudioManager:
// Pause game
GameManager.Instance.PauseGame();
// Resume game
GameManager.Instance.ResumeGame();
// Check game state
if (GameManager.Instance.isGamePaused) {
// Handle pause state
}// Save data
DataManager.Instance.SaveData("PlayerScore", 100);
// Load data
int score = DataManager.Instance.LoadData("PlayerScore", 0);
// Delete data
DataManager.Instance.DeleteData("PlayerScore");// Take damage
healthSystem.TakeDamage(20f);
// Heal
healthSystem.Heal(10f);
// Check health
float healthPercent = healthSystem.GetHealthPercentage();// Show tooltip
TooltipManager.Instance.ShowTooltip("Press E to interact", Input.mousePosition);
// Hide tooltip
TooltipManager.Instance.HideTooltip();// Create dialogue
Dialogue dialogue = new Dialogue();
dialogue.speakerName = "NPC";
dialogue.speakerImage = npcSprite;
dialogue.sentences = new string[] {
"Hello there!",
"How can I help you today?",
"Feel free to ask me anything."
};
// Start dialogue
DialogueSystem.Instance.StartDialogue(dialogue);
// Display next sentence (usually connected to button)
DialogueSystem.Instance.DisplayNextSentence();// Create item
InventoryItem potion = new InventoryItem(
"potion001",
"Health Potion",
"Restores 50 health points",
potionSprite,
5
);
potion.isConsumable = true;
// Add to inventory
InventorySystem.Instance.AddItem(potion);
// Use item
InventorySystem.Instance.UseItem("potion001");
// Check if player has item
if (InventorySystem.Instance.HasItem("potion001", 2)) {
// Player has at least 2 potions
}// Spawn object from pool
GameObject bullet = ObjectPooler.Instance.SpawnFromPool("Bullet", firePoint.position, firePoint.rotation);
// Return object to pool when done
ObjectPooler.Instance.ReturnToPool(bullet);// Save game
SaveSystem.Instance.SaveGame();
// Load game
SaveSystem.Instance.LoadGame();
// Save specific data
SaveSystem.Instance.SaveData("PlayerPosition", transform.position);
// Load specific data
Vector3 position = SaveSystem.Instance.LoadData<Vector3>("PlayerPosition", Vector3.zero);// Start quest
QuestSystem.Instance.StartQuest("quest001");
// Complete objective
QuestSystem.Instance.CompleteObjective("quest001", "objective001", 1);
// Get quest status
QuestStatus status = QuestSystem.Instance.GetQuestStatus("quest001");
if (status == QuestStatus.Completed) {
// Quest is completed
}// Play background music with fade
AudioManager.Instance.PlayMusic("MainTheme", 2.0f);
// Play sound effect
AudioManager.Instance.PlaySFX("Jump");
// Play 3D sound at position
AudioManager.Instance.PlaySFXAtPosition("Explosion", explosionPosition);
// Play ambient sound
AudioManager.Instance.PlayAmbience("ForestAmbience");
// Adjust volume
AudioManager.Instance.SetMusicVolume(0.5f);This project is licensed under the MIT License - see the LICENSE file for details.
| Back | FazBrowse Home | New Git URL |