Example #1
0
        public Personaje()
        {
            estoyAdentro   = true;
            estoyEscondido = false;

            positionChanged = true;
            rotationChanged = true;

            posicionInicial = new TGCVector3(100f, 15f, 100f); //Estaria piola que arranque afuera del indoor

            target = new TGCVector3(100f, 15f, 150f);
            eye    = new TGCVector3(100f, 15f, 100f);

            ItemVacioDefault itemDefault = new ItemVacioDefault();

            objetosInteractuables.Add(itemDefault);

            this.itemEnMano = itemDefault;

            var loader = new TgcSceneLoader();
            var scene2 = loader.loadSceneFromFile(MediaDir + "Modelame\\GhostGrande-TgcScene.xml"); //Con demon no funca, aca rompe

            //Solo nos interesa el primer modelo de esta escena (tiene solo uno)
            meshPersonaje = scene2.Meshes[0];

            const float cte = 15f;

            meshPersonaje.Position = new TGCVector3(100f, cte, 100f);
            meshPersonaje.Scale    = new TGCVector3(0f, 0.5f, 0f);

            const int cteY = -570;

            meshPersonaje.BoundingBox = new TgcBoundingAxisAlignBox(new TGCVector3(-20, cteY, -20), new TGCVector3(20, 20, 20));


            // \todo: configurable
            float half_box = 4.0f;

            boundingBox = new TgcBoundingAxisAlignBox(
                new TGCVector3(eye.X - half_box, 0.0f, eye.Z - half_box),
                new TGCVector3(eye.X + half_box, eye.Y, eye.Z + half_box));

            vM = TGCMatrix.Identity;

            xAxis       = new TGCVector3();
            yAxis       = new TGCVector3();
            zAxis       = new TGCVector3();
            forward     = new TGCVector3();
            key_left    = 'A';
            key_back    = 'S';
            key_right   = 'D';
            key_forward = 'W';

            absoluteRotationX = 0.0f;

            MovementSpeed  = 50.0f;
            ForwardFactor  = 1.5f;
            RotationSpeed  = 1.5f;
            MaxTopAngle    = 88.0f;
            MaxBottomAngle = -80.0f;
            CurrentSpeed   = MovementSpeed;

            Control window = D3DDevice.Instance.Device.CreationParameters.FocusWindow;

            windowCenter = window.PointToScreen(
                new Point(window.Width / 2, window.Height / 2));

            lockMouse = false;

            Enable = true;

            setCamera(eye, target);
        }
        public Personaje()
        {
            estoyAdentro   = false;
            estoyEscondido = false;
            estoyArriba    = false;

            positionChanged = true;
            rotationChanged = true;

            posicionInicial = new TGCVector3(9500f, 15f, -15000f);
            target          = new TGCVector3(9500f, 15f, -15050f);
            eye             = new TGCVector3(9500f, 15f, -15000f);

            ItemVacioDefault itemDefault = new ItemVacioDefault();

            objetosInteractuables.Add(itemDefault);

            this.itemEnMano = itemDefault;

            var loader = new TgcSceneLoader();
            var scene2 = loader.loadSceneFromFile(MediaDir + "Modelame\\GhostGrande-TgcScene.xml"); //Con demon no funca, aca rompe

            //Solo nos interesa el primer modelo de esta escena (tiene solo uno)
            meshPersonaje = scene2.Meshes[0];

            const float cte = 15f;

            meshPersonaje.Position = new TGCVector3(9500f, 15f, -15000f);
            meshPersonaje.Scale    = new TGCVector3(0f, 0.5f, 0f);
            const int cteY = -570;

            meshPersonaje.BoundingBox = new TgcBoundingAxisAlignBox(new TGCVector3(-20, cteY, -20), new TGCVector3(20, 20, 20));
            meshPersonaje.Transform   = TGCMatrix.Scaling(meshPersonaje.Scale) *
                                        TGCMatrix.RotationYawPitchRoll(meshPersonaje.Rotation.Y, meshPersonaje.Rotation.X, meshPersonaje.Rotation.Z) *
                                        TGCMatrix.Translation(meshPersonaje.Position);



            // \todo: configurable
            float half_box = 4.0f;

            boundingBox = new TgcBoundingAxisAlignBox(
                new TGCVector3(eye.X - half_box, 0.0f, eye.Z - half_box),
                new TGCVector3(eye.X + half_box, eye.Y, eye.Z + half_box));

            vM = TGCMatrix.Identity;

            xAxis       = new TGCVector3();
            yAxis       = new TGCVector3();
            zAxis       = new TGCVector3();
            forward     = new TGCVector3();
            key_left    = 'A';
            key_back    = 'S';
            key_right   = 'D';
            key_forward = 'W';

            absoluteRotationX = 0.0f;
            anguloAbsolutoEnY = 0f;

            MovementSpeed  = 50.0f;
            ForwardFactor  = 1.5f;
            RotationSpeed  = 1.5f;
            MaxTopAngle    = 88.0f;
            MaxBottomAngle = -80.0f;
            CurrentSpeed   = MovementSpeed;

            Control window = D3DDevice.Instance.Device.CreationParameters.FocusWindow;

            windowCenter = window.PointToScreen(
                new Point(window.Width / 2, window.Height / 2));

            lockMouse = false;

            Enable = true;

            setCamera(eye, target);

            //SONIDO

            this.CaminataOutdoorIzq = new Sonido("pisada hierba izda.wav", -5000, false);
            this.CaminataIndoorIzq  = new Sonido("pisada azulejo izda.wav", -5000, false);
            this.CaminataOutdoorDer = new Sonido("pisada hierba dcha.wav", -5000, false);
            this.CaminataIndoorDer  = new Sonido("pisada azulejo dcha.wav", -5000, false);
            sonidoActualDer         = CaminataOutdoorDer;
            sonidoActualIzq         = CaminataOutdoorIzq;
        }