Exemple #1
0
    public void DoSomething()
    {
        if (meActive)
        {
            return;
        }
        switch (groupId)
        {
        case 3789:
            /*GameObject camaraObject = GameObject.FindGameObjectWithTag ("MainCamera");
             * CameraController camaraScript = camaraObject.GetComponent<CameraController> ();
             * camaraScript.ChangeState (CameraState.Zoomed, -100);*/


            //Animator animadorRoca = GameObject.FindGameObjectWithTag ("rocaql").GetComponent<Animator> ();
            //animadorRoca.SetBool ("rocasecae", true);
            break;


        //Aquí Comienzan Acciones Switch Etapa 1

        case 0:
            GameObject firstPlatform = (GameObject)Instantiate(Resources.Load("Prefabs/MovPlatform"));
            firstPlatform.GetComponent <Transform>().position = new Vector2(13.3f, -1f);
            MovingObject firstPlatformScript = firstPlatform.GetComponent <MovingObject>();
            firstPlatformScript.startPoint = new Vector2(13.5f, -1.77f);
            firstPlatformScript.endPoint   = new Vector2(13.5f, 0.36f);
            firstPlatformScript.moveSpeed  = 1f;
            GameObject feedbackswitchEng = (GameObject)Instantiate(Resources.Load("Prefabs/FeedbackParticles/FBMageButt"));
            feedbackswitchEng.GetComponent <Transform>().position = new Vector2(13.2f, -1.3f);
            Destroy(feedbackswitchEng, 3f);
            //MuereParticula hintPart = GameObject.FindGameObjectWithTag("SwitchEnginPart").GetComponent<MuereParticula>();
            //hintPart.living = false;
            break;

        case 1:
            GameObject rejaEng = GameObject.FindGameObjectWithTag("RejaRocaEng");
            rejaEng.SetActive(false);
            Roca roca = GameObject.FindGameObjectWithTag("rocaCaida").GetComponent <Roca>();
            roca.isReady = true;
            GameObject particleRoca = (GameObject)Instantiate(Resources.Load("Prefabs/ParticulasMageRoca"));
            CajaSwitch caja         = GameObject.FindGameObjectWithTag("CajaSwitchFierro").GetComponent <CajaSwitch>();
            caja.meVoy      = true;
            caja.ahoraMeVoy = true;
            GameObject spikes = GameObject.FindGameObjectWithTag("KillPlaneSpikes");
            Destroy(spikes);
            GameObject lavaPool = GameObject.Find("LavaPool");
            Destroy(lavaPool, 1f);
            break;

        case 2:
            Roca rocaGigante = GameObject.FindGameObjectWithTag("rocaCaida").GetComponent <Roca>();
            rocaGigante.caidaOn = true;
            CameraController mainCamera = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <CameraController>();
            mainCamera.ChangeState(CameraState.TargetZoom, 5, 34.9f, -3.06f, false);
            GameObject arbolGigante = GameObject.FindGameObjectWithTag("ArbolCaida");
            caidArbol  arbool       = arbolGigante.GetComponent <caidArbol>();
            arbool.colliderOn = true;                                                                        //arbol
            Animator arbolQl = arbolGigante.GetComponent <Animator>();
            arbolQl.SetBool("RockBottom", true);                                                             //activa camino arbol
            PathSub abreteSesamo = GameObject.FindGameObjectWithTag("openPathSub").GetComponent <PathSub>(); //destruyePasadizo
            abreteSesamo.killMe = true;
            Debug.Log("wiiiiiii");
            break;

        case 3:
            GameObject platescalera = (GameObject)Instantiate(Resources.Load("Prefabs/MovPlatform"));
            platescalera.GetComponent <Transform> ().position = new Vector2(43f, -16f);
            MovingObject secondPlatform = platescalera.GetComponent <MovingObject> ();
            secondPlatform.startPoint = new Vector2(platescalera.transform.position.x, platescalera.transform.position.y);
            secondPlatform.endPoint   = new Vector2(platescalera.transform.position.x, platescalera.transform.position.y + 3.9f);
            secondPlatform.moveSpeed  = 1f;
            GameObject feedbackswitch = (GameObject)Instantiate(Resources.Load("Prefabs/FeedbackParticles/FBMageButt"));
            feedbackswitch.GetComponent <Transform> ().position = new Vector2(41.4f, -16.3f);

            GameObject mageFilter = GameObject.Find("FilterMage");

            if (mageFilter)
            {
                Debug.Log("Tengo un " + mageFilter);
                PlayerFilter playerFilter = mageFilter.GetComponent <PlayerFilter>();
                Debug.Log("Ahora tengo un " + playerFilter);


                if (playerFilter)
                {
                    Debug.Log("Por último tengo un " + playerFilter);

                    playerFilter.SetActive(true);
                }
            }
            break;

        case 4:
            GameObject platparaMage = (GameObject)Instantiate(Resources.Load("Prefabs/MovPlatform"));
            platparaMage.GetComponent <Transform>().position = new Vector2(61f, -9.5f);
            MovingObject platController = platparaMage.GetComponent <MovingObject>();
            platController.startPoint = new Vector2(platparaMage.transform.position.x, platparaMage.transform.position.y);
            platController.endPoint   = new Vector2(platparaMage.transform.position.x, platparaMage.transform.position.y + 1.3f);
            platController.moveSpeed  = 1f;
            GameObject feedbackswitchwarr = (GameObject)Instantiate(Resources.Load("Prefabs/FeedbackParticles/FBMageButt"));
            feedbackswitchwarr.GetComponent <Transform>().position = new Vector2(72.86f, -19.3f);
            Destroy(feedbackswitchwarr, 4f);
            GameObject comebackMessage = (GameObject)Instantiate(Resources.Load("Prefabs/ActivateNPC"));
            comebackMessage.transform.position = new Vector2(70f, -19.2f);

            /* Instantiate Arrow feedback*/
            GameObject arrowIndicadora = (GameObject)Instantiate(Resources.Load("Sprites/Arrows/warriorArrowLeft"));
            arrowIndicadora.GetComponent <Transform>().position = new Vector2(70.7f, -20f);
            GameObject arrowFeedback = (GameObject)Instantiate(Resources.Load("Prefabs/FeedbackParticles/warriorFeedbackSmall"));
            arrowFeedback.GetComponent <Transform>().position = new Vector2(70.7f, -20f);


            break;

        case 5:
            GameObject platEnginUp = (GameObject)Instantiate(Resources.Load("Prefabs/PlataformaPastVoladora"));
            platEnginUp.GetComponent <Transform>().position = new Vector2(39f, 7.5f);
            GameObject platEnginUp2 = (GameObject)Instantiate(Resources.Load("Prefabs/PlataformaPastVoladora"));
            platEnginUp2.GetComponent <Transform>().position = new Vector2(36f, 7.5f);
            break;

        case 6:
            GameObject exp6 = (GameObject)Instantiate(Resources.Load("Prefabs/Ambientales/Exp"));
            exp6.GetComponent <Transform>().position = new Vector2(14.1f, -6.3f);
            GameObject exp61 = (GameObject)Instantiate(Resources.Load("Prefabs/Ambientales/Exp"));
            exp61.GetComponent <Transform>().position = new Vector2(14.3f, -6.3f);
            GameObject exp62 = (GameObject)Instantiate(Resources.Load("Prefabs/Ambientales/Exp"));
            exp62.GetComponent <Transform>().position = new Vector2(13.6f, -6.3f);
            GameObject exp63 = (GameObject)Instantiate(Resources.Load("Prefabs/Ambientales/Exp"));
            exp63.GetComponent <Transform>().position = new Vector2(13.1f, -6.3f);
            GameObject exp64 = (GameObject)Instantiate(Resources.Load("Prefabs/Ambientales/Exp"));
            exp64.GetComponent <Transform>().position = new Vector2(15f, -6.3f);
            GameObject exp65 = (GameObject)Instantiate(Resources.Load("Prefabs/Ambientales/Exp"));
            exp65.GetComponent <Transform>().position = new Vector2(15f, -6.3f);
            break;

        case 7:
            GameObject exp7 = (GameObject)Instantiate(Resources.Load("Prefabs/Ambientales/Exp"));
            exp7.GetComponent <Transform>().position = new Vector2(62f, -14.23f);
            GameObject exp71 = (GameObject)Instantiate(Resources.Load("Prefabs/Ambientales/Exp"));
            exp71.GetComponent <Transform>().position = new Vector2(62.5f, -14.23f);
            GameObject exp72 = (GameObject)Instantiate(Resources.Load("Prefabs/Ambientales/Exp"));
            exp72.GetComponent <Transform>().position = new Vector2(64f, -14.23f);
            GameObject exp73 = (GameObject)Instantiate(Resources.Load("Prefabs/Ambientales/Exp"));
            exp73.GetComponent <Transform>().position = new Vector2(61.5f, -14.23f);
            GameObject exp74 = (GameObject)Instantiate(Resources.Load("Prefabs/Ambientales/Exp"));
            exp74.GetComponent <Transform>().position = new Vector2(63f, -14.23f);
            GameObject exp75 = (GameObject)Instantiate(Resources.Load("Prefabs/Ambientales/Exp"));
            exp75.GetComponent <Transform>().position = new Vector2(63.5f, -14.23f);
            GameObject exp76 = (GameObject)Instantiate(Resources.Load("Prefabs/Ambientales/Exp"));
            exp76.GetComponent <Transform>().position = new Vector2(62f, -14.23f);
            GameObject exp77 = (GameObject)Instantiate(Resources.Load("Prefabs/Ambientales/Exp"));
            exp77.GetComponent <Transform>().position = new Vector2(62.5f, -14.23f);
            GameObject exp78 = (GameObject)Instantiate(Resources.Load("Prefabs/Ambientales/Exp"));
            exp78.GetComponent <Transform>().position = new Vector2(64f, -14.23f);
            GameObject exp79 = (GameObject)Instantiate(Resources.Load("Prefabs/Ambientales/Exp"));
            exp79.GetComponent <Transform>().position = new Vector2(61.5f, -14.23f);
            GameObject exp71b = (GameObject)Instantiate(Resources.Load("Prefabs/Ambientales/Exp"));
            exp71b.GetComponent <Transform>().position = new Vector2(63f, -14.23f);
            GameObject exp71c = (GameObject)Instantiate(Resources.Load("Prefabs/Ambientales/Exp"));
            exp71c.GetComponent <Transform>().position = new Vector2(63.5f, -14.23f);
            break;

        case 8:

            break;

        /* Aquí Comienzan Acciones Escena Tutorial*/

        /* Start Switches Mage */

        case 9:         // Primeros peldaños para mage
            GameObject particleFeedback = (GameObject)Instantiate(Resources.Load("Prefabs/FeedbackParticles/FBMageButt"));
            particleFeedback.transform.position = new Vector2(26.5f, -43.6f);
            GameObject primerPlat = (GameObject)Instantiate(Resources.Load("Prefabs/SueloMetalFlotante"));
            primerPlat.transform.position = new Vector2(23f, -43.5f);
            GameObject primerPlat2 = (GameObject)Instantiate(Resources.Load("Prefabs/SueloMetalFlotante"));
            primerPlat2.transform.position = new Vector2(23.4f, -42.3f);

            break;

        case 10:        // peldaño switch 2

            GameObject particleFeedback2 = (GameObject)Instantiate(Resources.Load("Prefabs/FeedbackParticles/FBMageButt"));
            particleFeedback2.transform.position = new Vector2(26.5f, -42.11f);
            GameObject secondPlat = (GameObject)Instantiate(Resources.Load("Prefabs/SueloMetalFlotante"));
            secondPlat.transform.position = new Vector2(23f, -41.2f);
            //GameObject primerPlat2 = (GameObject)Instantiate(Resources.Load("Prefabs/SueloMetalFlotante"));
            //primerPlat2.transform.position = new Vector2(23.4f, -42.3f);


            break;

        case 11:        // peldaño 3rd Switch + Exp
            GameObject secondPlat1 = (GameObject)Instantiate(Resources.Load("Prefabs/SueloMetalFlotante"));
            secondPlat1.transform.position = new Vector2(24.3f, -40.5f);
            break;


        case 12:        // disparo primeros 2 switch.
            GameObject lilPlatform = (GameObject)Instantiate(Resources.Load("Prefabs/SueloMetalFlotante"));
            lilPlatform.transform.position = new Vector2(44.1f, 3.75f);
            break;

        case 13:        // Disparo tercer switch
            GameObject lilMovPlatform = (GameObject)Instantiate(Resources.Load("Prefabs/MovPlatform"));
            lilMovPlatform.transform.position = new Vector2(43.1f, 3.7f);
            MovingObject movPlat1 = lilMovPlatform.GetComponent <MovingObject>();
            movPlat1.startPoint = new Vector2(43.1f, 3.7f);
            movPlat1.endPoint   = new Vector2(43.1f, 7f);
            movPlat1.moveSpeed  = 1f;
            break;

        case 14:       // Dispar Switches que se mueven
            GameObject lilMovPlatform2 = (GameObject)Instantiate(Resources.Load("Prefabs/MovPlatform"));
            lilMovPlatform2.transform.position = new Vector2(35.5f, 6.72f);
            MovingObject movPlat2 = lilMovPlatform2.GetComponent <MovingObject>();
            movPlat2.startPoint = new Vector2(36.5f, 6.72f);
            movPlat2.endPoint   = new Vector2(36.5f, 9.35f);
            movPlat2.moveSpeed  = 1f;
            break;

        case 15:
            GameObject lilPlatform2 = (GameObject)Instantiate(Resources.Load("Prefabs/SueloMetalFlotante"));
            lilPlatform2.transform.position = new Vector2(40.03f, 12.17f);
            GameObject lilPlatform3 = (GameObject)Instantiate(Resources.Load("Prefabs/SueloMetalFlotante"));
            lilPlatform3.transform.position = new Vector2(38.6f, 11.58f);
            //GameObject hojasArbol = (GameObject)Instantiate(Resources.Load("Prefabs/Ambientales/HojasPlat"));
            //hojasArbol.transform.position = new Vector2(35.55f, 12.03f);
            break;

        case 16:
            GameObject lilMovPlatform3 = (GameObject)Instantiate(Resources.Load("Prefabs/MovPlatform"));
            lilMovPlatform3.transform.position = new Vector2(50.35f, 14f);
            MovingObject movPlat3 = lilMovPlatform3.GetComponent <MovingObject>();
            movPlat3.startPoint = new Vector2(50.35f, 14f);
            movPlat3.endPoint   = new Vector2(50.35f, 21f);
            movPlat3.moveSpeed  = 1.2f;
            GameObject plataformaFinal = (GameObject)Instantiate(Resources.Load("Prefabs/PlataformaPastVoladora"));
            plataformaFinal.transform.position = new Vector2(48.37f, 21f);
            break;

        default:
            break;

            //GameObject tevoyamataroe = GameObject.FindGameObjectWithTag ("plataforma1");
            //GameObject.Destroy (tevoyamataroe);
            //GameObject fireball = (GameObject)Instantiate (Resources.Load ("Prefabs/Attacks/BolaM1"));
            //fireball.GetComponent<Transform> ().position = new Vector2 (3, 4);*/
        }
        meActive = true;
    }
