private void SelectMaskAnimation() { // Hide any previous mask SetMaskEnabled(false); this.mapMaskSprites.Clear(); // Different sets of masks and animations exist. For instance, zoom in/out from // the centre, pan down, pan right. int numSets = this.mapMaskSets.Length; int setNum = UnityEngine.Random.Range(0, numSets); GameObject set = this.mapMaskSets[setNum]; this.mapMaskSet = set; // Recolor the sprites and put them in a list to trigger their animations. LevelTheme theme = this.gameManager.Theme; UISprite[] maskSprites = set.GetComponentsInChildren <UISprite>(true); foreach (UISprite mask in maskSprites) { mask.color = theme.BackgroundColour; this.mapMaskSprites.Add(mask); TweenColor colourTween = mask.GetComponent <TweenColor>(); if (colourTween != null) { colourTween.Recolour(theme.BackgroundColour); } } // Set the new mask to be displayed SetMaskEnabled(true); }
// Başlangıçta çalışacak blok void Start() { //Tüm değişkenleri atama ve temayı temel alan sprite atamak için atama işlevini çağırmak if (GameObject.FindObjectOfType <ScoreHolder> ()) { scoreHolder = GameObject.FindObjectOfType <ScoreHolder> ().gameObject; } else { Debug.LogWarning("Score Holder Not found"); } if (GameObject.FindObjectOfType <LevelTheme> ()) { myTheame = GameObject.FindObjectOfType <LevelTheme> (); AssignGraphic(); } else { Debug.LogWarning("LevelTheme Not found"); } if (Camera.main.GetComponent <AudioSource> ()) { myAudio = Camera.main.GetComponent <AudioSource> (); } }
public void LoadTheme(int levelNum) { UnityEngine.Object prefab = Resources.Load("theme" + levelNum.ToString()); GameObject obj = Instantiate(prefab) as GameObject; this.theme = obj.GetComponent <LevelTheme>(); }
private void GetNextLevelTheme() { var previousLevelTheme = currentLevelTheme; var newLevelTheme = currentLevelTheme; while (previousLevelTheme == newLevelTheme) { newLevelTheme = GetRandomLevelTheme(); } currentLevelTheme = newLevelTheme; }
private void Awake() { if (pathfinder == null) { pathfinder = gameObject.AddComponent <Pathfinder>(); } if (theme == null) { theme = Resources.Load <LevelTheme>("LevelThemes/DefaultTheme"); } numberOfLanes = theme.lanes.Count; }
public override int GetHashCode() { int hash = 1; if (LevelId != 0) { hash ^= LevelId.GetHashCode(); } if (LevelType != 0) { hash ^= LevelType.GetHashCode(); } if (LevelName.Length != 0) { hash ^= LevelName.GetHashCode(); } if (LevelTheme.Length != 0) { hash ^= LevelTheme.GetHashCode(); } if (LevelPicture != 0) { hash ^= LevelPicture.GetHashCode(); } if (LevelUnlock != 0) { hash ^= LevelUnlock.GetHashCode(); } if (Rating1 != 0) { hash ^= Rating1.GetHashCode(); } hash ^= rating2_.GetHashCode(); hash ^= rating3_.GetHashCode(); hash ^= levelPixel_.GetHashCode(); if (AdPuzzle != 0) { hash ^= AdPuzzle.GetHashCode(); } if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
private void SetLevelTheme(LevelTheme theme) { selectedLevelTheme = theme; switch (selectedLevelTheme) { case LevelTheme.GRASS: levelGridBackground.BackgroundImage = Properties.Resources.editor_background_grass; selectedThemePreview.Image = Properties.Resources.theme_preview_grass; break; case LevelTheme.DESERT: levelGridBackground.BackgroundImage = Properties.Resources.editor_background_desert; selectedThemePreview.Image = Properties.Resources.theme_preview_desert; break; case LevelTheme.ICE: levelGridBackground.BackgroundImage = Properties.Resources.editor_background_arctic; selectedThemePreview.Image = Properties.Resources.theme_preview_ice; break; } }
public static LevelColor FromTheme(LevelTheme levelTheme) { LevelColor level; switch (levelTheme) { case LevelTheme.Default: level = new LevelColor(); break; case LevelTheme.Rust: level = new LevelColor { Color1 = Coral, Color2 = Sienna, ColorMixed = Brown }; break; case LevelTheme.Winter: level = new LevelColor { Color1 = CornflowerBlue, Color2 = SpringGreen, ColorMixed = HotPink }; break; case LevelTheme.Mixed: level = new LevelColor(Yellow, DodgerBlue); break; default: level = new LevelColor(); break; } return(level); }
private void ConfigureUI() { LevelTheme theme = this.gameManager.Theme; // Set initial colours foreach (UILabel label in this.labels) { label.color = theme.UIColour; } foreach (UISprite sprite in this.sprites) { sprite.color = theme.UIColour; } foreach (UIButton button in this.buttons) { button.defaultColor = theme.UIColour; button.pressed = theme.PressedButtonColour; // This hover colour really only matters for testing, but it's annoying for it not to be set. button.hover = theme.UIColour; } this.sceneCamera.backgroundColor = theme.BackgroundColour; }
// public int Score // { // get // { // return score; // } // set // { // score = value; // ScoreUpdatedEventArgs args = new ScoreUpdatedEventArgs(); // args.score = value; // OnScoreUpdated(args); // } // } // public event EventHandler<ScoreUpdatedEventArgs> scoreUpdated; public void Awake() { currentLevelTheme = GetRandomLevelTheme(); }
public void LoadLevel(LevelsCollection.Level levelData, List <LevelObject> levelEntities, LevelTheme theme) { Vector2Int max = new Vector2Int(levelData.gridSizeX, levelData.gridSizeY); for (int x = -1; x <= max.x + 2; x++) { for (int y = -1; y <= max.y + 2; y++) { Map.SetTile(new Vector3Int(x, y, 0), theme.Hole); } } for (int x = 0; x <= max.x; x++) { for (int y = 0; y <= max.y; y++) { Map.SetTile(new Vector3Int(x, y, 0), theme.Ground); } } foreach (var item in levelEntities) { switch (item.LevelObjectType) { //case ELevelObjectType.NONE: // break; case ELevelObjectType.WALL: Map.SetTile(new Vector3Int(item.Position.x, levelData.gridSizeY - item.Position.y, 0), theme.Wall); break; case ELevelObjectType.HOLE: Map.SetTile(new Vector3Int(item.Position.x, levelData.gridSizeY - item.Position.y, 0), theme.Hole); break; } } //Map.transform.position = new Vector3 (); //var center = Map.GetCellCenterWorld ( new Vector3Int ( max.x / 2, max.y / 2, 0 ) ); //Map.transform.position = -center; }