25 lines
587 B
C#
25 lines
587 B
C#
|
using System.Collections;
|
||
|
using System.Collections.Generic;
|
||
|
using UnityEngine;
|
||
|
|
||
|
public class LightFollow : MonoBehaviour
|
||
|
{
|
||
|
private Transform playerTransform;
|
||
|
|
||
|
// Start is called before the first frame update
|
||
|
void Start()
|
||
|
{
|
||
|
playerTransform = GameObject.FindGameObjectWithTag("Player").transform;
|
||
|
}
|
||
|
|
||
|
void LateUpdate()
|
||
|
{
|
||
|
// we store current camera's position here
|
||
|
Vector3 temp = transform.position;
|
||
|
temp.x = playerTransform.position.x;
|
||
|
temp.y = playerTransform.position.y-0.2f;
|
||
|
transform.position = temp;
|
||
|
|
||
|
}
|
||
|
}
|