MiniGames

### MiniGameBase

The "Score\_Texts" will all be updated with the current score of the "ScoreGiver", same goes for the "Highscore\_Texts", except it's of course the highscore.

"WinScreen"/"LoseScreen" are all the objects which will be enabled/disabled depending on whether or not the player won the game.

"GosToDisableOnLose/Win" are GameObjects to disable on either win or lose.

"SoundEmitter" is the StudioEventEmitter used to play sounds.

The StudioEventEmitter on the object does not need to be setup in any way, just leave it blank.

It is recommended to use a "PhysicalButton" to start/stop the minigames.

### Targets Game

Inherits from MiniGameBase.

Targets game uses the scripts: TargetsGame, Target, MovingTargets, MiniGameStatTracker and ScoreGiver.

To set it up, you need to make an empty object for which to put these scripts on: TargetsGame, ScoreGiver, MinigameStatTracker, PhotonView and StudioEventEmitter. If you can't find either of them, press add component and search for it.

This minigame oly uses the winscreen since the targets game is based on a timer.

"GosToDisableOnLose/Win" is currently it is used for disabling the normal score text so it doesn't cover the win screen.

"TargetsGameAnim" is the animator to use if the sequencing isn't used to pop targets up.

"MultiplyScoreByDistance" if true, makes the score get multiplied by the distance to the target as well as the speed of any moving targets.

"UseRandomPopup" if true makes the targets popup randomly within the parameters "RandomZ" and "RandomX", this only works if "UsePopupSequence" is also true.

"UsePopupSequence" if true makes the targets assigned in the "PopupTargets" array popup in a sequence, this should be false if you intend to use an animator to make the targets popup.

"PopupTargets" is the sequence which will be used for making targets appear/disappear after one another.

Each element in "PopupTargets" has a delay, which is how long after the previous target appeared should it take for this one to appear. The remove delay is how much time there is until the target disappears again, so the player doesn't have infinite amount of time to hit it. Lastly the target has to be assigned, the target variable takes any object with a "Target" script on it.

#### Setting up the targets

First, make sure there is an empty object holding all the targets for the sake of organization, call it "Targets" and put it as a child to the TargetsGame object.

There should be prefabs for all of the targets so first check if there is one and use that, otherwise you'll need to create it manually.

Simple targets only need the scripts: Target, PhotonView and PhotonTransformView.

The targets also obviously need colliders to work, DO NOT use mesh colliders! Create several simple colliders to encapsulate the mesh, preferably as child objects rather than several components on the same object, this will give you much more control over each collider and it will still work fine.

The "Mesh" variable in the inspector needs to be assigned, this is the GameObject which will be deactivated upon getting hit by a projectile. Currently the way I advice the target to be organized in the hierarchy is:

Target

* Base (this is currently the model at the bottom and does not get disabled when hit by a projectile)
* Model (this is the rest of the model and gets disabled when hit by a projectile)

MovingTargets are made the same way, except now you also need to add the "MovingTargets" script.

You need to set its speed and add waypoints for it to move between and it should work fine.

### Blocking Game

Inherits from MiniGameBase.

"ScorePerHitBlocked" is what it says, when the bot hits the player's shield this number is given in score to that player.

"ArrowBot" is the ArrowBotTurret script which fires arrows at the player or an area.

"UseFireCycle" if true makes the bot start firing when the game starts, it also never stops firing.

"GameMode" is either "Block" or "Block and Attack". "Block" mode means the player only gets score for blocking projectiles fired from the bot. "Block and Attack" mode means the player gets score for both blocking and hitting the bot with his/her own projectiles.

#### Setting up the arrow bot

Stationary arrow bots only requires a transform with these scripts: ArrowLauncher, ProjectilePooling and a PhotonView.

You also need to add a transform child to act as the spawnpoint for the projectiles.

The "Target" is where the bot will aim if "AimAtTarget" is true. The script will attempt to assign target to who ever presses the button to start the game.

To set up a moving bot you'll need to make an empty object be the parent of the arrow launcher bot and add these scripts to the new object: BotMovement, PhotonView, PhotonTransformView and a StudioEventEmitter.

The moving bot will try to move around the target in a circle, maintaining a minimum distance and selecting random points around the target to move to.

"MinDistance" is the minimum distance it will keep to the target.

"RandomSphereRadius" is how far away it can get random waypoints.

"MinY" is the minimum Y position it can get, this makes it never go underneath the ground assuming it's set correctly.

"CanMove" makes the bot stop if false.

"FlipMovement" if true means the bot will go in a direction and then next time it moves, go in the opposite direction. This is so that if the target is the player, he/she doesn't get tangled with the Vive/Oculus cable.

"OriginTrans" is the target the bot will move around, preferably it will be the same as he arrow launcher's own target, so that the bot will move around the target it's firing at. This will also be assigned by the "StartGame" function, which is usually used by a button.

"StartTarget" is the first waypoint the bot will have when starting it's movement.

"Game" is the minigame it's connected to.

"SoundEmitter" is the StudioEventEmitter which will play a sound as long as the minigame is running, if this is on the same object as the movement, it does not need to be assigned manually.

The StudioEventEmitter needs to be using the event "event:/Robot/Robot".

#### Blocking & Attacking Game

To set this mode up, you'll need to add a collider and a ScoreGiver script to the arrow launcher bot so that he can be hit by projectiles and give score to the player who hit it.