125 lines
2.5 KiB
C#
125 lines
2.5 KiB
C#
|
|
using System;
|
||
|
|
using System.Collections;
|
||
|
|
using System.Collections.Generic;
|
||
|
|
using System.Threading;
|
||
|
|
using UnityEditor;
|
||
|
|
using UnityEngine;
|
||
|
|
using UnityEngine.SceneManagement;
|
||
|
|
using UnityEngine.UI;
|
||
|
|
|
||
|
|
public class LevelButtons : MonoBehaviour
|
||
|
|
{
|
||
|
|
private string LoadedScene;
|
||
|
|
public GameObject BButton;
|
||
|
|
public GameObject NButton;
|
||
|
|
public GameObject Islands;
|
||
|
|
public int Isl = 0;
|
||
|
|
public int MaxIsl ;
|
||
|
|
public GameObject SetMove;
|
||
|
|
public GameObject SetMovet;
|
||
|
|
public GameObject[] Island;
|
||
|
|
public TransferScript ts;
|
||
|
|
|
||
|
|
public void FixedUpdate()
|
||
|
|
{
|
||
|
|
|
||
|
|
|
||
|
|
if (Isl == 0)
|
||
|
|
{
|
||
|
|
BButton.SetActive(false);
|
||
|
|
NButton.SetActive(true);
|
||
|
|
} else if (Isl == MaxIsl)
|
||
|
|
{
|
||
|
|
BButton.SetActive(true);
|
||
|
|
NButton.SetActive(false);
|
||
|
|
}
|
||
|
|
else
|
||
|
|
{
|
||
|
|
BButton.SetActive(true);
|
||
|
|
NButton.SetActive(true);
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
private void CheckIsland()
|
||
|
|
{
|
||
|
|
for (int Check = 0; Check < Island.Length; Check++)
|
||
|
|
{
|
||
|
|
if (Check == Isl)
|
||
|
|
{
|
||
|
|
Island[Check].SetActive(true);
|
||
|
|
}
|
||
|
|
else
|
||
|
|
{
|
||
|
|
Island[Check].SetActive(false);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
public void NextIsland()
|
||
|
|
{
|
||
|
|
Isl++;
|
||
|
|
CheckIsland();
|
||
|
|
Debug.Log("i");
|
||
|
|
}
|
||
|
|
|
||
|
|
public void BackIsland()
|
||
|
|
{
|
||
|
|
Isl--;
|
||
|
|
CheckIsland();
|
||
|
|
}
|
||
|
|
|
||
|
|
public void OpenWorld()
|
||
|
|
{
|
||
|
|
End("OpenWorld");
|
||
|
|
}
|
||
|
|
|
||
|
|
public void OpenLvl(int LevelNum)
|
||
|
|
{
|
||
|
|
ts.string1 = LevelNum.ToString();
|
||
|
|
ts.bool1 = true;
|
||
|
|
DontDestroyOnLoad(ts.gameObject);
|
||
|
|
End("ImportLeverl");
|
||
|
|
//End(LevelNum+1);
|
||
|
|
}
|
||
|
|
|
||
|
|
public void temple()
|
||
|
|
{
|
||
|
|
End("Temple");
|
||
|
|
}
|
||
|
|
|
||
|
|
public void QL1()
|
||
|
|
{
|
||
|
|
End("SandQuest");
|
||
|
|
}
|
||
|
|
|
||
|
|
public void QL2()
|
||
|
|
{
|
||
|
|
End("FoodQuest");
|
||
|
|
}
|
||
|
|
|
||
|
|
public void BackLLast()
|
||
|
|
{
|
||
|
|
PlayerPrefs.SetInt("LevelCoplete", 10);
|
||
|
|
}
|
||
|
|
public void End(object S)
|
||
|
|
{
|
||
|
|
GameObject.FindGameObjectWithTag("Transition").GetComponent<Animator>().SetTrigger("End");
|
||
|
|
LoadedScene = S.ToString();
|
||
|
|
Invoke("loadS", 0.75f);
|
||
|
|
}
|
||
|
|
public void loadS()
|
||
|
|
{
|
||
|
|
try
|
||
|
|
{
|
||
|
|
int L = int.Parse(LoadedScene);
|
||
|
|
SceneManager.LoadScene(L);
|
||
|
|
}
|
||
|
|
catch
|
||
|
|
{
|
||
|
|
SceneManager.LoadScene(LoadedScene);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|