Exemple #2
0
        public void Init()
        {
            // Inicializo las Escalas
            SceneScaleY  = 3 * 40f;
            SceneScaleXZ = 30 * 400f;

            //Cargar Heightmap y textura de la Escena
            HeightmapSize = new Bitmap(sceneHeightmapPath);

            terrainCenter            = new Vector3(0, 0, 0);
            terrain                  = new TerrenoCustom();
            terrain.AlphaBlendEnable = true;
            terrain.loadHeightmap(sceneHeightmapPath, SceneScaleXZ, SceneScaleY, terrainCenter);
            terrain.loadTexture(terrainTexturePath);

            // Creo el agua
            effectAgua = TgcShaders.loadEffect(env.ShadersDir + "BasicShader.fx");

            mar = new TerrenoCustom();
            mar.AlphaBlendEnable = true;
            mar.loadHeightmap(marHeightmapPath, 9 * SceneScaleXZ, 2 * SceneScaleY, new Vector3(0, -200, 0));
            mar.loadTexture(marTexturePath);
            mar.Effect    = effectAgua;
            mar.Technique = "RenderScene";

            laguna = new TerrenoCustom();
            laguna.AlphaBlendEnable = true;
            laguna.loadHeightmap(lagunaHeightmapPath, SceneScaleXZ / 4, SceneScaleY / 2, new Vector3(10, 10, 40));
            laguna.loadTexture(lagunaTexturePath);
            laguna.Effect    = effectAgua;
            laguna.Technique = "RenderLaguna";


            // Creo el SkyBox
            CreateSkyBox();

            // La ubicacion de los Mesh es en coordenadas Originales del HeightMap (sin escalado) [-128,128]
            SceneMeshes  = new List <TgcMesh>();
            Destroyables = new List <ObjetoEscena>();
            loader       = new TgcSceneLoader();

            rockModel = new Roca(env);
            //CreateObjectsFromModel(rockModel.mesh, 100, new Vector3(0, 0, 0), new Vector3(0.9f, 0.9f, 0.9f), (HeightmapSize.Width / 3), new float[] { 30f, 35f, 40f, 45f });
            CreateObjectsFromModel(rockModel.mesh, 300, new Vector3(0, 0, 0), new Vector3(0.9f, 1.3f, 1.7f), (HeightmapSize.Width / 2) - 10, new float[] { 30f, 35f, 40f, 45f });

            palmModel = new Palmera(env);
            //CreateObjectsFromModel(palmModel.mesh, 50, new Vector3((HeightmapSize.Width / 5)*-1, 0, 0), new Vector3(0.5f, 0.5f, 0.5f), (HeightmapSize.Width / 3), new float[] { 60f, 65f, 70f, 75f });
            //CreateObjectsFromModel(palmModel.mesh, 50, new Vector3((HeightmapSize.Width / 6), 0, (HeightmapSize.Width / 6)), new Vector3(0.5f, 0.5f, 0.5f), (HeightmapSize.Width / 6) * 2, new float[] { 60f, 65f, 70f, 75f });
            CreateObjectsFromModel(palmModel.mesh, 300, new Vector3(0, 0, 0), new Vector3(0.5f, 0.7f, 0.9f), (HeightmapSize.Width / 2) - 10, new float[] { 60f, 65f, 70f, 75f });

            //arbolModel = new Arbol(env);
            //CreateObjectsFromModel(arbolModel.mesh, 30, new Vector3(10, 0, 10), new Vector3(0.8f, 0.8f, 0.8f), 20, new float[] { 50f, 55f, 60f, 65f });

            frutaModel = new Fruta(env);
            CreateObjectsFromModel(frutaModel.mesh, 150, new Vector3(0, 0, 0), new Vector3(0.8f, 0.8f, 0.8f), (HeightmapSize.Width / 2) - 10, new float[] { 2f, 2f, 2f, 2f });

            pinoModel = new Pino(env);
            //CreateObjectsFromModel(pinoModel.mesh, 100, new Vector3((HeightmapSize.Width / 4), 0, 0), new Vector3(0.8f, 0.8f, 0.8f), (HeightmapSize.Width / 4)-10, new float[] { 50, 55f, 60f, 65f });
            //CreateObjectsFromModel(pinoModel.mesh, 100, new Vector3(0, 0, (HeightmapSize.Width / 4)), new Vector3(0.8f, 0.8f, 0.8f), (HeightmapSize.Width / 4)-10, new float[] { 50, 55f, 60f, 65f });
            CreateObjectsFromModel(pinoModel.mesh, 100, new Vector3(0, 0, 0), new Vector3(0.8f, 0.9f, 1.1f), (HeightmapSize.Width / 2) - 10, new float[] { 50, 55f, 60f, 65f });

            //plantModel = loader.loadSceneFromFile(plantMeshPath).Meshes[0];
            //CreateObjectsFromModel(plantModel, 70, new Vector3(75, 0, -75), new Vector3(0.8f, 0.8f, 0.8f), 75, new float[] { 50f, 55f, 60f, 65f });

            //palm2Model = loader.loadSceneFromFile(palm2MeshPath).Meshes[0];
            //CreateObjectsFromModel(palm2Model, 70, new Vector3(-20, 0, -50), new Vector3(0.8f, 0.8f, 0.8f), 80, new float[] { 10f, 15f, 20f, 25f });

            //arbolFrutalModel = loader.loadSceneFromFile(arbolFrutalMeshPath).Meshes[0];
            //CreateObjectsFromModel(arbolFrutalModel, 30, new Vector3(-75, 0, 75), new Vector3(0.8f, 0.8f, 0.8f), 50, new float[] { 50, 55f, 60f, 65f });

            //palm3Model = loader.loadSceneFromFile(palm3MeshPath).Meshes[0];
            //CreateObjectsFromModel(palm3Model, 70, new Vector3(-10, 0, -60), new Vector3(0.8f, 0.8f, 0.8f), 80, new float[] { 10f, 15f, 20f, 25f });


            var fogataModel = loader.loadSceneFromFile(fogataPath);

            fogata = fogataModel.Meshes[0];

            fogata.AutoTransformEnable = true;
            fogata.Scale            = new Vector3(30f, 30f, 30f);
            fogata.Position         = new Vector3(0, 0, 0);
            fogata.AlphaBlendEnable = true;
            fogata.Enabled          = true;

            // Inicializo el Fuego
            emisorFuego          = new ParticleEmitter(env.MediaDir + "Fogata2\\fuego.png", 30);
            emisorFuego.Position = new Vector3(0, 0, 0);

            emisorFuego.MinSizeParticle    = 5.5f;
            emisorFuego.MaxSizeParticle    = 10f;
            emisorFuego.ParticleTimeToLive = 1.5f;
            emisorFuego.CreationFrecuency  = 0.25f;
            emisorFuego.Dispersion         = 50;
            emisorFuego.Speed = new Vector3(50f, 50f * SceneScaleY, 50f);


            //Crear Quadtree: Defino el BoundinBox del Escenario
            triangle    = new CustomVertex.PositionColored[5];
            triangle[0] = new CustomVertex.PositionColored((HeightmapSize.Width / 2) * -1 * SceneScaleXZ, 0, 0, Color.Green.ToArgb());
            triangle[1] = new CustomVertex.PositionColored(0, 0, (HeightmapSize.Width / 2) * SceneScaleXZ, Color.Green.ToArgb());
            triangle[2] = new CustomVertex.PositionColored(0, (HeightmapSize.Width) * SceneScaleY, 0, Color.Green.ToArgb());

            triangle[3] = new CustomVertex.PositionColored((HeightmapSize.Width / 2) * SceneScaleXZ, 0, 0, Color.Green.ToArgb());
            triangle[4] = new CustomVertex.PositionColored(0, 0, (HeightmapSize.Width / 2) * -1 * SceneScaleXZ, Color.Green.ToArgb());

            terrainBoundingBox =
                TgcBoundingAxisAlignBox.computeFromPoints(new[]
                                                          { triangle[0].Position, triangle[1].Position, triangle[2].Position, triangle[3].Position, triangle[4].Position });

            quadtree = new Quadtree();
            quadtree.create(SceneMeshes, terrainBoundingBox);
            quadtree.createDebugQuadtreeMeshes();
        }