コード例 #1
0
        public void AnimatedItemWorksProperly()
        {
            var list = new List <AnimatedProperty>
            {
                new AnimatedOpacity
                {
                    From = 0,
                    To   = 1
                }
            };

            var command = new AnimateItem
            {
                Duration    = 1000,
                RepeatCount = 9,
                RepeatMode  = RepeatMode.Reverse,
                Value       = list
            };

            Assert.True(Utility.CompareJson(command, "AnimatedItem.json"));

            var deserial = Utility.ExampleFileContent <AnimateItem>("AnimatedItem.json");
            var property = Assert.Single(deserial.Value.Value);
            var opacity  = Assert.IsType <AnimatedOpacity>(property);

            Assert.Equal(0, opacity.From.Value);
            Assert.Equal(1, opacity.To.Value);
        }
コード例 #2
0
ファイル: PalmCutter.cs プロジェクト: flofe104/SpackJerrow
    private IEnumerator OnDeath()
    {
        ///destroy collider
        GameManager.GetPlayerComponent <Inventory>().AddItem(wood);
        PalmCutter child = null;

        if (transform.childCount > 1)
        {
            Destroy(transform.parent.GetChild(1).gameObject);
            child = transform.GetChild(0).GetComponent <PalmCutter>();
            if (child != null)
            {
                child.Kill(despawnTime + 0.2f);
            }
        }
        yield return(new WaitForSeconds(despawnTime));

        AnimateItem.AnimateContainer(new ItemContainer(wood, 1), GameManager.GetPlayerComponent <MonoBehaviour>(), transform.position);

        if (child != null)
        {
            child.transform.parent = transform.parent;
        }
        Destroy(gameObject);
        //transform.parent = null;
    }
コード例 #3
0
    protected override void OnOpen(GameObject interactor)
    {
        Inventory i = interactor.GetComponent <Inventory>();

        AnimateItem.AnimateItems(items, (int)(transitionSpeed * 0.5f), this);
        i.AddItems(items);
        items.Clear();
    }
コード例 #4
0
ファイル: Events.cs プロジェクト: flofe104/SpackJerrow
    public static void GiveDocument()
    {
        ItemContainer item      = GameManager.GetPlayerComponent <DelayedItem>().itemContainer;
        UiInventory   inventory = GameManager.GetPlayerComponent <UiInventory>();

        inventory.AddItem(item);
        AnimateItem.AnimateItems(new List <ItemContainer>()
        {
            item
        }, 0.2f, inventory);
    }
コード例 #5
0
ファイル: BubuHealth.cs プロジェクト: flofe104/SpackJerrow
    public override void Die()
    {
        GameManager.GetPlayerComponent <UiInventory>().AddItem(schnuckidipuz, 1);
        AnimateItem.AnimateItems(new List <ItemContainer>()
        {
            new ItemContainer()
            {
                item = schnuckidipuz, itemCount = 1
            }
        }, 0, GameManager.GetPlayerComponent <MonoBehaviour>());
        GetComponent <BubuSwordFight>().enabled = false;
        Rigidbody r = GetComponent <Rigidbody>();

        r.isKinematic = false;
        r.AddForce((transform.position - GameManager.Player.transform.position) * knockbackPower, ForceMode.Impulse);
    }
コード例 #6
0
        public void AnimatedItemWorksProperly()
        {
            var list = new List <AnimatedProperty>
            {
                new AnimatedProperty
                {
                    Property = "opacity",
                    From     = 0,
                    To       = 1
                }
            };

            var command = new AnimateItem
            {
                Duration    = 1000,
                RepeatCount = 9,
                RepeatMode  = RepeatMode.Reverse,
                Value       = list
            };

            Assert.True(Utility.CompareJson(command, "AnimatedItem.json"));
        }