public override void AddedToFieldHook()
        {
            base.AddedToFieldHook();

            LeftSpawner  = new HideAct(new EnemySpawner(0, Y, RemainingEnemiesLeft, LeftSpawnCallback));
            RightSpawner = new HideAct(new EnemySpawner((float)Field.Size.Width, Y, RemainingEnemiesRight, RightSpawnCallback));

            Field.AddActor(LeftSpawner);
            Field.AddActor(RightSpawner);
        }
Example #2
0
        public override void AddedToFieldHook()
        {
            base.AddedToFieldHook();

            //Is always shooting downwards
            AddStrategy(new Shooting
                        (
                            owner: this
                            , shootingInterval: 10
                            , weaponCallback: () => Weapon
                            , bulletFocusPosition: () => BulletFocusPosition
                            , angleCallback: () => Utility.RandomBetween(160, 200)
                        )
            {
                IsShooting = true
            });

            //Immediately rotates towards the vertical orientation direction
            AddStrategy(new TargetAngleRotation
                        (
                            owner: this
                            , verticalOrientation: Direction.Vertical
                            , angleDeltaCount: 1
                            , maxAngleDegrees: 0
                        )
            {
                TargetAngleRadians = AbstractRotation.DegreesToRadians(0)
            });

            AddStrategy(new EveryNActs
                        (
                            callback: () =>
            {
                var bomb   = new Doomday(Field.Player);
                bomb.X     = BulletFocusPosition.X + Utility.RandomBetween(-1, 1) * (float)bomb.Width;
                bomb.Y     = BulletFocusPosition.Y;
                bomb.Speed = 0.4f * Utility.RandomBetween(1, 5);
                Field.AddActor(bomb);
            }
                            , interval: 80
                        ));

            //Custom Thrust
            new Thrust(this);
        }
Example #3
0
 /// <summary>
 /// Places actor to the Game Field on the required coordinates.
 /// </summary>
 /// <param name="actor">Actor to be placed in the Game Field.</param>
 public void PlaceActor(IActor actor)
 {
     actor.X = X - (float)actor.Width / 2;
     actor.Y = Y - (float)actor.Height / 2;
     Field.AddActor(actor);
 }
Example #4
0
 /// <summary>
 /// AddActor that adds other Actor to the same coordinates on the same Field, centering it in the process.
 /// </summary>
 /// <param name="actor">Actor that is to be added to the same coordinates.</param>
 protected void AddActorToSameCoordinates(IActor actor)
 {
     actor.X = X + (float)Width / 2 - (float)actor.Width / 2;
     actor.Y = Y + (float)Height / 2 - (float)actor.Height / 2;
     Field.AddActor(actor);
 }