public new object clone() { Creature copy = base.clone() as Creature; if (ClassAsset != null) { copy.ClassAsset = ClassAsset.clone() as GameAsset <Class>; } copy.Stats = Stats.clone() as Stats; copy.RNG = new Random(); copy.Effects = new List <AbilityEffect>(); copy.Abilities = new List <Ability>(); Abilities.ForEach(a => copy.addAbility(a.clone() as Ability)); if (DeathAnimation != null) { copy.DeathAnimationAsset = DeathAnimationAsset.clone() as GameAsset <SpriteAnimation>; } if (AttackAnimation != null) { copy.AttackAnimationAsset = AttackAnimationAsset.clone() as GameAsset <SpriteAnimation>; } if (DamageAnimation != null) { copy.DamageAnimationAsset = DamageAnimationAsset.clone() as GameAsset <SpriteAnimation>; } if (LevelUpAnimation != null) { copy.LevelUpAnimationAsset = LevelUpAnimationAsset.clone() as GameAsset <SpriteAnimation>; } // TODO // copy.Weapon = Weapone.clone() as Weapon; // copy.Chestplate = Chestplate.clone() as Chestplate; // copy.Helmet = Helmet.clone() as Helmet; // copy.Pants = Pants.clone() as Pants; return(copy); }
/// Loads required resources for this creature public override void load(ContentManager content) { base.load(content); AbilityFiles.ForEach(af => { Ability ability = content.Load <Ability>(af); if (Abilities.Where(a => a.Title == ability.Title).Count() == 0) { addAbility(ability.clone() as Ability); } }); Abilities.ForEach(a => a.load(content)); if (DeathSoundFile != null) { DeathSound = content.Load <SoundEffect>(DeathSoundFile); } if (AttackSoundFile != null) { AttackSound = content.Load <SoundEffect>(AttackSoundFile); } if (DamageSoundFile != null) { DamageSound = content.Load <SoundEffect>(DamageSoundFile); } if (LevelUpSoundFile != null) { LevelUpSound = content.Load <SoundEffect>(LevelUpSoundFile); } if (DeathAnimationAsset != null) { DeathAnimationAsset.load(content); } if (AttackAnimationAsset != null) { AttackAnimationAsset.load(content); } if (DamageAnimationAsset != null) { DamageAnimationAsset.load(content); } if (LevelUpAnimationAsset != null) { LevelUpAnimationAsset.load(content); } if (DeathAnimation != null) { DeathAnimation.load(content); DeathAnimation.Origin = this; } if (AttackAnimation != null) { AttackAnimation.load(content); AttackAnimation.Origin = this; } if (DamageAnimation != null) { DamageAnimation.load(content); DamageAnimation.Origin = this; } if (LevelUpAnimation != null) { LevelUpAnimation.load(content); LevelUpAnimation.Origin = this; } if (ClassAsset != null) { ClassAsset.load(content); } if (Class != null) { Class.Creature = this; } }