using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class Clear : MonoBehaviour
{
public GameObject Vamera;
public GameObject[ ] GameArray;
public static bool CheckCam;
public int CameraSelection = 0;
// Start is called before the first frame update
void Start()
{
GameArray = new GameObject[MiniMapSpawningCameras.MaxCamCountInt];
GameArray[MiniMapSpawningCameras.CamInInt] = Vamera;
Vamera.transform.parent = GameObject.Find(“CameraHolder”).transform;
Vamera.GetComponent().enabled = false;
}
// Update is called once per frame
void Update()
{
GameArray = new GameObject[MiniMapSpawningCameras.MaxCamCountInt];
GameArray[MiniMapSpawningCameras.CamInInt - 1].gameObject.GetComponent().enabled = false;
if (Input.GetKeyDown(KeyCode.Delete)){
Destroy(Vamera);
}
if(MiniMapSpawningCameras.CameraViewer == false)
{
}
}
public void NextCamera()
{
GameArray = new GameObject[MiniMapSpawningCameras.MaxCamCountInt];
if(CameraSelection > MiniMapSpawningCameras.MaxCamCountInt)
{
CameraSelection = 0;
}
else
{
CameraSelection += 1;
}
}
public void PreviousCamera()
{
GameArray = new GameObject[MiniMapSpawningCameras.MaxCamCountInt];
if (CameraSelection <= 0)
{
CameraSelection = MiniMapSpawningCameras.MaxCamCountInt;
}
else
{
CameraSelection -= 1;
}
}
}
MiniMapSpawningCameras
using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
using UnityEngine.UI;
public class MiniMapSpawningCameras : MonoBehaviour
{
public GameObject MapCam;
public GameObject person;
public GameObject Plus;
public GameObject Minus;
public GameObject TV;
public GameObject Light;
public GameObject CameraSpawnpoint;
public GameObject NeonCam;
public GameObject Eyes;
public GameObject UIToShow;
public GameObject TheMouses;
public GameObject Arrows;
public Animator MaxCamsError;
public GameObject[ ] Cameras;
public GameObject[ ] CameraClones;
public Text CameraCounter;
public Text MaxCameras;
public Slider MaxCams;
private float height;
public float heightChange;
private float MaxCamCount;
private float CamCount;
private Vector3 personVector3;
private Vector3 CameraSpawn;
public static bool NeonCamOn;
public static bool CameraViewer;
public static int CamInInt;
public static int MaxCamCountInt;
private void Start()
{
NeonCamOn = false;
}
public void ChangeUp()
{
if(height <= 9000 - heightChange + 1)
{
height += heightChange;
}
}
public void ChangeDown()
{
if (height >= personVector3.y + 4)
{
height -= heightChange;
}
}
void CameraSpawner()
{
CameraSpawn = CameraSpawnpoint.transform.position;
CameraClones[0] = Instantiate(Cameras[0], CameraSpawn, Eyes.transform.rotation) as GameObject;
CamCount += 1;
NeonCamOn = false;
}
void Update()
{
MaxCamCountInt = (int)MaxCamCount;
CamInInt = (int)CamCount;
MaxCamCount = MaxCams.value;
MaxCameras.text = MaxCams.value.ToString();
CameraCounter.text = CamCount.ToString();
if (Input.GetKeyDown(KeyCode.Delete))
{
CamCount = 0;
}
if (Input.GetKeyDown(KeyCode.Tab))
{
CameraViewer = !CameraViewer;
}
if (CameraViewer == true)
{
Arrows.SetActive(true);
NeonCamOn = false;
UIToShow.SetActive(true);
Plus.SetActive(false);
Minus.SetActive(false);
MapCam.SetActive(false);
TV.SetActive(true);
Light.SetActive(true);
person.GetComponent().enabled = false;
Cursor.lockState = CursorLockMode.None;
Cursor.visible = true;
}
else if (CameraViewer == false)
{
Arrows.SetActive(false);
Plus.SetActive(true);
Minus.SetActive(true);
MapCam.SetActive(true);
TV.SetActive(false);
Light.SetActive(false);
person.GetComponent().enabled = true;
Cursor.lockState = CursorLockMode.Locked;
Cursor.visible = false;
UIToShow.SetActive(false);
}
if (NeonCamOn == true)
{
TheMouses.SetActive(true);
NeonCam.SetActive(true);
}
else
{
NeonCam.SetActive(false);
TheMouses.SetActive(false);
}
if (Input.GetKeyDown(KeyCode.Alpha1) || NeonCamOn == true && Input.GetMouseButtonDown(1))
{
NeonCamOn = !NeonCamOn;
}
if (Input.GetMouseButtonDown(0) && NeonCamOn == true && CamCount < MaxCamCount)
{
CameraSpawner();
}
else if (Input.GetMouseButtonDown(0) && NeonCamOn == true && CamCount == MaxCamCount)
{
MaxCamsError.Play(“text Fade”);
MaxCamsError.Play(“New State”);
NeonCamOn = false;
}
if (height < personVector3.y + 3)
{
height = personVector3.y + 3;
}
if (height > 9000 - heightChange + 5)
{
height = 9000;
}
personVector3 = person.transform.position;
if (Input.GetKeyDown(KeyCode.DownArrow))
{
ChangeUp();
}
if (Input.GetKeyDown(KeyCode.UpArrow))
{
ChangeDown();
}
Vector3 mapTotal = new Vector3(person.transform.position.x, height , person.transform.position.z);
MapCam.transform.position = mapTotal;
}
}
ill will be appreciative if someone can help