Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge de dev a Relese #51

Open
wants to merge 184 commits into
base: master
Choose a base branch
from
Open
Changes from 4 commits
Commits
Show all changes
184 commits
Select commit Hold shift + click to select a range
cb6e337
Update README.md
LucasGelabert Apr 24, 2024
c3c89a4
avances
SantiSauce Apr 28, 2024
05f9de7
avances
SantiSauce Apr 28, 2024
e7a4998
primer aproximiacion para agregar las texturas de la casa
tomasZubizarreta Apr 28, 2024
9330626
añadimos estructuras
SimonCutreraUTN Apr 29, 2024
616bb64
Agregado el basicEffect pero ahora la textura es negra
tomasZubizarreta Apr 29, 2024
2f7700c
Arreglos Varios, Eliminacion de TGCGames y remplazo por TankGame
LucasGelabert Apr 29, 2024
adeffba
Eliminacion de TGCGames y remplazo por TankGame
LucasGelabert Apr 29, 2024
86aae86
Git Merge Conflict Resuelto
LucasGelabert Apr 29, 2024
b71f1ed
Movimiento De Torreta Beta
LucasGelabert Apr 29, 2024
c4ca926
Avances, check en mapScene
SantiSauce Apr 30, 2024
b67d440
Correccion
SantiSauce Apr 30, 2024
511d2c9
var para obstaculos
SimonCutreraUTN Apr 30, 2024
a991348
añado bordes
SimonCutreraUTN Apr 30, 2024
0c5d353
avances
SantiSauce Apr 30, 2024
13a6219
Update README - Nombres.md
LucasGelabert Apr 30, 2024
02a152c
Free Camera Update
LucasGelabert May 1, 2024
7ff69aa
Avances
SantiSauce May 1, 2024
36635b0
Update 0.1.0 Tank Movement
LucasGelabert May 7, 2024
15fc6f4
Modificaciones Varias 1 .md
LucasGelabert May 7, 2024
6dbc3f5
Update README.md
LucasGelabert May 7, 2024
2603367
Fix
LucasGelabert May 14, 2024
01ee113
Agregados proyectiles
tomasZubizarreta May 14, 2024
c9d5cd8
ManageShoot (Fix V1.0)
LucasGelabert May 16, 2024
48c550e
Collisions (V1.0)
tomasZubizarreta May 16, 2024
130d3af
Avances - Sin basic effect
SantiSauce May 20, 2024
2e95736
Se agregan texturas
SantiSauce May 20, 2024
78ce58b
Avances
SantiSauce May 20, 2024
c478f8c
correccion torreta
SantiSauce May 20, 2024
58efd49
Movimiento Tanque y camara
LucasGelabert May 20, 2024
16abbae
parte de las colisiones y cambios en la bala del tanque
tomasZubizarreta May 21, 2024
5aa7add
Rocket
tomasZubizarreta May 21, 2024
7dada9a
agregados logs para verificar comportamiento
tomasZubizarreta May 21, 2024
a160d01
correcciones en bounding boxes
tomasZubizarreta May 21, 2024
567eb05
Se agrega rotacion de enemigos
SantiSauce May 21, 2024
eedc7f1
Se agregan tanques enemigos
SantiSauce May 21, 2024
721971f
casi colisiones
tomasZubizarreta May 22, 2024
fdcd69d
Merge remote-tracking branch 'origin/dev' into Relese
tomasZubizarreta May 22, 2024
f0edcdf
mios
LucasGelabert May 22, 2024
96bed1d
Mios-2
LucasGelabert May 22, 2024
bac7f79
Intento de gizmo
SantiSauce May 22, 2024
1a915f6
Merge
LucasGelabert May 22, 2024
c7bd5d6
Merge branch 'dev' into Relese
LucasGelabert May 22, 2024
99cdf04
git
LucasGelabert May 22, 2024
0a34668
Correxion Errores
LucasGelabert May 22, 2024
4c624de
Gizmos
SantiSauce May 22, 2024
f16a067
Merge branch 'dev' into Relese
LucasGelabert May 22, 2024
d81b4d3
Correccion Shader
SantiSauce May 22, 2024
bed360b
Arreglos Varios De Codigo
LucasGelabert May 22, 2024
0b0febd
Correxiones Varias
LucasGelabert May 22, 2024
c0ed4b0
Arreglos Varios
LucasGelabert May 23, 2024
a6d77f3
agrego mipmapping
SimonCutreraUTN Jun 2, 2024
3149f61
Fix Errores Varios y Mira
LucasGelabert Jun 2, 2024
5b71636
Merge branch 'dev' of https://github.com/LucasGelabert/2024-1C-3015-T…
LucasGelabert Jun 2, 2024
6d79281
Colisiones v1.1
tomasZubizarreta Jun 2, 2024
3b53a2e
Fix Colitions
LucasGelabert Jun 3, 2024
8592e0d
Fix Mira y Bullet
LucasGelabert Jun 3, 2024
89bc4c4
Modificacion de proyectil y fix mira
LucasGelabert Jun 3, 2024
4025eba
Se agrega menu
SantiSauce Jun 3, 2024
73f86ff
Se agrega logica de colision
SantiSauce Jun 3, 2024
6d54635
Avances
SantiSauce Jun 4, 2024
458e56a
cambios en proyectiles y en casa
tomasZubizarreta Jun 4, 2024
c94181b
Gizmos
SimonCutreraUTN Jun 4, 2024
454c3d8
Colisiones
tomasZubizarreta Jun 4, 2024
f2dde71
Se agregan texturas
SantiSauce Jun 4, 2024
89af88e
Merge branch 'dev' of https://github.com/LucasGelabert/2024-1C-3015-T…
SantiSauce Jun 4, 2024
8d54287
Avances Menu
SantiSauce Jun 4, 2024
0d1755c
mipmapping arboles
SimonCutreraUTN Jun 4, 2024
a8ab42c
Avances
SantiSauce Jun 4, 2024
931aac6
Merge branch 'dev' of https://github.com/LucasGelabert/2024-1C-3015-T…
SantiSauce Jun 4, 2024
570dae0
Avances
SantiSauce Jun 4, 2024
84b1fe5
base de hud
SimonCutreraUTN Jun 4, 2024
c54eece
merge y principio de hud
SimonCutreraUTN Jun 4, 2024
5743214
add: hud
SimonCutreraUTN Jun 4, 2024
9003f09
Agrego Props
LucasGelabert Jun 4, 2024
1364cf7
Merge branch 'dev' of https://github.com/LucasGelabert/2024-1C-3015-T…
LucasGelabert Jun 4, 2024
490f77f
fix
SimonCutreraUTN Jun 4, 2024
584e0dd
Fix Varios
LucasGelabert Jun 4, 2024
082b4d6
Merge branch 'dev' of https://github.com/LucasGelabert/2024-1C-3015-T…
LucasGelabert Jun 4, 2024
0ac2aa2
Disparan tanques enemigos
tomasZubizarreta Jun 4, 2024
9b1afc1
tanques enemigos hacen daño
tomasZubizarreta Jun 5, 2024
436dfa6
Se agregan texturas
SantiSauce Jun 5, 2024
a856d40
Merge branch 'dev' of https://github.com/LucasGelabert/2024-1C-3015-T…
SantiSauce Jun 5, 2024
74aea8d
Intento de agregar modelo en menu
SantiSauce Jun 5, 2024
293c2df
Merge
LucasGelabert Jun 5, 2024
02217a7
Fix Movimiento Bounding Boxes
LucasGelabert Jun 5, 2024
34413e8
Fix Errors
LucasGelabert Jun 5, 2024
4564b2c
Ordenamiento de codigo
LucasGelabert Jun 5, 2024
1ffc8cc
Fix autodisparo (Coliciones)
LucasGelabert Jun 7, 2024
58c6ddb
Fix: BoundingBox de TanquesEnemigos. Optimizacion Projectiles
LucasGelabert Jun 10, 2024
9c25924
Fix: Crosshair, Tanque 3D del menu, Ordenamiento de codigo y dependen…
LucasGelabert Jun 11, 2024
69513de
Add: Textos Menu, Audio Engine, Nuevo Spawn, Varios
LucasGelabert Jun 11, 2024
5506b28
Fix: Se arreglo el error de posicion erronea de tanque
LucasGelabert Jun 11, 2024
982b328
Se agrega logica de lifeBar
SantiSauce Jun 12, 2024
e8dcfef
Trate de agregar transformacion de vertices en tanque
SantiSauce Jun 12, 2024
e4a6387
shader deformacion al impacto
SimonCutreraUTN Jun 13, 2024
a09971f
My Changes
LucasGelabert Jun 13, 2024
825b2cf
My Changes 2
LucasGelabert Jun 13, 2024
22428ab
My Changes
LucasGelabert Jun 13, 2024
4e38efd
Add: Contador de FPS; Fix: Organizacion Varia
LucasGelabert Jun 13, 2024
8d033d2
los tres tanques enemigos disparan en distintos intervalos
tomasZubizarreta Jun 14, 2024
a13fcc5
Fix: FPS ahora se muestran correctamente
LucasGelabert Jun 14, 2024
b6197be
Add: Nuevo modelo de tanque enemigo
LucasGelabert Jun 15, 2024
7a136fe
agregado moviemento de oruga
tomasZubizarreta Jun 16, 2024
0385576
Add: Hierva, Character en el menu
LucasGelabert Jun 17, 2024
42ddb1e
Fix: TextureCoordenates, Add: Grass, Character Model
LucasGelabert Jun 17, 2024
7eb0969
Se agrega iluminacion
SantiSauce Jun 19, 2024
1f1df8f
Add: Nuevos modelos de Arboles, Rotacion de Piedras
LucasGelabert Jun 21, 2024
fd35bcb
Fix: Random pasa a ser variable global
LucasGelabert Jun 21, 2024
4e41bdf
Fix: BoundingBox de Casa Add: New Model MiniShack
LucasGelabert Jun 22, 2024
a0fc01e
Intento de heightmap
SantiSauce Jun 23, 2024
c88af35
Merge branch 'dev' of https://github.com/LucasGelabert/2024-1C-3015-T…
SantiSauce Jun 23, 2024
9d74aa6
Cambios en el comportamiento del Tanque enemigo.
tomasZubizarreta Jun 23, 2024
f879a42
Se agrega lightBox
SantiSauce Jun 24, 2024
67b2acd
Avances
SantiSauce Jun 24, 2024
0889f80
Corrección
SantiSauce Jun 24, 2024
513531c
shader de impacto casi terminado
SimonCutreraUTN Jun 24, 2024
d303887
Merge branch 'dev' of https://github.com/LucasGelabert/2024-1C-3015-T…
SimonCutreraUTN Jun 24, 2024
0dea471
impact shader full sin balas ni acumulativo
SimonCutreraUTN Jun 24, 2024
7c80be3
Avance heightMap
SantiSauce Jun 24, 2024
4afbf99
Merge branch 'dev' of https://github.com/LucasGelabert/2024-1C-3015-T…
SantiSauce Jun 24, 2024
e68cd85
Heightmap funcional
SantiSauce Jun 24, 2024
4397e36
shader de impactos 2.0 (beta)
SimonCutreraUTN Jun 24, 2024
e800255
shader impact experimental
SimonCutreraUTN Jun 24, 2024
00a7e1e
Add: Los Shaders ahora estan unidos y son dos pasadas diferentes
LucasGelabert Jun 25, 2024
fc6f090
Tests
LucasGelabert Jun 25, 2024
6fd9264
fixes
SimonCutreraUTN Jun 25, 2024
cff72c4
ADD: base para posprocessing
SimonCutreraUTN Jun 26, 2024
b91f5b9
agregado el Frustum
tomasZubizarreta Jun 27, 2024
42d92a4
cambios cuando la oruga rota
tomasZubizarreta Jun 27, 2024
d1e6114
Merge branch 'Relese' into dev
LucasGelabert Jun 27, 2024
ee9c362
Merge: Relese into dev
LucasGelabert Jun 27, 2024
ed71e2c
Reordenamiento de codigo y buenas practicas
LucasGelabert Jun 27, 2024
e46e4d7
Fix: Arreglos Varios
LucasGelabert Jun 27, 2024
34e1eb6
sombras (pero no funciona bruh)
SimonCutreraUTN Jun 27, 2024
420002e
merge con shadowing
SimonCutreraUTN Jun 27, 2024
926874a
Mios
LucasGelabert Jun 27, 2024
4b671b4
Fix Merge
LucasGelabert Jun 27, 2024
5e9eb49
Se agrega movimiento tanque - pitch
SantiSauce Jun 29, 2024
b907ab7
Avances - OBB + Gizmo
SantiSauce Jun 30, 2024
666001c
Fix: Varios
LucasGelabert Jun 30, 2024
7f9673c
Merge branch 'dev' of https://github.com/LucasGelabert/2024-1C-3015-T…
LucasGelabert Jun 30, 2024
8b2151a
colisiones con oriented BB
tomasZubizarreta Jul 1, 2024
12c0242
colisiones con rotacion
tomasZubizarreta Jul 1, 2024
bef4a2d
My Commit
LucasGelabert Jul 1, 2024
b824c0d
fix de impact
SimonCutreraUTN Jul 1, 2024
8158942
Logica de distintas oleadas
tomasZubizarreta Jul 1, 2024
e07fc6a
Merge
LucasGelabert Jul 1, 2024
5fb6c00
Merge Manual
LucasGelabert Jul 1, 2024
7093fe4
shadow ?
SimonCutreraUTN Jul 1, 2024
b7fda37
Merge branch 'dev' of https://github.com/LucasGelabert/2024-1C-3015-T…
SimonCutreraUTN Jul 1, 2024
12b72c0
System Particle - 1st step
SantiSauce Jul 1, 2024
9b20e9e
Merge branch 'dev' of https://github.com/LucasGelabert/2024-1C-3015-T…
SantiSauce Jul 1, 2024
746e104
Avances
SantiSauce Jul 2, 2024
12917be
cambios en la logica de los tanques enemigos
tomasZubizarreta Jul 2, 2024
3059180
shadows experim
SimonCutreraUTN Jul 2, 2024
5576157
cambios en la logica de la oleada y los limites del mapa
tomasZubizarreta Jul 2, 2024
d686d83
Add: Intento de Animacion comentado
LucasGelabert Jul 2, 2024
9b6730a
Fix Merge
LucasGelabert Jul 2, 2024
7973fef
light view
SimonCutreraUTN Jul 2, 2024
931a150
Merge branch 'dev' of https://github.com/LucasGelabert/2024-1C-3015-T…
SimonCutreraUTN Jul 2, 2024
b326ae0
modifico camara light
SimonCutreraUTN Jul 2, 2024
d396dc2
modificacion menor de la lightCamara
SimonCutreraUTN Jul 2, 2024
45add53
Elemetos varios y mira
LucasGelabert Jul 2, 2024
14403c1
Merge branch 'dev' of https://github.com/LucasGelabert/2024-1C-3015-T…
LucasGelabert Jul 2, 2024
e08cf14
comento shadowmap
SimonCutreraUTN Jul 2, 2024
c76faaa
merge
SimonCutreraUTN Jul 2, 2024
cb5a0c4
Se agrega free camera
SantiSauce Jul 2, 2024
4fd31d6
Avances
SantiSauce Jul 2, 2024
f52f0f8
cambios en enemy Tank
tomasZubizarreta Jul 2, 2024
ce213a9
Merge branch 'dev' of https://github.com/LucasGelabert/2024-1C-3015-T…
tomasZubizarreta Jul 2, 2024
1e7c1cc
fix de impacto de balas
SimonCutreraUTN Jul 2, 2024
393745e
Merge branch 'dev' of https://github.com/LucasGelabert/2024-1C-3015-T…
SimonCutreraUTN Jul 2, 2024
435cea3
Fotos TGCitos
LucasGelabert Jul 2, 2024
731dc56
FullScreen
LucasGelabert Jul 2, 2024
1ebb43e
Foto Gameplay
LucasGelabert Jul 2, 2024
2e360f2
Update ReadMe
LucasGelabert Jul 3, 2024
8bdd5de
Correccion de paths
LucasGelabert Jul 3, 2024
234913e
Fix ReadMe
LucasGelabert Jul 3, 2024
274a670
Gameplay Screen
LucasGelabert Jul 3, 2024
b6ccd74
Fix: Cambios en codigo y orden de las cosas
LucasGelabert Jul 3, 2024
5d382b9
Arreglos de codigo varios
LucasGelabert Jul 4, 2024
83c68a0
Fix: Pointing Laser, Crosshair
LucasGelabert Jul 4, 2024
3f1ef57
Ordenamiento de codigo y eliminado de archivos innecesarios
LucasGelabert Jul 5, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 42 additions & 5 deletions TGC.MonoGame.TP/Content/Effects/BasicShader.fx
Original file line number Diff line number Diff line change
@@ -29,7 +29,9 @@ float3 ImpactPosition;
float3 TankPosition;

