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); }
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; }
protected override void OnOpen(GameObject interactor) { Inventory i = interactor.GetComponent <Inventory>(); AnimateItem.AnimateItems(items, (int)(transitionSpeed * 0.5f), this); i.AddItems(items); items.Clear(); }
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); }
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); }
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")); }