Pocket Monster mobile app for iOS
Made with C# and Unity
Date: 29-30th January 2022
| Process/Notes |
Features
Monsters + Pokeball Animation
Animator parameters
Game main-menu UI (Button + on-click audio)
Scene transitions (button-enabled)
In-game audio
C# Scripts
- GameManager
- MonsterSpawner
- Ball
- CapturedMonster
- KeepAlive (Audio from MainMenu continues to MainScene)
- MainMenu
- Monster
Main Menu canvas + Button
Notes:
Setting it to scale with screen size
Using Rect Transform Anchors
Button playoneshot audio on ‘click’
Integrating MainMenu script to allow for scene transition to MainScene
Monster animation
Notes:
Adding Keyframes manually takes longer than live recording for most basic transitions
Creating Parameter ‘captured’ as necessary for transition between animation states(idle to capturing)
Has no exit playtime
Pokeball animation
Notes:
Particle system animation previews are hidden within all modes except ‘game’ view. Turn on Gizmos to see animation turning on/off.
Property: IsActive
| Process/Notes on C# Scripts |
GameManager script
Notes:
- Determines if swipe is made & speed of swipe to determine length of ball throw
- Ensure only one ball exists in scene at all times
- Registers monster captured sprite in UI
- Removes sprites that exist pre-awake
Ball script
Notes:
OnCollisionEnter function determines if ball comes into contact with any game object with tag ‘Monster’.
Effects if collision == true…
Play ‘hit’ audio source publicly designated in inspector
Animation of ‘Capturing’ played
Ball orients to look at collision object
DestroyBall function - finds ball prefab designated in game manager component & destroys it if….
ball life time >1.5seconds or if ‘captured’ animation finished
Monster script
Notes:
- Capture chance public variable at 80%
- Monster portrait sprite
- Animator of monster
- Audio Source of captured Monster
- Private variable of Camera tranform
- On awake, find transform of Camera
- Position variable = camera position
- position.y = Camera y position
- Monster will look at Camera position
- On collision with game object tagged ‘ball’…
If not ball, continue
If random value is bigger than capture chance(80%), continue
trigger Captured animation
Play Captured audio source
- After captured animation is completed, capture monster, where capture monster =
Find Monster Captured component in Gamemanager & destroy Monster
MonsterSpawner script
Notes:
- Public list of available Monster prefabs to use
- Allocate ARDefaultPlane mesh filter to public mesh filter variable
- Designate in inspector spawnAudioSource
- On awake, invoke spawned monster in 2 seconds
- If a monster is spawned, end
- var selectedPrefab allows random selection among public list of Monster prefabs
- Ensure central position of spawned Monster within AR default plan meshfilter
- Instantiate monster according to election, position and no rotation(aligned with world axes)
- Stop subsystem of ARPlaneManager if monster is Spawned
- Play spawn monster audio
- if no monster is spawned, re-enable ARPlaneManager subsystem to continue spawning monsters
CapturedMonsterUI script
Notes:
Create public ‘Image’ to be determined by player in inspector
Set up portrait image sprite
MainMenu script
Notes:
Using Unity Engine’s UI system
On start click, Load Main scene asynchronously to play game
Keep Alive script
Notes:
Keep Audio from Main Menu scene alive when transitioning to Main Scene.