float impacto; // tamaño del impacto
float velocidad; // profundidad del impacto

float3 c_Esfera; // posicion de la esfera (centro)


float TrackOffset;
bool IsTrack;
@@ -44,6 +46,7 @@ sampler2D TextureSampler = sampler_state
AddressV = Wrap;
};


struct VertexShaderInput
{
float4 Position : POSITION0;
@@ -74,6 +77,7 @@ float3 desplazarPorRadio(float3 Posicion, float radio, float3 centro)
return Posicion + (direccion * distancia);
}


VertexShaderOutput MainVS(in VertexShaderInput input)
{
VertexShaderOutput output;
@@ -90,17 +94,41 @@ VertexShaderOutput MainVS(in VertexShaderInput input)
// Coordenadas de textura
output.TextureCoordinate = input.TextureCoordinate;



return output;
}

VertexShaderOutput ImpactsVS(in VertexShaderInput input)
{
VertexShaderOutput output;

// Transformaciones de espacio
float4 worldPosition = mul(input.Position, World);

// Lógica adicional existente
if (onhit)
{
float3 direccion = VersorDireccion(ImpactPosition, TankPosition);
float3 c_Esfera = ImpactPosition + (direccion * velocidad);
float r_Esfera = impacto;
if (distance(c_Esfera, output.WorldPosition) <= r_Esfera)
if (distance(c_Esfera, worldPosition.xyz) <= r_Esfera)
{
output.Position.xyz = desplazarPorRadio(output.Position.xyz, r_Esfera, c_Esfera);
worldPosition.xyz = desplazarPorRadio(worldPosition.xyz, r_Esfera, c_Esfera);
}
}



float4 viewPosition = mul(worldPosition, View);
output.Position = mul(viewPosition, Projection);

// Pasar datos para el pixel shader
output.WorldPosition = worldPosition.xyz;
output.Normal = normalize(mul(input.Normal.xyz, (float3x3) World));

// Coordenadas de textura
output.TextureCoordinate = input.TextureCoordinate;



return output;
}
@@ -151,3 +179,12 @@ technique BasicColorDrawing
PixelShader = compile PS_SHADERMODEL MainPS();
}
};

