public virtual void Collapse(bool ignoreIsExpanded, bool stopAnimations)
        {
            this.ownerControl.LoadElementTree();
            bool isExpanded = ignoreIsExpanded || this.IsExpanded;

            if (this.IsAnimating || !isExpanded || (this.ElementTree.RootElement.ElementState != ElementState.Loaded || this.preventExpandCollapse) || !this.OnCollapsing())
            {
                return;
            }
            this.ExecuteCollapsePreparations();
            bool previousIsAnimatingValue = false;

            if (stopAnimations)
            {
                previousIsAnimatingValue = this.EnableAnimation;
                this.EnableAnimation     = false;
            }
            AnimatedPropertySetting       animation = this.CreateAnimation(isExpanded);
            AnimationFinishedEventHandler animationFinishedHandler = (AnimationFinishedEventHandler)null;

            animationFinishedHandler = (AnimationFinishedEventHandler)((param0, param1) =>
            {
                this.preventExpandCollapse = true;
                animation.AnimationFinished -= animationFinishedHandler;
                this.IsExpanded = false;
                if (stopAnimations)
                {
                    this.EnableAnimation = previousIsAnimatingValue;
                }
                this.preventExpandCollapse = false;
                this.ExecuteCollapseFinalizations();
                int num = (int)this.SetAnimatedObjectValue(animation.Property, animation.EndValue);
                this.OnCollapsed();
            });
            animation.AnimationFinished += animationFinishedHandler;
            RadObject objectToBeAnimated = this.GetObjectToBeAnimated();

            if (this.EnableAnimation)
            {
                animation.ApplyValue(objectToBeAnimated);
            }
            else
            {
                bool animationsEnabled = AnimatedPropertySetting.AnimationsEnabled;
                AnimatedPropertySetting.AnimationsEnabled = false;
                animation.NumFrames = 1;
                animation.Interval  = 1;
                animation.ApplyValue(objectToBeAnimated);
                AnimatedPropertySetting.AnimationsEnabled = animationsEnabled;
            }
            if (!this.ElementTree.RootElement.EnableElementShadow)
            {
                return;
            }
            this.ownerControl.RootElement.PaintControlShadow();
        }
Esempio n. 2
0
 /// <summary>
 /// Raises the <see cref="AnimationFinished"/> event.
 /// </summary>
 /// <param name="sender">The <see cref="MulticolorLED"/> that raised the event.</param>
 protected virtual void OnAnimationFinishedEvent(MulticolorLED sender)
 {
     if (onAnimationFinished == null)
     {
         onAnimationFinished = new AnimationFinishedEventHandler(OnAnimationFinishedEvent);
     }
     if (Program.CheckAndInvoke(AnimationFinished, onAnimationFinished, sender))
     {
         AnimationFinished(sender);
     }
 }
Esempio n. 3
0
        private void OnAnimationFinished(MulticolorLED sender, EventArgs e)
        {
            if (this.onAnimationFinished == null)
            {
                this.onAnimationFinished = this.OnAnimationFinished;
            }

            if (Program.CheckAndInvoke(this.AnimationFinished, this.onAnimationFinished, sender, e))
            {
                this.AnimationFinished(sender, e);
            }
        }
        protected internal virtual void OnAnimationFinished(AnimationStatusEventArgs e)
        {
            if (e.Object != null)
            {
                int num = (int)e.Object.OnAnimationFinished(this);
            }
            AnimationFinishedEventHandler animationFinished = this.AnimationFinished;

            if (animationFinished != null)
            {
                animationFinished((object)this, e);
            }
            if (!(e.Object.ValuesAnimators[(object)this.GetHashCode()] is ElementValuesAnimator))
            {
                return;
            }
            e.Object.ValuesAnimators.Remove((object)this.GetHashCode());
        }
