In this blog, I am going to include a script that slows down the time whenever anything nearby is exploded.. I have packaged the script and the Sample Scene into the unity package file, you can just go ahead and import the package in unity and load the example scene file. You are good to go…
Steps for using this script: This script is extremely simple to use…. Just create a empty game object named Time Manager(you can assign any names to it ) and reset it’s transform to 0 in every axis. attach The Time Manager Script to this time manager game object. Secondly Since in the demo we are shooting explosion from the player itself, so i have attached Explosion Script(I forgot actually what i named this script, but it must be something like explosion.) attach this script to the player, reference the main camera in the fps cam section the script in inspector(here camera refers to the main camera attached to our player.) and also add a reference to explosion prefab in the inspector(the prefab will be there in project file) and simply hit the play button and press left mouse button to fire the explosion.. you can observe that the cubes in the scene blast off in the air slow down for a certain time and fall normally. If you want to cause this effect from enemy, like enemy tanks or enemy heavy weapons, Simply attach the script to the enemy (the object from where you want to shoot the explosion) and adjust the input inside script,(By default the scripts operates whenever the player press fire 1 Button(left mouse button)).
You can see the demo in the video below(sorry for the lagging in between and not responding stuff…. Its all because of my recording software(i.e. OBS studio)). And i haven’t recorded my voice because i had some problems with my mic at the time of recording, but i have commented in lines of code to make it as much as understanding as possible.
download the unity package from here
Demo Video :
Thank You everyone…
If you have problems in changing the input to make this script work in different way.. Please feel free to contact me at email@example.com
i will be extremely happy to assist you on this one.