示例#1
0
            // Overrides
            public override void OnActivate()
            {
                // Cache
                float differenceY = m_item.transform.position.y - LastCharacter.transform.position.y;
                bool  isStanding  = differenceY >= STANDING_TAKE_MIN_HEIGHT;

                Character.SpellCastType animation = isStanding ? Character.SpellCastType.UseUp : Character.SpellCastType.PickupGround;

                // Execute
                if (!LastCharacter.Sheathed)
                {
                    LastCharacter.SheatheInput();
                }
                this.ExecuteOnceWhen(() => !LastCharacter.Sheathing, () =>
                {
                    // Sending SpellCast message to null to override default behaviour
                    // (will raise a few log messages, but no errors)
                    LastCharacter.CastSpell(animation, (GameObject)null, Character.SpellCastModifier.Immobilized, 1, -1f);
                    this.ExecuteOnceAfterDelay(ANIMATED_TAKE_DELAY, () =>
                    {
                        m_item.SetBeingTaken(true, RightHandTransform);
                        this.ExecuteOnceWhen(() => LastCharacter.CurrentSpellCast == Character.SpellCastType.NONE, () =>
                        {
                            TryTake(m_item, false);
                            base.OnActivate();
                        });
                    });
                });
            }