40 lines
738 B
C#
40 lines
738 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class LightRun : MonoBehaviour
|
|
{
|
|
|
|
public Material Mat;
|
|
Vector2 V2 = Vector2.zero;
|
|
public float dValue = 0.02f;
|
|
void Start()
|
|
{
|
|
|
|
}
|
|
|
|
// Update is called once per frame
|
|
void Update()
|
|
{
|
|
V2.x += dValue;
|
|
if (dValue > 0)
|
|
{
|
|
if (V2.x > 10)
|
|
{
|
|
V2.x = 0;
|
|
}
|
|
}
|
|
//else
|
|
//{
|
|
// if (V2.x < -10)
|
|
// {
|
|
// V2.x = 0;
|
|
// if (ifTurn)
|
|
// dValue = -dValue;
|
|
// }
|
|
//}
|
|
if (Mat != null)
|
|
Mat.SetTextureOffset("_MainTex", V2);
|
|
}
|
|
}
|