// Update is called once per frame void Update() { player = (Shape)(GameObject.FindObjectOfType(typeof(Shape))); if (player != null) { LevelNumberScript lvlnumb = (LevelNumberScript)(GameObject.FindObjectOfType(typeof(LevelNumberScript))); if (lvlnumb != null) { stratum = lvlnumb.GetStratum(); } if (InGame == false) { InGame = true; PlayStratum(); } transform.position = new Vector3(player.transform.position.x, player.transform.position.y, -10); gm = (GameManager)(GameObject.FindObjectOfType(typeof(GameManager))); if (gm != null) { if (gm.getMaxTransfo() >= 3) { dangerlimit = gm.getMaxTransfo() / 4; } else { dangerlimit = -1; } if (gm.remainingTransformation < dangerlimit) { if (InDanger == false) { InDanger = true; PlayFirstStratumBeats(); mainSource.Stop(); currenlyStratumMusic = 0; } } else { if (InDanger == true) { InDanger = false; PlayStratum(); secondarySource.Stop(); } } } } else { if (InGame == true) { PlayLogMenu(); InGame = false; secondarySource.Stop(); } } //secondarySource.timeSamples = mainSource.timeSamples; }
void OnLevelWasLoaded(int level) { LevelNumberScript lvlnumb = (LevelNumberScript)(GameObject.FindObjectOfType(typeof(LevelNumberScript))); if (lvlnumb != null) { stratum = lvlnumb.GetStratum(); if (stratum != currenlyStratumMusic) { PlayStratum(); } } //buttons = (Button[])(GameObject.FindObjectsOfType(typeof(Button))); buttons = Resources.FindObjectsOfTypeAll <Button>(); foreach (Button button in buttons) { button.onClick.AddListener(PlayValidation); EventTrigger.Entry entry = new EventTrigger.Entry(); EventTrigger.Entry entrymouse = new EventTrigger.Entry(); entry.eventID = EventTriggerType.Select; entrymouse.eventID = EventTriggerType.PointerEnter; entry.callback.AddListener((eventData) => { PlaySelecting(); }); entrymouse.callback.AddListener((eventData) => { PlaySelecting(); }); EventTrigger trigger = button.gameObject.AddComponent <EventTrigger>(); if (trigger != null) { trigger.triggers.Add(entry); trigger.triggers.Add(entrymouse); } } }
void Awake() { levelSelectorOn = false; if (soundSysManager == null) { soundSysManager = this; DontDestroyOnLoad(gameObject); } else { Destroy(gameObject); } LevelNumberScript lvlnumb = (LevelNumberScript)(GameObject.FindObjectOfType(typeof(LevelNumberScript))); if (lvlnumb != null) { stratum = lvlnumb.GetStratum(); } }