technique Impacts
{
pass Pass0
{
VertexShader = compile VS_SHADERMODEL ImpactsVS();
PixelShader = compile PS_SHADERMODEL MainPS();
}
};
71 changes: 66 additions & 5 deletions TGC.MonoGame.TP/Objects/Tanks/Tank.cs
Original file line number Diff line number Diff line change
@@ -51,8 +51,11 @@ public class Tank : GameObject

public Vector3 Direction = new(0, 0, 0);
public float TankVelocity { get; set; }

public float TankRotation { get; set; }
public float Rotation = 0;

private bool collided;
public Matrix TurretMatrix { get; set; }
public Matrix CannonMatrix { get; set; }
public float FireRate { get; set; }
@@ -89,6 +92,9 @@ public class Tank : GameObject

public float SensitivityFactor { get; set; }

public float VelocidadImpacto { get; set; }


public Matrix ProjectileMatrix { get; private set; }

private bool _isPlaying = true;
@@ -133,19 +139,37 @@ public void LoadContent(ContentManager Content)
MinBox = TankBox.Min;
MaxBox = TankBox.Max;

collided = false;

Effect.Parameters["impacto"].SetValue(180.0f);
VelocidadImpacto = -160;
//Effect.Parameters["angulo"].SetValue(0);

}

