public virtual void Awake() { _inventory = GetComponent <InventoryController>(); _placer = GetComponent <TilePlacer>(); //load(); }
/* Здесь такое вроде не нужно будет * public void SetOnClickListener(Predicate<string> onClickAction) * { * button.onClick.AddListener(delegate { onClickAction(inputField.text); }); * } */ public void ShowDialog(string[] elements, string buttonText = "Ok") { TileEditor te = GameObject.FindObjectOfType <TileEditor>(); if (te != null) { te.SetDefault(); } TilePlacer tp = GameObject.FindObjectOfType <TilePlacer>(); if (tp != null) { tp.CancelPlacing(); } dialogCanvas.SetActive(true); scrollRect.content.sizeDelta = new Vector2(0, 17 * elements.Length); contentText.rectTransform.sizeDelta = new Vector2(160 * 4, 16 * 5 * elements.Length); contentText.text = ""; foreach (string elem in elements) { contentText.text += elem + "\n"; } button.GetComponentInChildren <Text>().text = buttonText; }
private void Start() { if (tilePlacer == null) { tilePlacer = GetComponentInChildren <TilePlacer>(); } tilePlacer.roadSize = trackSize; if (IsFinite) { tilePlacer.GenerateFiniteTrack(tilePlacer.roadSize); } else { tilePlacer.SetupInfiniteGeneration(ScrollOverNextTiles, true, true, false); } for (int i = 0; i < tilePlacer.spawnedTiles.Length; i++) { curveTracker.AddCurve(ref progress, tilePlacer.spawnedTiles[i].progressCurve); } tilePlacer.isSetup = true; vehicle.transform.position = curveTracker.GetPoint(0f); vehicle.transform.forward = curveTracker.GetOrientedPoint(0f).forward; vehicle.transform.position += vehicle.transform.forward * 3f; vehicle.transform.position += vehicle.transform.up * 1f; }
// Blooms are great for making irregular, but roundish shapes like bodies of water public void BlockingExplosion(int x, int y, int level, TilePlacer spritePlacer) { if (Random.Range (0, level) < 1 || x < 0 || y < 0 || x >= this.width || y >= this.height) { return; } Tile tile = this.tileMap[x, y]; if (tile.biome != this.getBiomeNumber() || tile.blocking || tile.path) { return; } if (tile.item == null) { tile.blocking = true; spritePlacer(x, y); } for (int i = -1; i <= 1; i++) { for (int j = -1; j <= 1; j++) { if (Random.Range(0, 10) > 3 && (j != 0 || i == 1)) { BlockingExplosion(x + i, y + j, level - 1, spritePlacer); } } } }
// Blooms are great for making irregular, but roundish shapes like bodies of water public void BlockingExplosion(int x, int y, int level, TilePlacer spritePlacer) { if (Random.Range(0, level) < 1 || x < 0 || y < 0 || x >= this.width || y >= this.height) { return; } Tile tile = this.tileMap[x, y]; if (tile.biome != this.getBiomeNumber() || tile.blocking || tile.path) { return; } if (tile.item == null) { tile.blocking = true; spritePlacer(x, y); } for (int i = -1; i <= 1; i++) { for (int j = -1; j <= 1; j++) { if (Random.Range(0, 10) > 3 && (j != 0 || i == 1)) { BlockingExplosion(x + i, y + j, level - 1, spritePlacer); } } } }
void Awake() { EventManager.AddListener <KeyPressedEvent>(OnKeyPressed); tilePlacer = FindObjectOfType <TilePlacer>(); tileSwapper = FindObjectOfType <TileSwapper>(); uiRelatedStuff = FindObjectOfType <UIRelatedStuff>(); }
void Start() { _tilePlacer = FindObjectOfType <TilePlacer>(); ChangeLayer(1); SelectTile(1); UpdateTileRowPositions(); }
private void FindObjectReferences() { tilePlacer = FindObjectOfType <TilePlacer>(); gameMode = FindObjectOfType <GameMode>(); foreGroundTilemap = GameObject.FindGameObjectWithTag("Drawing Tilemap").GetComponent <Collider2D>(); levelLoader = FindObjectOfType <LevelLoader>(); stars = GameObject.FindGameObjectsWithTag("Star"); movingPlatforms = GameObject.FindObjectsOfType <MovingPlatform>(); }
void Awake() { tilePlacer = FindObjectOfType <TilePlacer>(); levelLoader = FindObjectOfType <LevelLoader>(); if (!levelLoader.isFromLevelLoader) { isBlank = true; } }
void Start() { mp = GetComponent<MarkerPlacer> (); tp = GetComponent<TilePlacer> (); am = GetComponent<AssetManager>(); mp.enabled = false; tp.enabled = true; tp.SetCurrentTile("com.antimatterinc.darkxtiles.default:default_floor"); }
// Perlin is faster than blooms and creates a maze-like structure, which is great for forests // blockingRatio: float between 0f and 1f; 1f is no blocking and 0f is all blocking // blockingSize: how large thick the walls of the maze are, recommended .2f public void PerlinGenerator(List <Tile> tiles, TilePlacer spritePlacer, float blockingRatio, float blockingSize) { foreach (Tile tile in tiles) { float noise = Mathf.PerlinNoise((float)tile.x * blockingSize, (float)tile.y * blockingSize); if (noise > blockingRatio && !tile.path && tile.item == null) { tile.blocking = true; spritePlacer(tile.x, tile.y); } } }
void Awake() { tilePlacer = FindObjectOfType <TilePlacer>(); levelLoader = FindObjectOfType <LevelLoader>(); uiRelatedStuff = FindObjectOfType <UIRelatedStuff>(); backdrop = GameObject.Find("Backdrop"); tileSize = 5; xTiles = yTiles = 0; eventSystem.firstSelectedGameObject = xTilesIF.gameObject; }
void Start() { Input.simulateMouseWithTouches = false; tilePlacer = FindObjectOfType <TilePlacer>(); vCam = GetComponent <CinemachineVirtualCamera>(); confiner = GetComponent <CinemachineConfiner>(); maxSize = Mathf.Min(confiner.m_BoundingShape2D.bounds.extents.y, confiner.m_BoundingShape2D.bounds.extents.x * (1 / Camera.main.aspect)) * 0.99f; if (vCam != null && confiner != null) { cameraInitialSize = vCam.m_Lens.OrthographicSize; CalcCameraLimits(); } }
public UIInputBox(Vector2 position) { TileEditor te = GameObject.FindObjectOfType <TileEditor>(); te.SetDefault(); TilePlacer tp = GameObject.FindObjectOfType <TilePlacer>(); tp.CancelPlacing(); dialogCanvas = GameObject.Instantiate(Resources.Load("Prefabs/InputBoxPrefab")) as GameObject; dialogCanvas.transform.position = new Vector3(position.x, position.y, 0); button = dialogCanvas.GetComponentInChildren <Button>(); inputField = dialogCanvas.GetComponentInChildren <InputField>(); title = dialogCanvas.GetComponentInChildren <Text>(); HideDialog(); }
public void ShowDialog() { TileEditor te = GameObject.FindObjectOfType <TileEditor>(); te.SetDefault(); TilePlacer tp = GameObject.FindObjectOfType <TilePlacer>(); tp.CancelPlacing(); List <string> fileNames = GetFilesList(); dialogCanvas.SetActive(true); for (int i = 0; i < fileNames.Count; i++) { if (!buttons.ContainsKey(fileNames[i])) { GameObject newButton = GameObject.Instantiate(Resources.Load("Prefabs/ButtonPrefab")) as GameObject; newButton.transform.position = contentField.transform.position; newButton.transform.position += new Vector3(0.06f, -i * 0.55f - 0.06f, 0); newButton.GetComponent <RectTransform>().SetParent(contentField.transform); newButton.GetComponent <RectTransform>().localScale = new Vector3(1, 1, 1); newButton.GetComponentInChildren <Text>().text = fileNames[i]; newButton.GetComponent <Button>().onClick.AddListener(delegate { ChooseLevelTask(newButton.GetComponentInChildren <Text>().text); }); buttons.Add(fileNames[i], newButton); } } scrollRect.content.sizeDelta = new Vector2(0, (float)Math.Max(25 * fileNames.Count, 100.1)); cancelButton.GetComponentInChildren <Text>().text = "Отмена"; cancelButton.onClick.AddListener(CancelTask); }
// Perlin is faster than blooms and creates a maze-like structure, which is great for forests // blockingRatio: float between 0f and 1f; 1f is no blocking and 0f is all blocking // blockingSize: how large thick the walls of the maze are, recommended .2f public void PerlinGenerator(List<Tile> tiles, TilePlacer spritePlacer, float blockingRatio, float blockingSize) { foreach (Tile tile in tiles) { float noise = Mathf.PerlinNoise((float)tile.x * blockingSize, (float)tile.y * blockingSize); if (noise > blockingRatio && !tile.path && tile.item == null) { tile.blocking = true; spritePlacer(tile.x, tile.y); } } }
void Awake() { tileSwapper = FindObjectOfType <TileSwapper>(); tilePlacer = FindObjectOfType <TilePlacer>(); }
// Use this for initialization void Start() { regions = new MapRegions(); renderer = GetComponent <SpriteRenderer>(); tilePlacer = FindObjectOfType <TilePlacer>(); }
// Use this for initialization void Start() { cameraPos = transform.position; cameraHeightCurrent = Camera.main.orthographicSize; tilePlacer = FindObjectOfType <TilePlacer>(); }
void Awake() { placer = this; }
void Start() { uiRelatedStuff = FindObjectOfType <UIRelatedStuff>(); cameraBehaviour = FindObjectOfType <CameraBehaviour>(); tilePlacer = FindObjectOfType <TilePlacer>(); }
void Start() { tilePlacer = FindObjectOfType <TilePlacer>(); isBlank = true; }
void Awake() { instance = this; }