void Setup(Chest chest)
            {
                lastChest = chest;
                var type = chest.ChestType;

                int spriteID;
                int chestID = ChestHasBeenFound(chest);

                if (chestID >= 0)
                {
                    spriteID = foundChests[chestID].Second;
                }
                else
                {
                    spriteID = ChooseID(type);
                    foundChests.Add(new Tuple <Chest, int>(chest, spriteID));
                }

                if (collection == null || !collection.IsValidSpriteId(spriteID))
                {
                    BuildCollection();
                }
                textSprite.SetSprite(collection, spriteID);
                textSprite.scale = baseScale;
                basePos          = chest.sprite.WorldTopCenter + new Vector2(0, .25f);
                textSprite.PlaceAtLocalPositionByAnchor(basePos, tk2dBaseSprite.Anchor.LowerCenter);

                textSprite.scale        = Vector2.zero;
                textSprite.SortingOrder = 100;
                SpriteOutlineManager.AddOutlineToSprite <tk2dSprite>(textSprite.sprite, new Color(.8f, 0, .5f), 0.4f, 0f);
            }
예제 #2
0
    void OnValidate()
    {
        if (scd == null || !scd.IsValidSpriteId(spriteIndex))
        {
            return;
        }

        Debug.Log("valid");

        var    sprtk = scd.spriteDefinitions[spriteIndex];
        var    tex   = scd.textures[0];
        Sprite spr   = Sprite.Create(tex as Texture2D, new Rect(0, 0, tex.width, tex.height), Vector2.zero);
    }