Ejemplo n.º 1
0
 public Torreta(Xwing target, TGCVector3 posicion, TGCVector3 rotacionBase)
 {
     origenDeDisparos            = new TGCVector3(0 * factorEscala, 70 * factorEscala, -20 * factorEscala);
     this.target                 = target;
     this.posicion               = posicion;
     this.rotation               = rotacionBase;
     torreta                     = VariablesGlobales.loader.loadSceneFromFile(VariablesGlobales.mediaDir + "XWing\\torreta-TgcScene.xml").Meshes[0];
     scaleVector                 = new TGCVector3(factorEscala, factorEscala, factorEscala);
     torreta.AutoTransformEnable = false;
     this.vida                   = 1;
     if (VariablesGlobales.SHADERS)
     {
         Effect shader = VariablesGlobales.shaderManager.AskForEffect(ShaderManager.MESH_TYPE.SHADOW);
         if (shader != null)
         {
             torreta.Effect = shader;
         }
         VariablesGlobales.shaderManager.AddObject(this);
     }
     //EMISOR PARTICULAS
     particulaHumo = new ParticleEmitter(VariablesGlobales.mediaDir + "Particulas\\pisada.png", 30);
     particulaHumo.MinSizeParticle    = 1.5f;
     particulaHumo.MaxSizeParticle    = 2;
     particulaHumo.ParticleTimeToLive = 0.2f;
     particulaHumo.CreationFrecuency  = 0.01f;
     particulaHumo.Dispersion         = 1;
     particulaHumo.Speed = new TGCVector3(10, 10, 10);
     collisionObject     = VariablesGlobales.physicsEngine.AgregarTorreta(this, 2 * torreta.BoundingBox.calculateSize());
     Posicionar();
 }
Ejemplo n.º 2
0
 public XwingEnemigo(TGCVector3 posicionInicial, Xwing target, float velocidadInicial, CoordenadaEsferica direccionInicial)
 {
     posicion         = posicionInicial;
     velocidadGeneral = velocidadInicial;
     //Por defecto, se encuentra mirando hacia el z+
     this.coordenadaEsferica = direccionInicial;
     nave = new TgcSceneLoader().loadSceneFromFile(VariablesGlobales.mediaDir + "XWing\\X-Wing-TgcScene.xml");//@ésta deberia ser nuestra nave, no la enemiga!
     nave.Meshes.ForEach(mesh => {
         mesh.AutoTransformEnable = false;
         mesh.Transform           = TGCMatrix.Scaling(scale) *
                                    TGCMatrix.RotationYawPitchRoll(coordenadaEsferica.GetRotation().Y, coordenadaEsferica.GetRotation().X, coordenadaEsferica.GetRotation().Z) *
                                    TGCMatrix.Translation(posicion);
         //Shader
         if (VariablesGlobales.SHADERS)
         {
             Effect shader = VariablesGlobales.shaderManager.AskForEffect(ShaderManager.MESH_TYPE.SHADOW);
             if (shader != null)
             {
                 nave.Meshes.ForEach(m => m.Effect = shader);
             }
             VariablesGlobales.shaderManager.AddObject(this);
         }
     });
     this.target = target;
     //Calcula inicialmente en que direccion esta el xwing principal
     vectorDistancia  = CommonHelper.SumarVectores(target.GetPosition(), -posicion);
     coordenadaAXwing = new CoordenadaEsferica(vectorDistancia.X, vectorDistancia.Y, vectorDistancia.Z);
 }
Ejemplo n.º 3
0
 public WorldSphere(TgcSceneLoader loader, Xwing pivot)
 {
     this.loader          = loader;
     this.pivot           = pivot;
     worldsphere          = loader.loadSceneFromFile("Padawans_media\\XWing\\GeodesicSphere02-TgcScene.xml").Meshes[0];//tiene un solo mesh
     worldsphere.Rotation = new TGCVector3(2, 5, 1);
     worldsphere.Scale    = new TGCVector3(100f, 100f, 100f);
     if (VariablesGlobales.SHADERS)
     {
         Effect shader = VariablesGlobales.shaderManager.AskForEffect(ShaderManager.MESH_TYPE.DEFAULT);
         if (shader != null)
         {
             worldsphere.Effect = shader;
         }
         VariablesGlobales.shaderManager.AddObject(this);
     }
 }
Ejemplo n.º 4
0
        /// <summary>
        ///     n representa la cantidad de pistas que va a graficar
        /// </summary>
        public MainRunway(TgcSceneLoader loader, int n, TgcFrustum frustum, Xwing targetTorretas)
        {
            main_escena_instancia        = new List <ListaMeshPosicionada>();
            main_escena_instancia_shadow = new List <ListaMeshPosicionada>();
            random              = new Random();
            this.loader         = loader;
            this.frustum        = frustum;
            this.target         = targetTorretas;
            escena_bomba        = loader.loadSceneFromFile(VariablesGlobales.mediaDir + "Trench\\TRENCH_RUN.xml");
            escena_alrededores  = loader.loadSceneFromFile(VariablesGlobales.mediaDir + "XWing\\death+star-TgcScene.xml");
            escena_alrededores2 = loader.loadSceneFromFile(VariablesGlobales.mediaDir + "XWing\\death+star2-TgcScene.xml");
            tubo_rojo_gira      = loader.loadSceneFromFile(VariablesGlobales.mediaDir + "XWing\\pipeline-TgcScene.xml");
            tubo_rojo_derecho   = loader.loadSceneFromFile(VariablesGlobales.mediaDir + "XWing\\tuberia-TgcScene.xml");

            if (VariablesGlobales.SHADERS)
            {
                shadow = VariablesGlobales.shaderManager.AskForEffect(ShaderManager.MESH_TYPE.SHADOW);
                VariablesGlobales.shaderManager.AddObject(this);
            }

            this.n = n;

            Escena_Principal();
        }
