34 lines
885 B
C#
Executable file
34 lines
885 B
C#
Executable file
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.UIElements;
|
|
|
|
public class Camx: MonoBehaviour
|
|
{
|
|
public bool x;
|
|
public bool y;
|
|
public GameObject player;
|
|
private Transform StartPos;
|
|
|
|
private void Start()
|
|
{
|
|
StartPos = transform;
|
|
player = GameObject.Find("BodyPlayer");
|
|
}
|
|
void LateUpdate()
|
|
{
|
|
if (x && !y)
|
|
{
|
|
transform.position = new Vector3(player.transform.position.x, StartPos.position.y, -10f);
|
|
}
|
|
else
|
|
if (y && !x)
|
|
{
|
|
transform.position = new Vector3(StartPos.position.x, player.transform.position.y, -10f);
|
|
}
|
|
else if (x && y)
|
|
{
|
|
transform.position = new Vector3(player.transform.position.x, player.transform.position.y, -10f);
|
|
}
|
|
}
|
|
}
|