Example #1
0
        public override void OnInspectorGUI()
        {
            AnimatedEffect animatedEffect = target as AnimatedEffect;

            animatedEffect.InitReference();
            base.OnInspectorGUI();
        }
Example #2
0
    public void SetTargetEffect(FormationUnit performer, string effect, string fxTarget, string subEffect)
    {
        if (effect != null)
        {
            GameObject animationObject    = null;
            var        exclusiveAnimation = performer.unitAnimator.Effects.Find(animation => animation.name == effect);

            if (exclusiveAnimation != null)
            {
                animationObject = exclusiveAnimation.gameObject;
            }
            else
            {
                animationObject = Resources.Load <GameObject>("Prefabs/Effects/" + effect);
            }

            if (animationObject != null)
            {
                AnimatedEffect animation = Instantiate(animationObject).GetComponent <AnimatedEffect>();
                if (animation != null)
                {
                    animation.skeletonAnimation.MeshRenderer.sortingOrder = CurrentState.MeshRenderer.sortingOrder + 1;
                    animation.skeletonAnimation.Reset();
                    animation.BindToTarget(this, CurrentState, fxTarget);
                    animation.skeletonAnimation.state.SetAnimation(0, subEffect, false);
                    animation.gameObject.layer = CurrentState.gameObject.layer;
                }
            }
        }
    }
Example #3
0
    public void SetCaptureEffect(FormationUnit performer)
    {
        GameObject animationObject    = null;
        var        exclusiveAnimation = performer.unitAnimator.Effects.Find(animation => animation.name == "capture_target");

        if (exclusiveAnimation != null)
        {
            animationObject = exclusiveAnimation.gameObject;
        }

        if (animationObject != null)
        {
            AnimatedEffect animation = Instantiate(animationObject).GetComponent <AnimatedEffect>();
            if (animation != null)
            {
                animation.IsLooping = true;
                animation.skeletonAnimation.MeshRenderer.sortingOrder = CurrentState.MeshRenderer.sortingOrder + 1;
                animation.BindToTarget(this, CurrentState, "fxskill");
                animation.gameObject.layer = CurrentState.gameObject.layer;
                animation.skeletonAnimation.Reset();
                animation.skeletonAnimation.state.SetAnimation(0, "capture_target_fade_in", false);
                animation.skeletonAnimation.state.AddAnimation(0, "capture_target_loop", true, 0.667f);
            }
        }
    }
