|
|
@ -0,0 +1,29 @@ |
|
|
|
using System.Collections; |
|
|
|
using System.Collections.Generic; |
|
|
|
using UnityEngine; |
|
|
|
|
|
|
|
public class LightBeam : MonoBehaviour { |
|
|
|
|
|
|
|
public Transform target; |
|
|
|
public Transform lightBeam; |
|
|
|
|
|
|
|
// Use this for initialization
|
|
|
|
void Start () { |
|
|
|
NotificationServer.register("statechange Searchlight", toggleState); |
|
|
|
} |
|
|
|
|
|
|
|
// Update is called once per frame
|
|
|
|
void Update () { |
|
|
|
Vector3 lookAtPos = target.position; |
|
|
|
lookAtPos.y = lightBeam.position.y; |
|
|
|
lightBeam.LookAt(target); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
private void toggleState() { |
|
|
|
GetComponent<Animator>().SetBool("isSeen", (Searchlight.state == Searchlight.SearchState.Chasing)); |
|
|
|
} |
|
|
|
} |