Unity RPG

Unity RPG Project titled “The Magic Mystery.” Emphasis on combat, health, enemy and player animations and attacks, dialogue, level design, and game lore.

Description

Over the course of several months, I dedicated 4+ hours each day to developing this project, focusing on mastering Unity, C#, and implementing advanced features through self-directed learning, including hundreds of hours of instructional content. With the exception of prefabs and a dialogue editor, every system, from player movement and combat to the magic system and level ambiance, was designed and programmed from scratch. This project challenged my problem-solving skills and creativity, particularly in developing responsive mechanics and immersive environments. I’m proud of the time, effort, and growth that went into bringing this vision to life.

Key Features & Tools Implemented

Integrated cinematic sequences using Unity Timeline.

Developed a fully functional start menu and scene transition system.

Designed third-person movement and camera controls, including an archery mechanic with particle-based projectiles and aiming.

Built a modular enemy and NPC AI system using state machines.

Created immersive level environments using ProBuilder.

Utilized GitHub for version control and project backups.

Incorporated Mixamo prefabs for character animations.

Leveraged Unity Asset Store resources to enhance development efficiency and visual quality.

Notable Project Features

Level Design

From detailed bookcases to glowing crystals, the prefabs, atmospheric lighting, ambient music, and spatial layout all contribute to a cohesive and immersive magical school environment.

Menu

A custom-designed 2D menu interface that initiates the starting scene transition.

NPCs

Every NPC is built as a distinct prefab, featuring custom idle animations and tailored dialogue interactions.

Particle Effects

A custom particle-based effect designed to function as the player’s ranged spell attack.

Player Design

The player utilizes two distinct animation graphs to support different gameplay modes. In the school environment, the focus is on exploration and dialogue, featuring animations tailored for walking and interacting with classmates. In contrast, the outdoor action scene emphasizes mobility and combat, incorporating animations for running, jumping, and casting magic. This separation enhances gameplay variety and allows players to engage with different mechanics and skill sets in each environment.

Enemy Design

The enemy dragon is driven by a state machine that controls its behavior and animation logic. Each state, such as idle, attack, or chase, is linked to specific animations that blend seamlessly, allowing the dragon to transition fluidly between behaviors based on real-time conditions.

Notable Code

Enemy Attack State

The Attack State Class defines the behavior logic for enemy characters when their animation graph transitions into an active attack state. Using Unity’s tagging system, the player is identified with the tag “Player.” When an enemy enters the player’s detection range, it actively tracks the player’s position, rotates to face them, approaches to close the distance, and initiates an attack once within range.

Enemy Chase State

The Chase State logic is activated when the Unity Animator state machine evaluates the chase condition as true. In this state, enemy characters dynamically pursue the player using pathfinding or directional movement, continuously updating their position and orientation to close the distance until the conditions for transitioning to another state, such as attack or idle, are met.

Dragon State Machine

The Dragon Class contains data and behavior specific to the enemy dragon, including health management and state transitions. The dragon’s health bar updates in real time, reflecting damage as it is received. When the dragon takes sufficient damage, the health value decreases accordingly until it reaches zero, at which point the system triggers the “Die” state in the dragon’s state machine, initiating the death animation and related logic.

Enemy Patrol State

The Patrol State class governs enemy movement along predefined waypoints, which are set by attaching waypoint objects within the scene hierarchy. During patrol, the enemy navigates between these waypoints while simultaneously scanning for the player. Upon detecting the player, there is a conditional chance to transition into the Chase State, allowing for dynamic enemy behavior that balances routine patrol with player pursuit.

Particle System

The Particle Control class is attached to the game object responsible for generating particle effects. It manages the behavior and lifecycle of the particle system, controlling emission, timing, and any interaction logic to ensure seamless visual effects within the game environment.