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.

28 lines
808 B

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ChangeScalx : MonoBehaviour
{
private void Update()
{
if (Time.frameCount % 10 == 0)
{
if (GameManager.Instance.curCamera != null)
{
Vector3 dir = transform.position - GameManager.Instance.curCamera.transform.position;
if (dir.z >= 0)
{
transform.rotation = Quaternion.Euler(0,0,0);
//transform.localScale = new Vector3(1, 1, 1);
}
else
{
transform.rotation = Quaternion.Euler(0, 180, 0);
//transform.localScale = new Vector3(-1, 1, -1);
}
}
}
}
}