void Start() { if (path.Count == 0) { Debug.Log("safety", "ActionPath at " + transform.position + " has less than 2 positions."); Destroy(this.gameObject); } }
public bool BuildCheck() { if (path.Count == 0) { Debug.Log("safety", "ActionPath at " + transform.position + " is invalid."); return(false); } return(true); }
string GetInputOrFail(Dictionary <string, string> type, string input) { try { return(GetKey(type, input)); } catch (System.ArgumentException e) { Debug.Log("input", e.Message); return(null); } }
//JSON load stuff private bool loadListFromFile(string filePath) { if (!System.IO.File.Exists(Application.dataPath + filePath)) { Debug.Log("input", "File does not exist: " + Application.dataPath + filePath); return(false); } string json = System.IO.File.ReadAllText(Application.dataPath + filePath); string platform = Application.platform.ToString(); return(loadListFromJson(json, platform)); }
void Awake() { if (!loadListFromFile(StringManager.INPUTKEYS)) { Debug.Log("input", "JSON file did not load"); //return false; } else { Debug.Log("input", "JSON file loaded"); //return true; } }
// Currently only loads input from JSON file at /Resources/inputManager.json // TODO add check for custom input file, load from that if exists private bool loadListFromJson(string json, string platform) { JSONClass inputs = JSON.Parse(json) as JSONClass; if (inputs == null) { Debug.Log("input", "Json file is empty"); return(false); } JSONClass cont = inputs["Keyboard"] as JSONClass; for (int i = 0; i < cont.Count; i++) { keyButtons.Add(cont.Key(i), cont[i].Value); } cont = inputs ["Controller"]["XboxOne"] as JSONClass; for (int i = 0; i < cont.Count; i++) { controllerButtons.Add(cont.Key(i), cont[i].Value); } return(true); }
IEnumerator COLoadLevel(string levelName, bool additive = true) { if (!scenes.Contains(levelName)) { Debug.Log("core", "No scenes to be loaded. Please ensure valid scenes are ready to be loaded in Assets/Resources/Json/sceneList.json"); } else { if (additive) { Application.LoadLevelAdditiveAsync(levelName); } else { Application.LoadLevelAsync(levelName); } yield return(new WaitForEndOfFrame()); ObjectManager.LoadTopObjects(); Debug.Log("core", "Level " + levelName + " loaded\nAdditive = " + additive + "."); } }
private void LoadScenesDictionary() { try{ TextAsset textAsset = Resources.Load(StringManager.SCENELIST) as TextAsset; string text = textAsset.ToString(); if (text == "") { Debug.Warning("core", "SceneList empty"); } else { JSONNode N = JSON.Parse(text); scenes.Clear(); for (int i = 0; i < N.Count; i++) { scenes.Add(N[i].Value); } Debug.Log("core", "Scenes dictionary loaded."); } }catch (NullReferenceException e) { Debug.Error("core", "SceneList missing: " + e); } }