public void Update(GameTime gameTime, KeyboardState keyboardState)
{


float time = (float)gameTime.ElapsedGameTime.TotalSeconds;

TimeSinceLastShot += time;

bool isMoving = false;
bool isRotating = false;

if (isColliding)
{
collided = true;
}

if (keyboardState.IsKeyDown(Keys.W) && !isColliding)
{
Direction -= PanzerMatrix.Forward * TankVelocity * time;
if(collided)
{
CollidingPosition -= PanzerMatrix.Forward * TankVelocity * time;
}
trackOffset -= 0.1f;
isMoving = true;
Console.WriteLine($"trackOffset es {trackOffset}");
@@ -154,6 +178,10 @@ public void Update(GameTime gameTime, KeyboardState keyboardState)
if (keyboardState.IsKeyDown(Keys.S) && !isColliding)
{
Direction += PanzerMatrix.Forward * TankVelocity * time;
if (collided)
{
CollidingPosition += PanzerMatrix.Forward * TankVelocity * time;
}
trackOffset += 0.1f;
isMoving = true;
Console.WriteLine($"trackOffset es {trackOffset}");
@@ -163,12 +191,16 @@ public void Update(GameTime gameTime, KeyboardState keyboardState)
{
Rotation -= TankRotation * time;
isMoving = true;
isRotating = true;
//Effect.Parameters["angulo"].SetValue(TankRotation);
}

if (keyboardState.IsKeyDown(Keys.A) && !isColliding)
{
Rotation += TankRotation * time;
isMoving = true;
isRotating = true;
//Effect.Parameters["angulo"].SetValue(TankRotation);
}

if (isMoving)
@@ -190,6 +222,7 @@ public void Update(GameTime gameTime, KeyboardState keyboardState)
}
}


GunRotationFinal -= GetRotationFromCursorX() * SensitivityFactor;
GunElevation += GetElevationFromCursorY() * SensitivityFactor;

@@ -207,6 +240,15 @@ public void Update(GameTime gameTime, KeyboardState keyboardState)
Extents = CollisionsClass.GetExtents(TankBox);

LastPosition = Direction;

Vector3 direccion = VersorDireccion(CollidingPosition, Direction);

Vector3 direccion_R = rotacion(direccion);
Vector3 c_Esfera = Direction + (direccion_R * VelocidadImpacto);

Effect.Parameters["c_Esfera"].SetValue(c_Esfera);


}

