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.

62 lines
1.7 KiB

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class LevelBase : MonoBehaviour
{
public static LevelBase Instance
{
get
{
if (_instance == null)
{
_instance = new LevelBase();
}
return _instance;
}
}
private static LevelBase _instance;
public int curArea = 0;
public int abnormalCount = 0;
[Header("UI")]
public GameObject area;
public GameObject view;
public GameObject showImg;
public GameObject minMap;
public GameObject cameraPanel;
[Header("摄像机")]
public CameraController cameraManager;
public ButtonExtension upBtn;
public ButtonExtension downBtn;
public ButtonExtension leftBtn;
public ButtonExtension rightBtn;
protected virtual void Awake()
{
_instance = this;
cameraManager.Init();
}
protected virtual void Start()
{
upBtn.onPress.AddListener(() => { CameraController.Instance.MoveMainCamera(-Vector3.back); });
downBtn.onPress.AddListener(() => { CameraController.Instance.MoveMainCamera(Vector3.back); });
leftBtn.onPress.AddListener(() => { CameraController.Instance.MoveMainCamera(Vector3.left); });
rightBtn.onPress.AddListener(() => { CameraController.Instance.MoveMainCamera(-Vector3.left); });
}
public virtual void setArea(int index)
{
curArea = index;
}
public virtual void StartGame()
{
area.SetActive(true);
cameraPanel.SetActive(true);
view.SetActive(true);
showImg.SetActive(true);
minMap.SetActive(true);
TaskBase.Instacne.FinishTask(0);
}
}