Example #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MagicEffectNotification"/> class.
 /// </summary>
 /// <param name="spectators">The set of players that spectated the magic effect.</param>
 /// <param name="location">The location of the animated text.</param>
 /// <param name="effect">The effect.</param>
 public MagicEffectNotification(
     IEnumerable <IPlayer> spectators,
     Location location,
     AnimatedEffect effect = AnimatedEffect.None)
     : base(spectators)
 {
     this.Location = location;
     this.Effect   = effect;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="MagicEffectNotification"/> class.
 /// </summary>
 /// <param name="findTargetPlayers">A function to determine the target players of this notification.</param>
 /// <param name="location">The location of the animated text.</param>
 /// <param name="effect">The effect.</param>
 public MagicEffectNotification(
     Func <IEnumerable <IPlayer> > findTargetPlayers,
     Location location,
     AnimatedEffect effect = AnimatedEffect.None)
     : base(findTargetPlayers)
 {
     this.Location = location;
     this.Effect   = effect;
 }
Example #6
0
        /// <summary>
        /// Initializes a new instance of the <see cref="AnimatedEffectNotificationArguments"/> class.
        /// </summary>
        /// <param name="location">The location of the animated text.</param>
        /// <param name="effect">The effect.</param>
        public AnimatedEffectNotificationArguments(Location location, AnimatedEffect effect = AnimatedEffect.None)
        {
            if (effect == AnimatedEffect.None)
            {
                throw new ArgumentException($"Invalid value for effect parameter: {effect}.", nameof(effect));
            }

            this.Location = location;
            this.Effect   = effect;
        }
Example #7
0
    public void SetHalo(string haloAnimation)
    {
        if (Character.DisplayModifier != null && Character.DisplayModifier.DisableHalos)
        {
            return;
        }

        if (CurrentHalo == null)
        {
            GameObject animationObject = Resources.Load <GameObject>("Prefabs/Effects/halo");
            if (animationObject != null)
            {
                AnimatedEffect animation = Instantiate(animationObject).GetComponent <AnimatedEffect>();
                animation.skeletonAnimation.Reset();
                animation.BindToTarget(this, CurrentState, "fxhead");
                animation.IsLooping = true;
                CurrentHalo         = animation;
            }
            else
            {
                return;
            }
        }

        CurrentHalo.gameObject.SetActive(true);
        CurrentHalo.BindToTarget(this, CurrentState, "fxhead");
        CurrentHalo.skeletonAnimation.MeshRenderer.sortingOrder = CurrentState.MeshRenderer.sortingOrder + 1;
        CurrentHalo.gameObject.layer = CurrentState.gameObject.layer;

        switch (haloAnimation)
        {
        case "stunned":
            CurrentHalo.skeletonAnimation.state.SetAnimation(0, haloAnimation, false);
            CurrentHalo.skeletonAnimation.state.AddAnimation(0, "stun_loop", true, 1.7f);
            break;

        case "surprised":
            CurrentHalo.skeletonAnimation.state.SetAnimation(0, "surprised_hero", false);
            CurrentHalo.skeletonAnimation.state.AddAnimation(0, "surprise_loop", true, 1.7f);
            break;

        default:
            CurrentHalo.skeletonAnimation.state.SetAnimation(0, haloAnimation, false);
            if (Character.GetStatusEffect(StatusType.Stun).IsApplied)
            {
                CurrentHalo.skeletonAnimation.state.AddAnimation(0, "stun_loop", true, 1.7f);
            }
            else if (CombatInfo.IsSurprised)
            {
                CurrentHalo.skeletonAnimation.state.AddAnimation(0, "surprise_loop", true, 1.7f);
            }
            break;
        }
    }
Example #8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PlayerLoginNotification"/> class.
 /// </summary>
 /// <param name="player">The player that was logged in.</param>
 /// <param name="atLocation">The location to which the creature is being added.</param>
 /// <param name="descriptionTiles">The map tiles that are being sent as part of the description.</param>
 /// <param name="addEffect">Optional. An effect to add when removing the creature.</param>
 public PlayerLoginNotification(
     IPlayer player,
     Location atLocation,
     IEnumerable <ITile> descriptionTiles,
     AnimatedEffect addEffect = AnimatedEffect.None)
     : base(player.YieldSingleItem())
 {
     this.DescriptionTiles = descriptionTiles;
     this.Player           = player;
     this.AtLocation       = atLocation;
     this.AddEffect        = addEffect;
 }
Example #9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CreatureAddedNotification"/> class.
 /// </summary>
 /// <param name="spectators">The set of players that spectated the creature being added.</param>
 /// <param name="addedCreature">The creature being added.</param>
 /// <param name="atLocation">The location to which the creature is being added.</param>
 /// <param name="atIndex">The index (or position in the stack) at which the creature is being added.</param>
 /// <param name="addEffect">Optional. An effect to add when removing the creature.</param>
 public CreatureAddedNotification(
     IEnumerable <IPlayer> spectators,
     ICreature addedCreature,
     Location atLocation,
     byte atIndex,
     AnimatedEffect addEffect = AnimatedEffect.None)
     : base(spectators)
 {
     this.Creature        = addedCreature;
     this.AtLocation      = atLocation;
     this.AtStackPosition = atIndex;
     this.AddEffect       = addEffect;
 }
Example #10
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MagicEffectNotification"/> class.
        /// </summary>
        /// <param name="findTargetPlayers">A function to determine the target players of this notification.</param>
        /// <param name="location">The location of the animated text.</param>
        /// <param name="effect">The effect.</param>
        public MagicEffectNotification(
            Func <IEnumerable <IPlayer> > findTargetPlayers,
            Location location,
            AnimatedEffect effect = AnimatedEffect.None)
            : base(findTargetPlayers)
        {
            if (effect == AnimatedEffect.None)
            {
                throw new ArgumentException($"Invalid value for effect parameter: {effect}.", nameof(effect));
            }

            this.Location = location;
            this.Effect   = effect;
        }
Example #11
0
    public void SetTargetItemEffect(string effect)
    {
        if (effect != null)
        {
            GameObject animationObject = Resources.Load <GameObject>("Prefabs/Effects/" + effect);

            if (animationObject != null)
            {
                AnimatedEffect animation = Instantiate(animationObject).GetComponent <AnimatedEffect>();
                if (animation != null)
                {
                    animation.skeletonAnimation.MeshRenderer.sortingOrder = CurrentState.MeshRenderer.sortingOrder + 1;
                    animation.BindToTargetUnit(this, CurrentState, "fxchest");
                    animation.gameObject.layer = CurrentState.gameObject.layer;
                }
            }
        }
    }
Example #12
0
    public void SetTargetEffect(FormationUnit performer, string effectId, string fxTarget)
    {
        if (effectId != null)
        {
            var exclusiveAnimation = performer.unitAnimator.Effects.Find(effect => effect.name == effectId);
            var animationObject    = exclusiveAnimation != null ? exclusiveAnimation.gameObject :
                                     Resources.Load <GameObject>("Prefabs/Effects/" + effectId);

            if (animationObject != null)
            {
                AnimatedEffect effect = Instantiate(animationObject).GetComponent <AnimatedEffect>();
                if (effect != null)
                {
                    effect.SkeletonAnimation.MeshRenderer.sortingOrder = CurrentState.MeshRenderer.sortingOrder + 1;
                    effect.BindToTarget(this, CurrentState, fxTarget);
                    effect.gameObject.layer = CurrentState.gameObject.layer;
                }
            }
        }
    }
Example #13
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CreatureTurnedNotificationArguments"/> class.
        /// </summary>
        /// <param name="creature">The creature that turned.</param>
        /// <param name="creatureStackPosition">The position in the stack of the creature that turned.</param>
        /// <param name="turnEffect">Optional. An effect of the turn.</param>
        public CreatureTurnedNotificationArguments(ICreature creature, byte creatureStackPosition, AnimatedEffect turnEffect = AnimatedEffect.None)
        {
            creature.ThrowIfNull(nameof(creature));

            this.Creature      = creature;
            this.StackPosition = creatureStackPosition;
            this.TurnedEffect  = turnEffect;
        }
Example #14
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MagicEffectPacket"/> class.
 /// </summary>
 /// <param name="location">The location of the effect.</param>
 /// <param name="effect">The effect.</param>
 public MagicEffectPacket(Location location, AnimatedEffect effect)
 {
     this.Location = location;
     this.Effect   = effect;
 }
Example #15
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CreatureRemovedNotificationArguments"/> class.
        /// </summary>
        /// <param name="creature">The creature being removed.</param>
        /// <param name="oldStackPos">The position in the stack of the creature being removed.</param>
        /// <param name="removeEffect">Optional. An effect to add when removing the creature.</param>
        public CreatureRemovedNotificationArguments(ICreature creature, byte oldStackPos, AnimatedEffect removeEffect = AnimatedEffect.None)
        {
            creature.ThrowIfNull(nameof(creature));

            this.Creature         = creature;
            this.OldStackPosition = oldStackPos;
            this.RemoveEffect     = removeEffect;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="CreatureTurnedNotification"/> class.
        /// </summary>
        /// <param name="findTargetPlayers">A function to determine the target players of this notification.</param>
        /// <param name="creature">The creature that turned.</param>
        /// <param name="creatureStackPosition">The position in the stack of the creature that turned.</param>
        /// <param name="turnEffect">Optional. An effect of the turn.</param>
        public CreatureTurnedNotification(Func <IEnumerable <IPlayer> > findTargetPlayers, ICreature creature, byte creatureStackPosition, AnimatedEffect turnEffect = AnimatedEffect.None)
            : base(findTargetPlayers)
        {
            creature.ThrowIfNull(nameof(creature));

            this.Creature      = creature;
            this.StackPosition = creatureStackPosition;
            this.TurnedEffect  = turnEffect;
        }
Example #17
0
 public void stopAnimation(AnimatedEffect e)
 {
     animations.Remove(e);
 }
Example #18
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CreatureRemovedNotification"/> class.
        /// </summary>
        /// <param name="spectators">The set of players that spectated the creature removal.</param>
        /// <param name="removedCreature">The creature being removed.</param>
        /// <param name="oldStackPos">The position in the stack of the creature being removed.</param>
        /// <param name="removeEffect">Optional. An effect to add when removing the creature.</param>
        public CreatureRemovedNotification(IEnumerable <IPlayer> spectators, ICreature removedCreature, byte oldStackPos, AnimatedEffect removeEffect = AnimatedEffect.None)
            : base(spectators)
        {
            removedCreature.ThrowIfNull(nameof(removedCreature));

            this.Creature      = removedCreature;
            this.StackPosition = oldStackPos;
            this.RemoveEffect  = removeEffect;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="CreatureRemovedNotification"/> class.
        /// </summary>
        /// <param name="findTargetPlayers">A function to determine the target players of this notification.</param>
        /// <param name="creature">The creature being removed.</param>
        /// <param name="oldStackPos">The position in the stack of the creature being removed.</param>
        /// <param name="removeEffect">Optional. An effect to add when removing the creature.</param>
        public CreatureRemovedNotification(Func <IEnumerable <IPlayer> > findTargetPlayers, ICreature creature, byte oldStackPos, AnimatedEffect removeEffect = AnimatedEffect.None)
            : base(findTargetPlayers)
        {
            creature.ThrowIfNull(nameof(creature));

            this.Creature      = creature;
            this.StackPosition = oldStackPos;
            this.RemoveEffect  = removeEffect;
        }