-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPuerta.cs
More file actions
65 lines (60 loc) · 2.08 KB
/
Copy pathPuerta.cs
File metadata and controls
65 lines (60 loc) · 2.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
using System;
using System.Collections.Generic;
using System.Text;
using TgcViewer.Example;
using TgcViewer;
using Microsoft.DirectX.Direct3D;
using System.Drawing;
using Microsoft.DirectX;
using TgcViewer.Utils.TgcSceneLoader;
using TgcViewer.Utils.TgcGeometry;
namespace AlumnoEjemplos.GODMODE
{
class Puerta
{
public TgcMesh mesh;
public Boolean girando;
public Boolean abierta;
public float angulo;
public float anguloOriginal;
TgcSceneLoader loader;
public Puerta(String alumnoMediaFolder, Vector3 posicion, Vector3 escala, Vector3 rotation)
{
this.girando = false;
this.loader = new TgcSceneLoader();
this.angulo = 1.6f;
this.abierta = false;
TgcScene escena = loader.loadSceneFromFile(alumnoMediaFolder + "GODMODE\\Media\\puerta-TgcScene.xml",
alumnoMediaFolder + "GODMODE\\Media\\");
anguloOriginal = rotation.Y;
this.mesh = escena.Meshes[0];
this.mesh.Position = posicion;
this.mesh.Scale = escala;
this.mesh.Rotation = rotation;
}
public void actualizarPuerta(float elapsedTime) // poner girando en true para que gire
{ if (girando == true && abierta == true)
{
angulo += (elapsedTime / 3) * 1.605f;
if (angulo >= 1.605) {
angulo = 1.605f;
girando = false;
EjemploAlumno.esperandoPuerta = false;
abierta = false;
}
}
if(girando == true && abierta ==false)
{
angulo -= (elapsedTime / 3) * 1.605f;
if (angulo <= 0.05)
{
angulo = 0.05f;
girando = false;
EjemploAlumno.esperandoPuerta = false;
abierta = true;
}
}
mesh.Rotation = new Vector3(mesh.Rotation.X, anguloOriginal + angulo, mesh.Rotation.Z);
}
}
}