Browse Source

added restart script

master
Joshua Reason 7 years ago
parent
commit
2e370ec2f0
3 changed files with 19 additions and 1 deletions
  1. +6
    -0
      IronToad_UnityProject/Assets/Scripts/LightBeam.cs
  2. +2
    -1
      IronToad_UnityProject/Assets/Scripts/LighthouseLanding.cs
  3. +11
    -0
      IronToad_UnityProject/Assets/Scripts/PlayerController.cs

+ 6
- 0
IronToad_UnityProject/Assets/Scripts/LightBeam.cs View File

@ -10,6 +10,7 @@ public class LightBeam : MonoBehaviour {
// Use this for initialization
void Start () {
NotificationServer.register("statechange Searchlight", toggleState);
NotificationServer.register("switch off", switchOff);
}
// Update is called once per frame
@ -26,4 +27,9 @@ public class LightBeam : MonoBehaviour {
private void toggleState() {
GetComponent<Animator>().SetBool("isSeen", (Searchlight.state == Searchlight.SearchState.Chasing));
}
private void switchOff() {
lightBeam.gameObject.SetActive(false);
target.gameObject.SetActive(false);
}
}

+ 2
- 1
IronToad_UnityProject/Assets/Scripts/LighthouseLanding.cs View File

@ -57,5 +57,6 @@ public class LighthouseLanding : MonoBehaviour
switchedOff = true;
NotificationServer.notify("hide TakeoverButton");
NotificationServer.notify("play sfx", "assassination");
}
NotificationServer.notify("switch off");
}
}

+ 11
- 0
IronToad_UnityProject/Assets/Scripts/PlayerController.cs View File

@ -19,12 +19,17 @@ public class PlayerController : MonoBehaviour {
public GameObject[] lifeHearts;
private Vector3 startPoint;
public GameObject boat;
void Start() {
NotificationServer.register("show GameUI", showGameUI);
NotificationServer.register("hide GameUI", hideGameUI);
instance = this;
startPoint = boat.transform.position;
}
@ -83,4 +88,10 @@ public class PlayerController : MonoBehaviour {
isLocked = true;
}
public void restartScene() {
setLife(3);
boat.transform.position = startPoint;
boat.GetComponent<Rigidbody>().velocity = Vector3.zero;
}
}

Loading…
Cancel
Save