public Hero() : base("Hero") { Animation = TextureSetLoader.SHIP1_BASE; MaxHealth = HERO_HEALTH; Health = HERO_HEALTH; Speed = HERO_SPEED; ShootingStrategy.ShootingInterval = 50; AddStrategy(new FlyingDirectionRotation ( owner: this , verticalOrientation: SpaceDirection.VerticalDirection.UP , angleDeltaCount: 35 , maxAngleDegrees: 75 )); //Default weapon Weapon = new MultiProjectileShooter ( multiShot: 1 , dispersion: 20 , newProjectileCallback: (character, position, angle) => new HeroBullet(character, position, angle) ); //He is composed of the thrust new MovementThrust(this); //Custom square intersect percentage IntersectStrategy = new SquareIntersect(this) { Percent = 60 }; //Hero uses our implementation of clickable event receiver Clickable = new ClickableImpl(IntersectsOn); //TODO fix this and implement ellipse intersect collision instead of default square /*IntersectStrategy = new DelegateIntersect * ( * this * , (x, y) => * { * float XRadius = (float)Width / 2; * float YRadius = (float)Height / 2; * float ellipsePosition = Utility.square(X - x - XRadius) / Utility.square(XRadius) + * Utility.square(Y - y - YRadius) / Utility.square(YRadius); * if(ellipsePosition<1)Log.d(this, ellipsePosition.ToString()); * return ellipsePosition < 1; * } * );*/ }
protected AbstractActor(string name) { //Initializes strategy lists ActStrategies = new LinkedList <IActStrategy>(); DrawModificationStrategies = new LinkedList <IDrawModificationStrategy>(); //Default properties of the Actor Direction = SpaceDirection.None; Speed = DEFAULT_SPEED; //Downloads the concrete initialization name choice from the subclass Name = name; //By default, implements square intersect strategy using the current Animation dimensions IntersectStrategy = new SquareIntersect(this); }
public DarkspringTheTwisted() : base("Darkspring The Twisted", score: 500) { Animation = TextureSetLoader.SHIP12_BASE; Direction = SpaceDirection.None + SpaceDirection.VerticalDirection.DOWN; MaxHealth = 600; Health = MaxHealth; IntersectStrategy = new SquareIntersect(this) { Percent = 65 }; //Approaches slowly Speed = 1.5f; Weapon = new MultiProjectileShooter ( multiShot: 1 , dispersion: 0 , newProjectileCallback: (character, position, angle) => new FireBullet <IPlayer>(character, position, angle, speed: 2, damage: 12) ); }