public object Clone() { Bullet bulletClone = (Bullet)this.MemberwiseClone(); IAnimationAtlasAction action = Factory.CreateAnimAtlasAction(BulletFrame, BulletFrame, false); Dictionary <string, IAnimationAtlasAction> actions = new Dictionary <string, IAnimationAtlasAction>() { { "SingleAction", action } }; bulletClone.AtlasManager = new AtlasAnimationSingleActionManager(bulletClone, actions); bool direction = (ParentSprite.Mover.IsMovingLeft) ? true : false; if (direction) { bulletClone.Position = new Vector2(ParentSprite.Position.X - 6, ParentSprite.Position.Y); } else { bulletClone.Position = new Vector2(ParentSprite.Position.X + 32, ParentSprite.Position.Y); } bulletClone.Mover = new MoverBullet(bulletClone, direction); bulletClone.CollisionHandler = new CollisionHandler(bulletClone); return(bulletClone); }
public AnimationAtlasPlayer(IAnimationAtlas atlas, IAnimationAtlasAction action) { _atlas = atlas; this.action = action; _currentFrame = action.StartFrame; _frameSpeed = 0.15f; Color = Color.White; }
public void Play(IAnimationAtlasAction action) //what action to start playing { if (this.action == action) { return; } this.action = action; _currentFrame = this.action.StartFrame; //startframe _timer = 0; }
public GruntRanged(Texture2D atlasTexture) : base(atlasTexture) { IAnimationAtlasAction RangedLeft = Factory.CreateAnimAtlasAction(11, 11, true); IAnimationAtlasAction RangedRight = Factory.CreateAnimAtlasAction(12, 12, true); Actions.Add("RangedLeft", RangedLeft); Actions.Add("RangedRight", RangedRight); Mover = new MoverAI(this, true); RangedWeapon = new RangedWeaponAI(this, 10, 480, 1000f); }
public Player(Texture2D atlasTexture) : base(atlasTexture) { IAnimationAtlasAction WalkRight = Factory.CreateAnimAtlasAction(0, 3, false); IAnimationAtlasAction WalkLeft = Factory.CreateAnimAtlasAction(15, 18, false); IAnimationAtlasAction Jump = Factory.CreateAnimAtlasAction(5, 7, true); IAnimationAtlasAction MeleeRight = Factory.CreateAnimAtlasAction(30, 38, false); IAnimationAtlasAction MeleeLeft = Factory.CreateAnimAtlasAction(90, 98, false); IAnimationAtlasAction BlockRight = Factory.CreateAnimAtlasAction(4, 4, true); IAnimationAtlasAction BlockLeft = Factory.CreateAnimAtlasAction(14, 14, true); IAnimationAtlasAction RangedRight = Factory.CreateAnimAtlasAction(10, 10, true); IAnimationAtlasAction RangedLeft = Factory.CreateAnimAtlasAction(12, 12, true); Dictionary <string, IAnimationAtlasAction> actions = new Dictionary <string, IAnimationAtlasAction>() { { "WalkRight", WalkRight }, { "WalkLeft", WalkLeft }, { "Jump", Jump }, { "MeleeRight", MeleeRight }, { "MeleeLeft", MeleeLeft }, { "RangedRight", RangedRight }, { "RangedLeft", RangedLeft }, { "BlockRight", BlockRight }, { "BlockLeft", BlockLeft }, }; AtlasManager = Factory.CreateAnimAtlasManager(this, actions); Inputs = Factory.CreateInput(); MaxHealth = 100; Lives = 3; HealthHandler = Factory.CreateHealthHandler(this, Color.Green); List <int> attackFramesRight = new List <int>() { 31, 34, 37 }; List <int> attackFramesLeft = new List <int>() { 91, 94, 97 }; MeleeWeapon = new MeleeWeapon(this, 1, 20, attackFramesRight, attackFramesLeft); RangedWeapon = new RangedWeapon(this, 10, 20, 300f); Shield = new Shield(this, 5); Score = 0; }
public Bullet(Texture2D atlasTexture, ISprite parentSprite, int damage, int bulletFrame) : base(atlasTexture) { BulletFrame = bulletFrame; IAnimationAtlasAction action = Factory.CreateAnimAtlasAction(bulletFrame, bulletFrame, false); Dictionary <string, IAnimationAtlasAction> actions = new Dictionary <string, IAnimationAtlasAction>() { { "SingleAction", action } }; AtlasManager = new AtlasAnimationSingleActionManager(this, actions); Damage = damage; LifeSpan = 1f; Speed = 10f; ParentSprite = parentSprite; bool direction = (ParentSprite.Mover.IsMovingLeft) ? true : false; Mover = new MoverBullet(this, direction); }
public GruntBase(Texture2D atlasTexture) : base(atlasTexture) { IAnimationAtlasAction WalkLeft = Factory.CreateAnimAtlasAction(0, 3, false); IAnimationAtlasAction WalkRight = Factory.CreateAnimAtlasAction(15, 18, false); IAnimationAtlasAction Jump = Factory.CreateAnimAtlasAction(5, 6, true); Actions = new Dictionary <string, IAnimationAtlasAction>() { { "WalkLeft", WalkLeft }, { "WalkRight", WalkRight }, { "Jump", Jump }, }; Lives = 1; AtlasManager = Factory.CreateAnimAtlasManager(this, Actions); MaxHealth = 50; HealthHandler = Factory.CreateHealthHandler(this, Color.Red); }
public GruntMelee(Texture2D atlasTexture, List <int> wayPointIndexes) : base(atlasTexture) { IAnimationAtlasAction MeleeRight = Factory.CreateAnimAtlasAction(23, 25, false); IAnimationAtlasAction MeleeLeft = Factory.CreateAnimAtlasAction(20, 22, false); Actions.Add("MeleeRight", MeleeRight); Actions.Add("MeleeLeft", MeleeLeft); Mover = new MoverAI(this, false, wayPointIndexes); List <int> attackFramesRight = new List <int>() { 24 }; List <int> attackFramesLeft = new List <int>() { 21 }; MeleeWeapon = new MeleeWeaponAI(this, 1, 20, attackFramesRight, attackFramesLeft); }
public static IAnimationAtlasPlayer CreateAnimAtlasPlayer(IAnimationAtlas atlas, IAnimationAtlasAction action) { return(new AnimationAtlasPlayer(atlas, action)); }