Esempio n. 5
0
        public static SkillSet CreateBlobSkillSet(GameObject blob)
        {
            SkillSet skillSet = new SkillSet(blob);

            Skill attack = new Skill("attack", 5200, () =>
            {
                TargetingComponent targetingComponent = blob.FirstComponentOfType <TargetingComponent>();
                WeaponComponent weaponComponent       = blob.FirstComponentOfType <WeaponComponent>();
                StatSet statSet = blob.FirstComponentOfType <StatSet>();

                if (targetingComponent.HasTarget)
                {
                    bool isCrit = false;

                    float damage = weaponComponent.GenerateAttack(statSet.GetAttackPower(), statSet.GetCritPercent(), ref isCrit);

                    targetingComponent.Target.FirstComponentOfType <HealthComponent>().TakeDamage(damage);

                    SpriterComponent <Texture2D> spriterComponent = blob.FirstComponentOfType <SpriterComponent <Texture2D> >();
                    spriterComponent.ChangeAnimation("Attack");

                    AnimationFinishedEventHandler animationFininshedEventHandler = (animation) =>
                    {
                        spriterComponent.ChangeAnimation("Walk");
                    };

                    spriterComponent.OnAnimationFinished += animationFininshedEventHandler;

                    spriterComponent.OnAnimationChanged += (old, newAnim) =>
                    {
                        if (old.Name == "Attack")
                        {
                            spriterComponent.OnAnimationFinished -= animationFininshedEventHandler;
                        }
                    };

                    blob.FirstComponentOfType <DamageRenderer>().AddText(((int)(damage)).ToString(), isCrit);

                    return(true);
                }

                return(false);
            });

            Skill beam = new Skill("beam", 15200, () =>
            {
                TargetingComponent targetingComponent = blob.FirstComponentOfType <TargetingComponent>();
                WeaponComponent weaponComponent       = blob.FirstComponentOfType <WeaponComponent>();
                StatSet statSet        = blob.FirstComponentOfType <StatSet>();
                FacingComponent facing = blob.FirstComponentOfType <FacingComponent>();

                SpriterComponent <Texture2D> spriterComponent = blob.FirstComponentOfType <SpriterComponent <Texture2D> >();
                spriterComponent.ChangeAnimation("Attack2");

                Texture2D plasma = blob.Game.Content.Load <Texture2D>(@"Animations\Boss\Plasma");

                AABB area = new AABB(blob.Position.X * facing.FacingNumber * -1, blob.Position.Y, plasma.Width, plasma.Height);
                List <BroadphaseProxy> proxies = blob.Game.World.QueryAABB(ref area);

                bool isCrit = false;

                float damage = weaponComponent.GenerateSpecialAttack(25f, 50f, statSet.GetAttackPower(), statSet.GetCritPercent(), ref isCrit);

                foreach (BroadphaseProxy proxy in proxies.Where(p => p.Client.Owner.Name.StartsWith("Player")))
                {
                    proxy.Client.Owner.FirstComponentOfType <HealthComponent>().TakeDamage(damage);

                    blob.FirstComponentOfType <DamageRenderer>().AddText(((int)(damage)).ToString(), isCrit);
                }

                AnimationFinishedEventHandler animationFininshedEventHandler = (animation) =>
                {
                    spriterComponent.ChangeAnimation("Walk");
                };

                spriterComponent.OnAnimationFinished += animationFininshedEventHandler;

                spriterComponent.OnAnimationChanged += (old, newAnim) =>
                {
                    if (old.Name == "Attack2")
                    {
                        spriterComponent.OnAnimationFinished -= animationFininshedEventHandler;
                    }
                };

                return(true);
            });

            Skill smash = new Skill("smash", 10200, () =>
            {
                TargetingComponent targetingComponent = blob.FirstComponentOfType <TargetingComponent>();
                WeaponComponent weaponComponent       = blob.FirstComponentOfType <WeaponComponent>();
                StatSet statSet = blob.FirstComponentOfType <StatSet>();

                if (targetingComponent.HasTarget)
                {
                    Console.WriteLine("SMASH!");

                    bool isCrit = false;

                    float damage = weaponComponent.GenerateAttack(statSet.GetAttackPower(), statSet.GetCritPercent(), ref isCrit);

                    targetingComponent.Target.FirstComponentOfType <HealthComponent>().TakeDamage(damage);

                    SpriterComponent <Texture2D> spriterComponent = blob.FirstComponentOfType <SpriterComponent <Texture2D> >();
                    spriterComponent.ChangeAnimation("Attack");

                    AnimationFinishedEventHandler animationFininshedEventHandler = (animation) =>
                    {
                        spriterComponent.ChangeAnimation("Walk");
                    };

                    spriterComponent.OnAnimationFinished += animationFininshedEventHandler;

                    spriterComponent.OnAnimationChanged += (old, newAnim) =>
                    {
                        if (old.Name == "Attack")
                        {
                            spriterComponent.OnAnimationFinished -= animationFininshedEventHandler;
                        }
                    };

                    blob.FirstComponentOfType <DamageRenderer>().AddText(((int)(damage)).ToString(), isCrit);

                    return(true);
                }

                return(false);
            });

            skillSet.AddSkill(attack);
            skillSet.AddSkill(beam);
            skillSet.AddSkill(smash);

            return(skillSet);
        }