Ejemplo n.º 5
0
        public override void Init()
        {
            VariablesGlobales.vidas       = 8;
            VariablesGlobales.mediaDir    = this.MediaDir;
            VariablesGlobales.shadersDir  = this.ShadersDir;
            VariablesGlobales.soundDevice = DirectSound.DsDevice;
            VariablesGlobales.loader      = new TgcSceneLoader();

            hud = new HUD();
            //var d3dDevice = D3DDevice.Instance.Device;

            VariablesGlobales.cues_relative_position = new TGCVector2(.05f, .5f);
            VariablesGlobales.cues_relative_scale    = .3f;

            //Shaders & Post-processing @@ ver como hacer pa q estos se carguen primero!!!!
            shaderManager = new ShaderManager();
            VariablesGlobales.shaderManager = shaderManager;//@@@@@TERMINAR: PONERSELO A TODOS LOS MESHES
            postProcess = new PostProcess(this, shaderManager);
            VariablesGlobales.postProcess = postProcess;
            renderer = new Renderer(this, postProcess);

            /*
             * D3DDevice.Instance.Device.Transform.Projection = TGCMatrix.PerspectiveFovLH(D3DDevice.Instance.FieldOfView, D3DDevice.Instance.AspectRatio,
             *      D3DDevice.Instance.ZNearPlaneDistance, D3DDevice.Instance.ZFarPlaneDistance).ToMatrix();
             */
            physicsEngine = new PhysicsEngine();
            VariablesGlobales.physicsEngine = physicsEngine;

            managerSonido = SoundManager.GetInstance();
            VariablesGlobales.managerSonido = managerSonido;


            //VariablesGlobales.elapsedTime debe ser actualizado por tanto va a Update()

            managerElementosTemporales = new TemporaryElementManager();
            VariablesGlobales.managerElementosTemporales = managerElementosTemporales;

            xwing = new Xwing(VariablesGlobales.loader, new TGCVector3(0, 500, 1000));
            VariablesGlobales.xwing = xwing;

            VariablesGlobales.miniMap.agregarTarget(xwing);

            managerEnemigos = new EnemyManager();
            VariablesGlobales.managerEnemigos = managerEnemigos;
            ColocarXwingEnemigos();
            pistaReferencia = new MainRunway(VariablesGlobales.loader, 5, this.Frustum, xwing);

            worldSphere     = new WorldSphere(VariablesGlobales.loader, xwing);
            followingCamera = new FollowingCamera(xwing);

            VariablesGlobales.camara = followingCamera;

            boundingBoxHelper = new BoundingBoxHelper(new SceneElement[] { xwing, pistaReferencia, worldSphere }, new ActiveElementManager[] { managerElementosTemporales });
            cues = new CueManager(new Cue(new DelayCueLauncher(3), "Bitmaps\\WASD.png", VariablesGlobales.cues_relative_scale, VariablesGlobales.cues_relative_position, 3),
                                  new Cue(new DelayCueLauncher(3), "Bitmaps\\Pause.png", VariablesGlobales.cues_relative_scale, VariablesGlobales.cues_relative_position, 3),
                                  new Cue(new DelayCueLauncher(3), "Bitmaps\\Left_Mouse.png", VariablesGlobales.cues_relative_scale, VariablesGlobales.cues_relative_position, 3)
                                  );
            dynamicCueManager = new DynamicCueManager(new Cue(new PositionAABBCueLauncher(xwing, new TGCVector3(0, -30, -13200), new TGCVector3(100, 100, 100)),
                                                              "Bitmaps\\G_Bomb.png", VariablesGlobales.cues_relative_scale, VariablesGlobales.cues_relative_position, 5));
            postProcess.AgregarElemento(xwing);
            postProcess.AgregarElemento(managerElementosTemporales);
            hole = new Hole(new TGCVector3(0, -40, -13875));
            postProcess.AgregarElemento(hole);
            VariablesGlobales.miniMap.agregarObjetoMeta(hole);

            endGameManager = new EndgameManager(this, new EndGameTrigger(new TGCVector3(0, -50, -13900), new TGCVector3(100, 100, 100)),
                                                new LostGameTrigger(xwing, new TGCVector3(0, -30, -14000)));
            VariablesGlobales.endgameManager = endGameManager;

            managerMenu = new MenuManager(new StartMenu(Key.Return), new PauseMenu(Key.Escape));//tiene q ir ultimo pa parar el resto de sonidos
            VariablesGlobales.managerMenu = managerMenu;

            backgroundSceneLeft  = new BackgroundScene(new TGCVector3(500, 100, 1000), new TGCVector3(200, 200, -15000), 100);
            backgroundSceneRight = new BackgroundScene(new TGCVector3(-600, 100, 1000), new TGCVector3(200, 200, -15000), 100);
            backgroundSceneFront = new BackgroundScene(new TGCVector3(500, 100, -15000), new TGCVector3(-1000, 200, -200), 100);
        }