Graphics Reference
In-Depth Information
mouse_input= gameObject.AddComponent<Mouse_Input>();
}
didInit=true;
}
public override void Update ()
{
// don't do anything until Init() has been run
if(!didInit)
return;
// do the update in our base
UpdateShip ();
// check to see if we're supposed to be controlling the
// player before checking for firing
if(!canControl)
return;
// fire if we need to
if(fire_input)
{
// tell weapon controller to deal with firing
weaponControl.Fire();
}
}
public override void GetInput ()
{
if(isMouseControlled)
{
// we're overriding the default input function to
// add in the ability to fire
horizontal_input= mouse_input.GetHorizontal();
vertical_input= mouse_input.GetVertical();
// firing isn't in the default spaceship
// (BaseTopDownSpaceShip.cs) behavior, so we
// add it here
fire_input= mouse_input.GetFire();
} else {
// we're overriding the default input function to
// add in the ability to fire
horizontal_input= default_input.GetHorizontal();
vertical_input= default_input.GetVertical();
// firing isn't in the default spaceship
// (BaseTopDownSpaceShip.cs) behavior, so we
// add it here
fire_input= default_input.GetFire();
}
}
void OnCollisionEnter(Collision collider)
{
if(collider.gameObject.layer==17 && !isRespawning &&
!isInvulnerable)
Search WWH ::




Custom Search