public void Model(List<ModelBone> bones, List<ModelMesh> meshes)
@@ -241,19 +283,22 @@ public void Draw( Matrix view, Matrix projection, GraphicsDevice graphicsDevice)
Effect.Parameters["ModelTexture"].SetValue(PanzerTexture);
Effect.Parameters["World"].SetValue(mesh.ParentBone.Transform * TurretMatrix);
Effect.Parameters["IsTrack"].SetValue(false);

}
else if (mesh.Name.Equals("Cannon"))
{
Effect.Parameters["ModelTexture"].SetValue(PanzerTexture);
Effect.Parameters["World"].SetValue(mesh.ParentBone.Transform * CannonMatrix);
Effect.Parameters["IsTrack"].SetValue(false);

}
else if(mesh.Name.Equals("Treadmill1") || mesh.Name.Equals("Treadmill2"))
{
Effect.Parameters["ModelTexture"].SetValue(TrackTexture);
Effect.Parameters["World"].SetValue(mesh.ParentBone.Transform * PanzerMatrix);
Effect.Parameters["IsTrack"]?.SetValue(true);
Effect.Parameters["TrackOffset"].SetValue(trackOffset);

}
else
{
@@ -270,20 +315,19 @@ public void Draw( Matrix view, Matrix projection, GraphicsDevice graphicsDevice)


Effect.Parameters["IsTrack"].SetValue(false);

}

