Ejemplo n.º 1
0
    public static Sprite AddTypeSprite(Types.TileType tileType)
    {
        Sprite newSprite;

        tileTypesDictionary.TryGetValue(tileType, out newSprite);
        return(newSprite);
    }
Ejemplo n.º 2
0
    private void Awake()
    {
        tileTypesDictionary = new Dictionary <Types.TileType, Sprite>
        {
            { Types.TileType.BLUE, possibleSprites[(int)Types.TileType.BLUE] },
            { Types.TileType.GREEN, possibleSprites[(int)Types.TileType.GREEN] },
            { Types.TileType.RED, possibleSprites[(int)Types.TileType.RED] },
            { Types.TileType.PINK, possibleSprites[(int)Types.TileType.PINK] },
            { Types.TileType.ORANGE, possibleSprites[(int)Types.TileType.ORANGE] },
            { Types.TileType.PURPLE, possibleSprites[(int)Types.TileType.PURPLE] },
            { Types.TileType.YELLOW, possibleSprites[(int)Types.TileType.YELLOW] },
            { Types.TileType.DARKGREEN, possibleSprites[(int)Types.TileType.DARKGREEN] },
            { Types.TileType.BROWN, possibleSprites[(int)Types.TileType.BROWN] },
        };

        previousType = Types.TileType.BLUE;
    }
Ejemplo n.º 3
0
    public static Types.TileType RandomizeTileType()
    {
        if (!newColor)
        {
            float randomizedType = Random.Range(0, GameManager.ColorsCount);

            while ((Types.TileType)randomizedType == previousType)
            {
                randomizedType = Random.Range(0, GameManager.ColorsCount);
            }

            previousType = (Types.TileType)randomizedType;
            return((Types.TileType)randomizedType);;
        }
        else
        {
            newColor = false;
            return((Types.TileType)GameManager.ColorsCount - 1);
        }
    }
Ejemplo n.º 4
0
 public void Initialize()
 {
     tileType   = TilesManager.RandomizeTileType();
     tileSprite = TilesManager.AddTypeSprite(tileType);
     GetComponent <SpriteRenderer>().sprite = tileSprite;
 }