You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
652 B

  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. public class LightBeam : MonoBehaviour {
  5. public Transform target;
  6. public Transform lightBeam;
  7. // Use this for initialization
  8. void Start () {
  9. NotificationServer.register("statechange Searchlight", toggleState);
  10. }
  11. // Update is called once per frame
  12. void Update () {
  13. Vector3 lookAtPos = target.position;
  14. lookAtPos.y = lightBeam.position.y;
  15. lightBeam.LookAt(target);
  16. }
  17. private void toggleState() {
  18. GetComponent<Animator>().SetBool("isSeen", (Searchlight.state == Searchlight.SearchState.Chasing));
  19. }
  20. }