コード例 #1
0
    IEnumerator CoFillBucket(PlayerItem other)
    {
        Animator animator = other.GetComponent <Animator>();

        animator.SetTrigger(Animator.StringToHash("dropItemTrigger"));

        yield return(new WaitForSeconds(1));

        waterBucket.SetBucketWater(true);

        Destroy(this);
    }
コード例 #2
0
        public static void UpdateItemSprite(GameUIItemController self, PlayerItem newItem, int itemShift)
        {
            tk2dSprite component   = newItem.GetComponent <tk2dSprite>();
            Type       type        = typeof(GameUIItemController);
            FieldInfo  _cachedItem = type.GetField("m_cachedItem", BindingFlags.NonPublic | BindingFlags.Instance);

            if (newItem != (PlayerItem)_cachedItem.GetValue(self))
            {
                MethodInfo _DoItemCardFlip = type.GetMethod("DoItemCardFlip", BindingFlags.NonPublic | BindingFlags.Instance);
                _DoItemCardFlip.Invoke(self, new object[] { newItem, itemShift });
            }
            MethodInfo _UpdateItemSpriteScale = type.GetMethod("UpdateItemSpriteScale", BindingFlags.NonPublic | BindingFlags.Instance);

            _UpdateItemSpriteScale.Invoke(self, null);
            FieldInfo _deferCurrentItemSwap = type.GetField("m_deferCurrentItemSwap", BindingFlags.NonPublic | BindingFlags.Instance);

            if (!(bool)_deferCurrentItemSwap.GetValue(self))
            {
                if (!self.itemSprite.renderer.enabled)
                {
                    self.ToggleRenderers(true);
                }
                if (self.itemSprite.spriteId != component.spriteId || self.itemSprite.Collection != component.Collection)
                {
                    FieldInfo _outlineSprites = type.GetField("outlineSprites", BindingFlags.NonPublic | BindingFlags.Instance);
                    self.itemSprite.SetSprite(component.Collection, component.spriteId);
                    tk2dSprite[] outlineSprites = ((tk2dSprite[])_outlineSprites.GetValue(self));
                    for (int i = 0; i < outlineSprites.Length; i++)
                    {
                        outlineSprites[i].SetSprite(component.Collection, component.spriteId);
                        SpriteOutlineManager.ForceUpdateOutlineMaterial(outlineSprites[i], component);
                    }
                }
            }
            Vector3   center = self.ItemBoxSprite.GetCenter();
            FieldInfo _isCurrentlyFlipping  = type.GetField("m_isCurrentlyFlipping", BindingFlags.NonPublic | BindingFlags.Instance);
            bool      m_isCurrentlyFlipping = (bool)_isCurrentlyFlipping.GetValue(self);

            self.itemSprite.transform.position = center + self.GetOffsetVectorForItem(newItem, m_isCurrentlyFlipping);
            self.itemSprite.transform.position = self.itemSprite.transform.position.Quantize(self.ItemBoxSprite.PixelsToUnits() * 3f);
            if (newItem.PreventCooldownBar || (!newItem.IsActive && !newItem.IsOnCooldown) || m_isCurrentlyFlipping)
            {
                self.ItemBoxFillSprite.IsVisible = false;
                self.ItemBoxFGSprite.IsVisible   = false;
                self.ItemBoxSprite.SpriteName    = "weapon_box_02";
            }
            else
            {
                self.ItemBoxFillSprite.IsVisible = true;
                self.ItemBoxFGSprite.IsVisible   = true;
                self.ItemBoxSprite.SpriteName    = "weapon_box_02_cd";
            }
            if (newItem.IsActive)
            {
                self.ItemBoxFillSprite.FillAmount = 1f - newItem.ActivePercentage;
            }
            else
            {
                self.ItemBoxFillSprite.FillAmount = 1f - newItem.CooldownPercentage;
            }
            PlayerController user = GameManager.Instance.PrimaryPlayer;

            if (GameManager.Instance.CurrentGameType == GameManager.GameType.COOP_2_PLAYER && self.IsRightAligned)
            {
                user = GameManager.Instance.SecondaryPlayer;
            }
            FieldInfo _itemSpriteMaterial = type.GetField("itemSpriteMaterial", BindingFlags.NonPublic | BindingFlags.Instance);
            Material  itemSpriteMaterial  = (Material)_itemSpriteMaterial.GetValue(self);

            if ((newItem.IsOnCooldown && !(newItem is IncubusStartingActive && ((IncubusStartingActive)newItem).armour > 0)) || !newItem.CanBeUsed(user))
            {
                Color color  = itemSpriteMaterial.GetColor("_OverrideColor");
                Color color2 = new Color(0f, 0f, 0f, 0.8f);
                if (color != color2)
                {
                    itemSpriteMaterial.SetColor("_OverrideColor", color2);
                    tk2dSprite[] array = SpriteOutlineManager.GetOutlineSprites(self.itemSprite);
                    Color        value = new Color(0.4f, 0.4f, 0.4f, 1f);
                    for (int j = 0; j < array.Length; j++)
                    {
                        array[j].renderer.material.SetColor("_OverrideColor", value);
                    }
                }
            }
            else
            {
                Color color3 = itemSpriteMaterial.GetColor("_OverrideColor");
                Color color4 = new Color(0f, 0f, 0f, 0f);
                if (color3 != color4)
                {
                    itemSpriteMaterial.SetColor("_OverrideColor", color4);
                    tk2dSprite[] array2 = SpriteOutlineManager.GetOutlineSprites(self.itemSprite);
                    Color        white  = Color.white;
                    for (int k = 0; k < array2.Length; k++)
                    {
                        array2[k].renderer.material.SetColor("_OverrideColor", white);
                    }
                }
            }
        }