public BackgroundStaticStars(LevelBackground data) { _spriteStars = data.StaticStars; _spritePosition = data.OffsetStaticStars; _scale = data.ScaleBigStars; InitImage(); }
public void Init(LevelBackground background, LevelObstacles obstacles) { _obstacles = obstacles; _background = background; _backgroundStartPosition = _background.transform.position; _obstaclesStartPosition = obstacles.transform.position; }
/// <summary> /// create a new path-finding system that operates on the given level map and given /// threshold for passable blocks in the map. More systems can be created for different /// maps or thresholds. /// </summary> /// <param name="levelBg"></param> /// <param name="passableIntensityThreshold"></param> public PathFindingSystem(LevelBackground levelBg, int passableIntensityThreshold) { this.levelBg = levelBg; var tx = levelBg.Texture; grid = new MyPathNode[tx.Width, tx.Height]; for (int x = 0; x < tx.Width; x++) { for (int y = 0; y < tx.Height; y++) { var col = levelBg.SamplePixel(new Vector2(x, y)); grid[x, y] = new MyPathNode() { IsWall = ((col.R + col.G + col.B) < passableIntensityThreshold), X = x, Y = y, }; } } aStar = new MySolver <MyPathNode, Object>(grid) { IsAllowDiagonals = false }; StartSystemThread(); }
public void SetLevelByIndex(int index) { LevelBackground target = levels[index]; TileMatrix.Use(target); LevelIndex = index; LoadLevel(target); }
public void SpawnBackground() { _background = Instantiate(_levelData.Background); if (_levelData.Obstacles != null) { _obstacles = Instantiate(_levelData.Obstacles); } _backgroundController.Init(_background, _obstacles); _backgroundController.StartMoving(); }
void OnExploding() { Vector2 pos = Target; LevelBackground bg = Level.Current.Background; Vector2 pixPos; pixPos.X = pos.X + RandomMath.RandomBetween(-ExplosionRange, ExplosionRange); pixPos.Y = pos.Y + RandomMath.RandomBetween(-ExplosionRange, ExplosionRange); bg.SetPixel(pixPos, RandomMath.RandomColor()); }
protected override void InitLevel() { base.InitLevel(); // select bitmap bg Background = new LevelBackground("bg2045.png"); Background.TargetSpeed = SCREEN_MOTION_SPEED; Add(Background); Background.Target = PIXIE_STARTING_POS; Background.Position = BG_STARTING_POS; }
protected override void InitLevel() { base.InitLevel(); // select bitmap bg Background = new LevelBackground("quest1.dat"); Background.ForegroundColor = LEVEL_FOREGROUND_COLOR; Background.TargetSpeed = SCREEN_MOTION_SPEED; Add(Background); Background.Target = PIXIE_STARTING_POS; Background.Position = BG_STARTING_POS; }
private void InitializeMap() { if (levels.Count > 0) // sanity. { return; } for (int i = 1; i <= Count; i++) { LevelBackground level = new LevelBackground(i); levels.Add(level); } }
protected override void InitLevel() { base.InitLevel(); // select bitmap bg Background = new LevelBackground("Level1.png"); Background.TargetSpeed = SCREEN_MOTION_SPEED; Add(Background); Background.Target = HERO_STARTING_POS; Background.Position = BG_STARTING_POS; // bitmap for things/items to load ItemsMap = new LevelItemLoader("Level1Items.png"); ItemsMap.AddItems(this, ITEM_BLOCK_COLOR, typeof(Block)); }
void Explode() { Vector2 pos = Target; int posX = (int)Math.Round(pos.X); int posY = (int)Math.Round(pos.Y); LevelBackground bg = Level.Current.Background; Vector2 pixPos; for (int x = posX - ExplosionRange; x <= posX + ExplosionRange; x++) { for (int y = posY - ExplosionRange; y <= posY + ExplosionRange; y++) { pixPos.X = x; pixPos.Y = y; bg.SetPixel(pixPos, RandomMath.RandomColor()); } } }
private void LoadLevel(LevelBackground background) { game.ClearContent(); game.ViewportManager.Clear(); game.AddAndTrack(background); InitializeMarian(); InitializeEffects(); AddAndTrackNpcs(); AddAndTrackItems(); game.AddAndTrack(marian); game.InitializeBase(); LifeManager.Instance.Initialize(); game.AddPersistantContent(); }
public void InfoLevel2Selected() { AudioSource audio = gameObject.GetComponent <AudioSource>(); audio.Play(); StartCoroutine(Wait()); Level.SetActive(false); if (Shaft_with_spokes) { Shaft_with_spokes.SetActive(false); } InfoButton.SetActive(false); Pause_Menu.SetActive(false); PauseButton.SetActive(false); if (InstructionScreen) { InstructionScreen.SetActive(true); ObjectDescription.SetActive(true); LevelBackground.SetActive(false); } }