Exemple #1
0
            public StateData InheritFrom(StateData other, Dictionary <string, StateData> states)
            {
                var ret = ( StateData )other.Clone();

                if (!string.IsNullOrEmpty(ret.InheritsFrom) && states.ContainsKey(ret.InheritsFrom))
                {
                    ret = ret.InheritFrom(states[ret.InheritsFrom], states);
                }
                if (BoundingBoxSize.HasValue)
                {
                    ret.BoundingBoxSize = BoundingBoxSize.Value;
                }
                if (Defense.HasValue)
                {
                    ret.Defense = Defense.Value;
                }
                if (Movement != null)
                {
                    ret.Movement = Movement;
                }
                if (IsGlider.HasValue)
                {
                    ret.IsGlider = IsGlider.Value;
                }
                if (CanReceiveDamageFromPlayer != null)
                {
                    ret.CanReceiveDamageFromPlayer = CanReceiveDamageFromPlayer;
                }
                if (CanReceiveDamageFromBomb.HasValue)
                {
                    ret.CanReceiveDamageFromBomb = CanReceiveDamageFromBomb.Value;
                }
                if (IncomingDamageMultiplier.HasValue)
                {
                    ret.IncomingDamageMultiplier = IncomingDamageMultiplier.Value;
                }
                if (HitSound != null)
                {
                    ret.HitSound = HitSound;
                }
                if (Animation != null)
                {
                    ret.Animation = Animation;
                }
                // state length?
                if (ContactDamage.HasValue)
                {
                    ret.ContactDamage = ContactDamage.Value;
                }
                if (DamageElement != null)
                {
                    ret.DamageElement = DamageElement;
                }
                if (ApplyDebuff != null)
                {
                    ret.ApplyDebuff = ApplyDebuff;
                }
                foreach (var evt in Events)
                {
                    ret.Events.Add(evt);
                }
                return(ret);
            }