public override void AddedToFieldHook() { base.AddedToFieldHook(); //Strategy that does not automatically rotate but instead, needs to be rotated manually TargetRotationStrategy = new TargetAngleRotation ( owner: this , verticalOrientation: Direction.Vertical , angleDeltaCount: 320 , maxAngleDegrees: 360 ); //Initialization of the default Shooting parameters via strategy AddStrategy(new Shooting ( owner: this , shootingInterval: 7 , weaponCallback: () => Weapon , bulletFocusPosition: () => BulletFocusPosition , angleCallback: () => TargetRotationStrategy.CurrentAngleDegrees ) { IsShooting = true }); AddStrategy(TargetRotationStrategy); //Custom Thrust WaveghostThrust = new Thrust(this); }
public override void AddedToFieldHook() { base.AddedToFieldHook(); //Strategy that does not automatically rotate but instead, needs to be rotated manually TargetRotationStrategy = new TargetAngleRotation ( owner: this , verticalOrientation: Direction.Vertical , angleDeltaCount: 45 , maxAngleDegrees: 160 ); //Initialization of the default Shooting parameters via strategy AddStrategy(new Shooting ( owner: this , shootingInterval: 10 , weaponCallback: () => Weapon , bulletFocusPosition: () => BulletFocusPosition , angleCallback: () => TargetRotationStrategy.CurrentAngleDegrees ) { IsShooting = true }); //Every N acts looks at the Player's position and rotates towards approximately towards him AddStrategy(new EveryNActs ( callback: () => { float angle = TargetActorAngleRotation.AngleBetweenActorsRadians(this, Field.Player, true); //Some additional variance angle += AbstractRotation.DegreesToRadians(Utility.RandomBetween(-30, 30)); TargetRotationStrategy.TargetAngleRadians = angle; } , interval: 40 )); AddStrategy(TargetRotationStrategy); //Custom Thrust new Thrust(this); //Starts moving in the opposite direction than where he spawned from if (X < Field.Size.Width / 2) { Direction += SpaceDirection.HorizontalDirection.RIGHT; } else { Direction += SpaceDirection.HorizontalDirection.LEFT; } }