if (isColliding)
{
Effect.Parameters["onhit"].SetValue(false);
Effect.Parameters["ImpactPosition"].SetValue(CollidingPosition);
Effect.Parameters["onhit"].SetValue(true);
}
else
{
// Effect.Parameters["onhit"].SetValue(false); si lo descomento el tanque resetea las deformaciones todo el rato, hay que buscar una forma de que no lo haga
//Effect.Parameters["onhit"].SetValue(false); //si lo descomento el tanque resetea las deformaciones todo el rato, hay que buscar una forma de que no lo haga
}

Effect.Parameters["impacto"].SetValue(2000.0f);
Effect.Parameters["TankPosition"].SetValue(Direction);
Effect.CurrentTechnique = Effect.Techniques["Impacts"];

mesh.Draw();

@@ -417,5 +461,22 @@ public void RecibirImpacto(Vector3 puntoDeImpacto, float fuerzaImpacto)
}
}
}

public Vector3 VersorDireccion(Vector3 A, Vector3 B)
{
Vector3 Vector = B - A;
float moduloVector = Vector.Length();

return Vector / moduloVector;
}
public Vector3 rotacion(Vector3 direccion)
{
//derivado de los apuntes de 2D
Vector3 direc_R;
direc_R.Y = direccion.Y;
direc_R.Z = direccion.X * (float)Math.Cos(MathHelper.ToRadians(Rotation)) - direccion.Z * (float)Math.Sin(MathHelper.ToRadians(Rotation));
direc_R.X = direccion.Z * (float)Math.Cos(MathHelper.ToRadians(Rotation)) + direccion.X * (float)Math.Sin(MathHelper.ToRadians(Rotation));
return direc_R;
}
}
}
10 changes: 6 additions & 4 deletions TGC.MonoGame.TP/TankGame.cs
Original file line number Diff line number Diff line change
@@ -797,13 +797,15 @@ private bool CheckCollisions()
{
BoundingBox tankBox = Panzer.TankBox;

Vector3 deltaY = new Vector3(0, 200f, 0);

foreach (var roca in Rocas)
{
if (tankBox.Intersects(roca.RocaBox))
{
Panzer.ReceiveDamage(ref _juegoIniciado);
Console.WriteLine("Colisión detectada con una roca.");
Panzer.CollidingPosition = roca.Position;
Panzer.CollidingPosition = roca.Position + deltaY;
return true;
}
}
@@ -813,15 +815,15 @@ private bool CheckCollisions()
if (tankBox.Intersects(arbol.BoundingBox))
{
Console.WriteLine("Colisión detectada con un árbol.");
Panzer.CollidingPosition = arbol.Position;
Panzer.CollidingPosition = arbol.Position + deltaY;
return true;
}
}

if (tankBox.Intersects(casa.CasaBox))
{
Console.WriteLine("Colisión detectada con la casa.");
Panzer.CollidingPosition = casa.Position;
Panzer.CollidingPosition = casa.Position + deltaY;
return true;
}

@@ -831,7 +833,7 @@ private bool CheckCollisions()
{
Panzer.ReceiveDamage(ref _juegoIniciado);
Console.WriteLine("Colisión detectada con un tanque enemigo.");
Panzer.CollidingPosition = EnemyTank.Position;
Panzer.CollidingPosition = EnemyTank.Position + deltaY;
return true;
}
}