A Coin Distraction
Like any good stealth game, you need some sort of distraction system. This is exactly that. So how does it work?
The idea is when the player presses the right mouse button, Darren “throws” a coin at said location and the guards hear it and get distracted allowing him to sneak through.
The left picture is on the Player script. It uses the same system of Raycasting as how the player moves. Based on where the player clicks it Instantiates an Object at that location, playing a sound, animation and broadcasting an Action to the Guards to move to that location. The Action that was set up, is sending a Vector3 and Bool to the guards to notify them that the coin was indeed tossed and at what location. It then sets their destination to that position and they all run over there distracted.
With this, that’s another part of the project down. Next setting up the cameras.