To begin this test I created a simple environment of two platforms (one raised higher than the other) with stairs connecting them. I also created several coloured boxes on the first platform which I would later use as buttons.
Using the triggerAnimtion script from the last test I created a simple staircase puzzle. By attaching the script to colliders placed above the coloured boxes they would act as buttons so that when the player walked on a button, animations for the steps of the staircase would be triggered. To do this I created a large button which can not be avoided by the player, so when they walk on it the steps to the staircase move and it becomes no longer accessible. The player then has to walk on the other buttons to activate other step animations which bring the steps back to their original position allowing the player to progress onto the second platform.
Above is an example of the staircase from the players perspective after the first button is activated.
Secondly I created a new script which I also attached to the button colliders so that when the steps move an audio clip is played with a sound of stones grinding. Here is an example of the script which I have called audioTrigger:
function OnTriggerEnter (other : Collider)
{
audio.Play();
}
function OnTriggerExit (other : Collider)
{
audio.Stop();
}
Eyes Opening
To achieve this effect I simply placed two black planes in front of the main camera (this is camera that the player sees through in game). I then animated both planes to open and then flicker and set the animation to 'Play on awake' so that when the test begins the two planes flicker to give the impression of eyelids. So that the planes follow the camera (this is incase the player moves the mouse while the animation is playing) I attach them to the main camera. I then found a free to use script on unifycommunity.com called FadeInOut, I attached this script to the main camera and applied a plane black texture to it. What this script does is fade from the texture to full transparency in a certain time, which you can manipulate using the scripts GUI. So now as well as the eyelids flickering the screen fades from black to give a good impression of a first-person perspective of waking up.
No comments:
Post a Comment