Exemple #1
0
        public bool CheckCollision(NaveEspacial nave)
        {
            TGCVector3 offset = this.GetOffsetVectorMoved();

            foreach (KeyValuePair <TgcBoundingAxisAlignBox, TGCVector3> entry in boundingBoxes)
            {
                entry.Key.scaleTranslate(entry.Value + offset, TGCVector3.One);
                if (TgcCollisionUtils.testObbAABB(nave.OOB, entry.Key))
                {
                    return(true);
                }
            }

            foreach (var m in boundingBoxesTowers)
            {
                m.Transform = TGCMatrix.Translation(offset);
                m.BoundingBox.transform(m.Transform);
                if (TgcCollisionUtils.testObbAABB(nave.OOB, m.BoundingBox))
                {
                    return(true);
                }
            }

            return(torres.FindAll(t => TgcCollisionUtils.testObbAABB(nave.OOB, t.Scene.BoundingBox)).Count > 0);
        }
Exemple #2
0
 public NaveEnemiga(string MediaDir, string modelToUse, int danio, int cdDisparo, NaveEspacial naveAPerseguir) : base(MediaDir, modelToUse, Color.DarkRed, danio, cdDisparo, "DIFFUSE_MAP_PHONG")
 {
     this.ScaleFactor    = TGCMatrix.Scaling(0.5f, 0.5f, 0.5f);
     this.RotationVector = new TGCVector3(0, -FastMath.PI_HALF, 0);
     this.naveAPerseguir = naveAPerseguir;
     OOBScale            = 1f;
 }
Exemple #3
0
        public TGCVector3 CheckLimits(NaveEspacial nave, TGCVector3 movement)
        {
            TGCVector3 counterMovement = TGCVector3.Empty;

            foreach (KeyValuePair <TGCBox, TGCVector3> entry in notDeathfulBB)
            {
                entry.Key.Transform = TGCMatrix.Translation(this.GetOffsetVectorMoved());
                entry.Key.BoundingBox.transform(entry.Key.Transform);
                if (TgcCollisionUtils.testObbAABB(nave.OOB, entry.Key.BoundingBox))
                {
                    counterMovement += new TGCVector3(movement.X * entry.Value.X, movement.Y * entry.Value.Y, 0);
                }
            }

            return(counterMovement);
        }
        public bool CheckShots(NaveEspacial nave)
        {
            var cols = disparos.FindAll(t => t.HayColision(nave)).Select(t => disparos.IndexOf(t)).ToList();

            cols.ForEach(e =>
            {
                try
                {
                    disparos.RemoveAt(e);
                }
                catch (IndexOutOfRangeException)
                {
                    //El disparo ya habia sido removido
                }
            });

            return(cols.Count() > 0);
        }
Exemple #5
0
 public void Update(NaveEspacial nave)
 {
     barraVida.ModificarBarra(nave.Vida * vidaScale.X);
     nave.RecargarFuel(0.1f);
     barraAfterBurn.ModificarBarra(nave.AfterBurnFuel);
 }
Exemple #6
0
 public bool HayColision(NaveEspacial nave)
 {
     return(TgcCollisionUtils.testObbAABB(nave.OOB, this.modelo.BoundingBox));
 }
Exemple #7
0
 public bool CheckIfMyShotsCollided(NaveEspacial otraNave)
 {
     return(this.ArmaPrincipal.CheckShots(otraNave));
 }