public void UpdateShot(Shots.Shot shot)
 {
     int X = GetLogicCoo(shot.Position.X);
     int Y = GetLogicCoo(shot.Position.Y);
     int oldX, oldY;
     shot.GetLogicCoo(out oldX, out oldY);
     gameObjects[oldX, oldY].Remove(shot);
     ArrayList node = gameObjects[X, Y];
     if (!node.Contains(shot))
     {
         node.Add(shot);
         shot.SetLogicCoo(X, Y);
     }
 }
示例#2
0
 public Unit(ShipTypes ShipType, string Name, GameVector Position, GameVector Size, DerivativeControlledParameter Speed,
     DerivativeControlledParameter RotationSpeed,
     DerivativeControlledParameter RotationAngle, Gun Gun, float HP, int team, Shots shots, float BlowDamage, float BlowRadius)
 {
     shipType = ShipType;
     blowDamage = BlowDamage;
     blowRadius = BlowRadius;
     name = Name;
     position = Position;
     size = Size;
     speed = Speed;
     rotationSpeed = RotationSpeed;
     rotationAngle = RotationAngle;
     gun = Gun;
     gun.owner = this;
     this.hp = HP;
     this.team = team;
     maxTimeAfterDeath = 5 * 0.2f;
     timeAfterDeath = 0;
     IsAliveInPrevLoop = true;
     this.shots = Core.shots;
 }
示例#3
0
 public Unit(ShipTypes ShipType, int Player, GameVector Position, float Angle, string Name)
 {
     shipType = ShipType;
     switch (shipType)
     {
         case ShipTypes.Destroyer:
             blowDamage = 70;
             blowRadius = 40;
             name = Name;
             position = Position;
             size = Core.DestroyerSize;
             speed = new DerivativeControlledParameter(0, 0, 20 * TimingClass.SpeedsMultiplier, 9 * TimingClass.SpeedsMultiplier, false);
             rotationSpeed = new DerivativeControlledParameter(0, -0.22f * TimingClass.SpeedsMultiplier, 0.22f * TimingClass.SpeedsMultiplier, 0.5f * TimingClass.SpeedsMultiplier, false);
             rotationAngle = new DerivativeControlledParameter(Angle, -MathHelper.Pi, MathHelper.Pi, 1000, true);
             gun = new Gun(1, 50 * TimingClass.SpeedsMultiplier, 9 / TimingClass.SpeedsMultiplier, 15);
             gun.owner = this;
             this.hp = 80;
             this.team = Player;
             maxTimeAfterDeath = 5 * 0.2f;
             timeAfterDeath = 0;
             IsAliveInPrevLoop = true;
             this.shots = Core.shots;
             break;
         case ShipTypes.Corvette:
             blowDamage = 150;
             blowRadius = 120;
             maxTimeAfterDeath = 5 * 0.2f;
             speed = new DerivativeControlledParameter(0, 0, 5 * TimingClass.SpeedsMultiplier, 1 * TimingClass.SpeedsMultiplier, false);
             rotationSpeed = new DerivativeControlledParameter(0, -0.12f * TimingClass.SpeedsMultiplier, 0.12f * TimingClass.SpeedsMultiplier, 0.39f * TimingClass.SpeedsMultiplier, false);
             gun = new Gun(1, 50 * TimingClass.SpeedsMultiplier, 18 / TimingClass.SpeedsMultiplier, 40);
             this.hp = 400;
             this.team = Player;
             IsAliveInPrevLoop = true;
             this.shots = Core.shots;
             timeAfterDeath = 0;
             name = Name;
             position = Position;
             size = Core.CorvetteSize;
             //size.Y *= 0.9f; //real object size (see texture)
             rotationAngle = new DerivativeControlledParameter(
                 Angle
                 , -MathHelper.Pi, MathHelper.Pi, 1000, true);
             gun.owner = this;
             break;
         case ShipTypes.Cruiser:
             blowDamage = 300;
             blowRadius = 150;
             maxTimeAfterDeath = 8 * 0.2f;
             speed = new DerivativeControlledParameter(0, 0, 2 * TimingClass.SpeedsMultiplier, 1.0f * TimingClass.SpeedsMultiplier, false);
             rotationSpeed = new DerivativeControlledParameter(0, -0.05f * TimingClass.SpeedsMultiplier, 0.05f * TimingClass.SpeedsMultiplier, 0.2f * TimingClass.SpeedsMultiplier, false);
             gun = new Gun(4, 50 * TimingClass.SpeedsMultiplier, 27 / TimingClass.SpeedsMultiplier, 200);
             this.hp = 800;
             this.team = Player;
             IsAliveInPrevLoop = true;
             this.shots = Core.shots;
             timeAfterDeath = 0;
             name = Name;
             position = Position;
             size = Core.CruiserSize;
             //size.X *= 0.7f; //real object size (see texture)
             //size.Y *= 0.9f; //real object size (see texture)
             rotationAngle = new DerivativeControlledParameter(
                 Angle
                 , -MathHelper.Pi, MathHelper.Pi, 1000, true);
             gun.owner = this;
             break;
     }
 }
示例#4
0
 internal void DrawShots(Shots shots)
 {
     shotEffect.Parameters["ViewProj"].SetValue(ViewProj);
     Vector4[] ShotBatchParams1 = new Vector4[MaxBatchSize / 2];
     Vector3[] ShotBatchParams2 = new Vector3[MaxBatchSize / 2];
     int CShotsInBatch = 0;
     foreach (Shots.Shot shot in shots)
     {
         ShotBatchParams1[CShotsInBatch].X = shot.pos.X;
         ShotBatchParams1[CShotsInBatch].Y = shot.pos.Y;
         ShotBatchParams1[CShotsInBatch].Z = shot.End.X;
         ShotBatchParams1[CShotsInBatch].W = shot.End.Y;
         ShotBatchParams2[CShotsInBatch].X = 1;// (shot.hitSomebody) ? 1 : -1;
         ShotBatchParams2[CShotsInBatch].Y = 0;
         ShotBatchParams2[CShotsInBatch].Z = shot.Size;//width
         CShotsInBatch++;
         if (CShotsInBatch >= MaxBatchSize / 2)
             DrawShotBatch(ShotBatchParams1, ShotBatchParams2, ref CShotsInBatch);
     }
     if (CShotsInBatch > 0)
         DrawShotBatch(ShotBatchParams1, ShotBatchParams2, ref CShotsInBatch);
 }
示例#5
0
 public Core(int ScreenWidth, int ScreenHeight, ContentManager content, Microsoft.Xna.Framework.GraphicsDeviceManager graphics)
 {
     gameObjects = new GameObjectsClass();
     timing = new TimingClass();
     viewer = new Viewer(ScreenWidth, ScreenHeight, content, graphics);
     units = new List<Unit>();
     shots = new Shots(units);
 }
 internal void RemoveShot(Shots.Shot shot)
 {
     int X, Y;
     shot.GetLogicCoo(out X, out Y);
     gameObjects[X, Y].Remove(shot);
 }