Client LuaCsForBarotrauma
BarotraumaClient/ClientSource/Map/Levels/LevelWall.cs
1 using FarseerPhysics;
2 using Microsoft.Xna.Framework;
3 using Microsoft.Xna.Framework.Graphics;
4 using System;
5 using System.Collections.Generic;
6 
7 namespace Barotrauma
8 {
9  partial class LevelWall : IDisposable
10  {
11  public LevelWallVertexBuffer VertexBuffer { get; private set; }
12 
13  public VertexBuffer WallBuffer { get { return VertexBuffer.WallBuffer; } }
14 
16 
17  public virtual float Alpha => 1.0f;
18 
19  public Matrix GetTransform()
20  {
21  return Body.FixedRotation ?
22  Matrix.CreateTranslation(new Vector3(ConvertUnits.ToDisplayUnits(Body.Position), 0.0f)) :
23  Matrix.CreateRotationZ(Body.Rotation) *
24  Matrix.CreateTranslation(new Vector3(ConvertUnits.ToDisplayUnits(Body.Position), 0.0f));
25  }
26 
27  public void SetWallVertices(VertexPositionTexture[] wallVertices, VertexPositionTexture[] wallEdgeVertices, Texture2D wallTexture, Texture2D edgeTexture, Color color)
28  {
30  VertexBuffer = new LevelWallVertexBuffer(wallVertices, wallEdgeVertices, wallTexture, edgeTexture, color);
31  }
32 
33  public void GenerateVertices()
34  {
35  float zCoord = this is DestructibleLevelWall ? Rand.Range(0.9f, 1.0f) : 0.9f;
36  List<VertexPositionTexture> wallVertices = CaveGenerator.GenerateWallVertices(triangles, level.GenerationParams, zCoord);
38  wallVertices.ToArray(),
39  CaveGenerator.GenerateWallEdgeVertices(Cells, level, zCoord).ToArray(),
42  color);
43  }
44  }
45 }
void SetWallVertices(VertexPositionTexture[] wallVertices, VertexPositionTexture[] wallEdgeVertices, Texture2D wallTexture, Texture2D edgeTexture, Color color)