public void UpdateButton(FloatingButton button, int levelID) { if (levelID < 0) { levelID = levels.Count - levelID; } levelID %= levels.Count; Material material = levelMaterials[levelID]; button.TextureScale = new Vector2( Mathf.Sign(material.mainTextureScale.x), Mathf.Sign(material.mainTextureScale.y) ); button.GetComponent <MeshRenderer>().sharedMaterial = material; button.OnClick.RemoveAllListeners(); button.OnClick.AddListener(delegate() { if (switching != Switch.None) { return; } switching = Switch.Level; SetButtonPhysics(false); HoloFEZPlayer.Instance.SelectLevel(levels[levelID], delegate() { SetButtonPhysics(true); }); }); }
public void SetButtonPhysics(bool enabled) { for (int i = 0; i < buttons.Length; i++) { FloatingButton button = buttons[i]; if (button == null) { continue; } button.GetComponent <Collider>().enabled = enabled; } }