public void LoadFromSpecifiedFilePath() { _patternLoader = GetComponent <PatternLoader>(); try { Pattern pattern = _patternLoader.LoadPatternFromFile(FilePath); ClearExistingItems(); Bounds.localScale = new Vector3(pattern.Length, Bounds.localScale.y, Bounds.localScale.z); foreach (SpawnEvent spawnEvent in pattern.SpawnEvents) { Transform t = ObjectFactory.Instance.Instantiate(spawnEvent.ObjectName); ParallaxLayer pl = GameObject.Find(spawnEvent.Parent).GetComponent <ParallaxLayer>(); t.SetParent(pl.transform); t.position = new Vector3(AdjustForBounds(spawnEvent.Distance, true), spawnEvent.YPosition + t.parent.position.y); } } catch (Exception e) { Debug.LogError("Failed to load pattern"); Debug.Log(e.Message); } }
private void OnEnable() { instance = this; DontDestroyOnLoad(this); SceneManager.sceneLoaded += CheckLevel; }
// Use this for initialization void Start() { timeMaster = TimeMaster.Instance; debugPanel = DebugPanel.Instance; PatternLoader patternLoader = new PatternLoader(); pattern = patternLoader.loadPattern(GameManager.Instance.currentMidi); Debug.LogFormat("Total scorable {0}", pattern.totalScorable()); comboCalculator.setMaxScore(pattern.totalScorable()); }
void Start() { _patternLoader = GetComponent <PatternLoader>(); LoadPatterns("easy", ref EasyPatterns); LoadPatterns("medium", ref MediumPatterns); LoadPatterns("hard", ref HardPatterns); Debug.Log(EasyPatterns.Count + " easy patterns loaded"); Debug.Log(MediumPatterns.Count + " medium patterns loaded"); Debug.Log(HardPatterns.Count + " hard patterns loaded"); PopulateLevelPool(); }
void Awake() { if (instance == null) { instance = this; } else if (instance != this) { Destroy(gameObject); } if (isPersistant) { DontDestroyOnLoad(gameObject); } }
public void OnEnable() { patternLoader = (PatternLoader)target; }