public GunTestForm() { GameConsts.P47Plane.Singleton.Width *= 10; GameConsts.P47Plane.Singleton.Height *= 10; StartPositionInfo sp1 = new StartPositionInfo(); sp1.Position = p1; sp1.Speed = 0; sp1.PositionType = StartPositionType.Airborne; sp1.Direction = Direction.Right; plane1 = new Plane(null, false, sp1, PlaneType.P47); StartPositionInfo sp2 = new StartPositionInfo(); sp2.Position = new PointD(350, 330); sp2.Speed = 0; sp2.PositionType = StartPositionType.Airborne; sp2.Direction = Direction.Left; plane2 = new Plane(null, true, sp2, PlaneType.A6M); InitializeComponent(); }
/// <summary> /// Tworzy samolot z wylosawnym po³o¿eniem (któryœ z krañców planszy). /// </summary> /// <param name="level"></param> public EnemyPlaneBase(Level level, Planes.PlaneType planeType) : base(level, true, planeType) { StartPositionInfo info = new StartPositionInfo(); //wylosowanie pozycji Random r = new Random(); int atEnd = r.Next(0, 2); //losuje 0 albo 1 float endPos = (level.LevelTiles.Count) * LevelTile.TileWidth - 2.0f * width; float x; if ((level.MissionType == MissionType.Dogfight || level.MissionType == MissionType.Survival) && level.EnemyPlanesLeft == level.EnemyFightersPoolCount) { // pierwszy samolot jest blizej lotniskowca x = atEnd * endPos * 0.6f + (1 - atEnd) * endPos * 0.4f; } else { x = atEnd * endPos + (1 - atEnd) * endPos * 0.05f; } x += r.Next(-6, 6); // HARD! //x = 1350; GameConsts.UserPlane.Singleton.GodMode=true; float y = r.Next(30, 40); info.Direction = atEnd == 0 ? Direction.Right : Direction.Left; info.EngineState = EngineState.Working; info.WheelsState = WheelsState.In; info.PositionType = StartPositionType.Airborne; info.Position = new PointD(x, y); info.Speed = GetConsts().Speed *0.01f * r.Next(90, 111); bounds = new Quadrangle(new PointD(x, y), width, height); this.startPositionInfo = info; Init(); attackObject = AttackObject.None; // StartEngine(); level.OnEnemyPlaneFromTheSide(!(atEnd == 1)); temp = new PointD(0, 0); InitIterpolateSet(); //Console.WriteLine("Enemy plane from the " + (atEnd==1?"right.":"left.")); }
protected void addEnemyPlane(Level currentLevel, EnemyPlaneBase enemyPlane) { StartPositionInfo info = new StartPositionInfo(); info.Position = new PointD(UnitConverter.WorldToLogicUnits(Framework.Camera.RealPosition + ViewHelper.RandomVector3(50, 20, 0))); info.Direction = Direction.Right; info.EngineState = EngineState.Working; info.PositionType = StartPositionType.Airborne; // info.Speed = 0.1f; info.WheelsState = WheelsState.In; enemyPlane.ReInit(info); enemyPlane.RegisterWeaponEvent += currentLevel.enemyPlane_RegisterWeaponEvent; currentLevel.EnemyPlanes.Add(enemyPlane); currentLevel.Controller.OnRegisterPlane(enemyPlane); // currentLevel.UserPlane.Speed = 0; }