Game Development Reference
In-Depth Information
aegisArms.animation["PistolReady"].time = aegisArms
.animation["PistolReady"].length;
aegisArms.animation.Play("PistolReady");
yield WaitForSeconds (aegisArms.animation.clip
.length);
aegisPistol.active = false;
toolFunctionality.pistolActive = false;
}
function ReadyFlashlight(){
aegisArms.animation["FlashlightReady"].speed = 1;
aegisArms.animation.Play("FlashlightReady");
aegisFlashlight.active = true;
yield WaitForSeconds (aegisArms.animation.clip
.length);
aegisFlashlightLight.active = true;
toolFunctionality.flashlightActive = true;
}
function StoreFlashlight(){
flashLight.active = false;
aegisArms.animation["FlashlightReady"].speed = -1;
aegisArms.animation["FlashlightReady"].time =
aegisArms.animation["FlashlightReady"].length;
aegisArms.animation.Play("FlashlightReady");
yield WaitForSeconds (aegisArms.animation.clip
.length);
aegisFlashlight.active = true;
toolFunctionality.flashlightActive = false;
}
Why?
Most of that is pretty straightforward (i.e., turn on the aegisPistol right
before running the animation that shows it and turn it off after the
animation that stores it). The strange one is where the flashlight is. This
is placed so that the light doesn't turn on until after the FlashlightReady
animation has been run, and turns off right before the flashlight is
put away.
Step 35: Make sure both pistol and flashlight are turned off when the
game begins. Do this within a Start function (if you don't have one).
Usually this is done toward the top of the script after the variable
declarations and any Awake functions but before any other functions:
function Start(){
aegisFlashlight.active = false;
aegisFlashlightLight.active = false;
aegisPistol.active = false;
}
 
Search WWH ::




Custom Search