My character can move and interact with the environment, however i need my character to be able to pick up the weapons and shoot them, for this i had to add an additional script called the Player Controller which stores the amount of damage, range, type of gun and other varibles needed for other scripts to fully operate.
To create the player controller i used several booleans to detect when collisions happen in order for the right information to be passed along, as well as set up the canvas of the whole game to the wold position, as a result i needed to move each canvas element to the right place of where the player could see each element, for example i moved the health canvas of the players health on the players left wrist instead of infront of the players eyes, as that might distract them.
After finishing the Player Controller i could use the variables from it to make the Game Manager adjust the ammo counter correctly and then reload when the ammo finishes, making the player stop and wait for the reload to happen. Furthermore the variables from the Player Controller went into the Bullet script and Bullet fire script in order to adjust the range and fire rate of the guns, as the type of gun was required for each weapon to fire.
The player controller variables were also shared to the Enemy and Boss Health scripts in order to adjust the damage dealt to the enemies depending on the weapon the enemy is hit with, for example the pistol would deal 30 damage, where as the rifle would deal a standard of 15 damage per bullet.
One thought on “VR Implementation part two”