private void Awake() { player = FindObjectOfType <Player>(); tilesContainer = FindObjectOfType <TilesContainer>(); stateHolder = FindObjectOfType <StateHolder>(); diceUI = FindObjectOfType <DiceUI>(); }
public override void Use() { TilesContainer tilesContainer = FindObjectOfType <TilesContainer>(); List <int> hiddenTileIndexs = new List <int>(); for (int i = 0; i < tilesContainer.currentTileList.Count; i++) { Tile tile = tilesContainer.currentTileList[i]; if (tile.isHidden == true) { hiddenTileIndexs.Add(i); } } ShuffleInts(hiddenTileIndexs); for (int i = 0; i < number; i++) { if (i >= hiddenTileIndexs.Count) { return; } tilesContainer.currentTileList[hiddenTileIndexs[i]].Open(); } }
IEnumerator FadeInTiles(TilesContainer tilesContainer, Player player) { float alpha = 0.3f; while (alpha <= 1f) { for (int i = 0; i < tilesContainer.currentTileList.Count; i++) { if (i == player.currentTileIndex) { continue; } Tile currentTile = tilesContainer.currentTileList[i]; // 임시로 색깔 바꾸기로 만듦. foreach (Transform child in tilesContainer.currentTileList[i].transform) { if (!child.GetComponent <SpriteRenderer>()) { continue; } child.GetComponent <SpriteRenderer>().color = new Color(currentTile.spriteColor, currentTile.spriteColor, currentTile.spriteColor, alpha); } } alpha += Time.deltaTime / timeToFade * 0.7f; yield return(null); } }
private void Awake() { tilesContainer = FindObjectOfType <TilesContainer>(); myRigidbody = GetComponent <Rigidbody2D>(); animator = GetComponent <Animator>(); hp = GetComponent <HP>(); }
public IEnumerator SetLevelToExplorePhase(Ground groundToDestroy, TilesContainer tilesContainer, Player player) { StartCoroutine(FadeOutPlayer(player, groundToDestroy.playerPostion)); yield return(StartCoroutine(FadeOutGroundAndDestroy(groundToDestroy))); yield return(new WaitForSeconds(0.2f)); player.transform.localScale = new Vector2(previousPlayerLocalScaleX, 1f); StartCoroutine(FadeInTiles(tilesContainer, player)); StartCoroutine(FadeOutGroundAndDestroy(groundToDestroy)); yield return(StartCoroutine(FadeInPlayer(player, player.currentTile.transform))); yield return(new WaitForSeconds(0.3f)); }
public IEnumerator SetLevelToEventPhase(Ground groundToInstantiate, TilesContainer tilesContainer, Player player) { StartCoroutine(FadeOutPlayer(player, player.transform)); yield return(StartCoroutine(FadeOutTiles(tilesContainer, player))); yield return(new WaitForSeconds(0.2f)); previousPlayerLocalScaleX = player.transform.localScale.x; player.transform.localScale = new Vector2(1f, 1f); Ground currentTileGround = Instantiate(groundToInstantiate, transform.position, Quaternion.identity); InstantiateObjects(player); StartCoroutine(FadeInGround(currentTileGround)); yield return(StartCoroutine(FadeInPlayer(player, currentTileGround.playerPostion))); yield return(new WaitForSeconds(0.3f)); }
public void Awake() { Instance = this; }
private void Awake() { player = FindObjectOfType <Player>(); tilesContainer = FindObjectOfType <TilesContainer>(); levelDirector = GetComponent <LevelDirector>(); }