Day 25 – [SinC] – rayCast fix, C# event and Demo
Today I started fixing the bug of the rayCast of yesterday, it was taking in the triggers of the stands causing the crosshair misaligns up with the projectile. I added the layerMask and passed as argument to the rayCast to ignore the triggers, it was pretty easy to solve.
After that I continued the logic of winning. Now when the player put all the cubes in the stands is calculate the time, the penalty and the total time in seconds.
I’m thinking of changing the mechanics to have the maximum time to complete the level and maximum cubes that can throw out.
Another thing I added was the ability of the projectile to be destroyed after colliding with a cube or not. This increases the level of strategy, because you can use the projectile to reach more than one cube.
The most interesting thing today was the modification of internal time manager. At first that each object had to stop in time had its own variable saying if the time was stopped or not, and also had its own toggle that changed the value of this variable. Now it has a central script that has a static variable and its toggle. It also has a static event that notifies when the time toggle. To make the event I used the internal event system’s C#.
Today has a playable demo.
- Scroll - Velocity
- Ctrl + Scroll - Mass.
- Shift – Toggle time.
- Q e E – Toggle between min and max of velocity and mass.
- K – Toggle between the projectile be destroyed at the time of collision with the cube or not.
- Place the cubes of each color in the stand matching color with the shortest time possible.
- Penalty for cube thrown out: 0.4s.
PS1: Note1: In WebPlayer I put Screen.lockCursor = true. I don’t know why it is not working.
PS2: As I haven’t studied anything about level design this demo aims to show only the mechanics.
PS: Sorry for the bad english.