Esempio n. 6
0
        public static SkillSet CreateZombieSkillSet(GameObject zombie)
        {
            SkillSet skillSet = new SkillSet(zombie);

            // Perus auto attack.
            Skill attack = new Skill("attack", 1200, () =>
            {
                TargetingComponent targetingComponent = zombie.FirstComponentOfType <TargetingComponent>();
                WeaponComponent weaponComponent       = zombie.FirstComponentOfType <WeaponComponent>();
                StatSet statSet = zombie.FirstComponentOfType <StatSet>();

                if (targetingComponent.HasTarget)
                {
                    bool isCrit = false;

                    float damage = weaponComponent.GenerateAttack(statSet.GetAttackPower(),
                                                                  statSet.GetCritPercent(),
                                                                  ref isCrit);

                    targetingComponent.Target.FirstComponentOfType <HealthComponent>().TakeDamage(damage);

                    SpriterComponent <Texture2D> spriterComponent = zombie.FirstComponentOfType <SpriterComponent <Texture2D> >();
                    spriterComponent.ChangeAnimation("Attack");

                    AnimationFinishedEventHandler animationFininshedEventHandler = (animation) =>
                    {
                        spriterComponent.ChangeAnimation("Walk");
                    };

                    spriterComponent.OnAnimationFinished += animationFininshedEventHandler;

                    spriterComponent.OnAnimationChanged += (old, newAnim) =>
                    {
                        if (old.Name == "Attack")
                        {
                            spriterComponent.OnAnimationFinished -= animationFininshedEventHandler;
                        }
                    };

                    zombie.FirstComponentOfType <DamageRenderer>().AddText(((int)(damage)).ToString(), isCrit);

                    return(true);
                }

                return(false);
            });

            // Tekee 200% weapon damagesta ja 20-50 lisää damaa.
            Skill slam = new Skill("slam", 4500, () =>
            {
                TargetingComponent targetingComponent = zombie.FirstComponentOfType <TargetingComponent>();
                WeaponComponent weaponComponent       = zombie.FirstComponentOfType <WeaponComponent>();
                StatSet statSet = zombie.FirstComponentOfType <StatSet>();

                if (targetingComponent.HasTarget)
                {
                    bool isCrit = false;

                    float damage = weaponComponent.GenerateSpecialAttack(weaponComponent.Weapon.MinDamage,
                                                                         weaponComponent.Weapon.MaxDamage,
                                                                         statSet.GetAttackPower(),
                                                                         statSet.GetCritPercent(),
                                                                         ref isCrit);

                    targetingComponent.Target.FirstComponentOfType <HealthComponent>().TakeDamage(damage);

                    SpriterComponent <Texture2D> spriterComponent = zombie.FirstComponentOfType <SpriterComponent <Texture2D> >();
                    spriterComponent.ChangeAnimation("Attack");

                    AnimationFinishedEventHandler animationFininshedEventHandler = (animation) =>
                    {
                        spriterComponent.ChangeAnimation("Walk");
                    };

                    spriterComponent.OnAnimationFinished += animationFininshedEventHandler;

                    spriterComponent.OnAnimationChanged += (old, newAnim) =>
                    {
                        if (old.Name == "Attack")
                        {
                            spriterComponent.OnAnimationFinished -= animationFininshedEventHandler;
                        }
                    };

                    zombie.FirstComponentOfType <DamageRenderer>().AddText(((int)(damage)).ToString(), isCrit);

                    return(true);
                }

                return(false);
            });

            // Parantaa useria 10% hpsta ja antaa sille 5% stamina buffin.
            Skill meatWall = new Skill("meat wall", 12500, () =>
            {
                TargetingComponent targetingComponent = zombie.FirstComponentOfType <TargetingComponent>();
                WeaponComponent weaponComponent       = zombie.FirstComponentOfType <WeaponComponent>();
                StatSet statSet = zombie.FirstComponentOfType <StatSet>();

                if (targetingComponent.HasTarget)
                {
                    statSet.AddBuff(new Buff("meat wall", 5f, BuffType.Stamina, ModifierType.Modifier, new BuffDuration(4500)));

                    zombie.FirstComponentOfType <HealthComponent>().Heal(statSet.GetMaxHealth() * 0.10f);

                    return(true);
                }

                return(false);
            });

            // Antaa userille 5% lisää strenaa.
            Skill rage = new Skill("rage", 12500, () =>
            {
                TargetingComponent targetingComponent = zombie.FirstComponentOfType <TargetingComponent>();
                WeaponComponent weaponComponent       = zombie.FirstComponentOfType <WeaponComponent>();
                StatSet statSet = zombie.FirstComponentOfType <StatSet>();

                if (targetingComponent.HasTarget)
                {
                    statSet.AddBuff(new Buff("rage", 5f, BuffType.Strength, ModifierType.Modifier, new BuffDuration(2500)));

                    return(true);
                }

                return(false);
            });

            skillSet.AddSkill(attack);
            skillSet.AddSkill(slam);
            skillSet.AddSkill(meatWall);
            skillSet.AddSkill(rage);

            return(skillSet);
        }