protected override void Initialize() { base.Initialize(); this.CurrentEpisode = 0; if (WaveServices.Platform.IsEditor || (string.IsNullOrEmpty(this.ShipEntityPath)) || (string.IsNullOrEmpty(this.TerrainEntityPath))) { return; } this.randy = WaveServices.Random; this.shipComponent = this.Owner.Find(this.ShipEntityPath)?.FindComponent <ShipComponent>(); this.terrain = this.Owner.Find(this.TerrainEntityPath)?.FindComponent <TerrainMeshComponent>(); this.networkService = WaveServices.GetService <Lunar3DNetworkService>(); if (this.networkService != null) { this.networkService.ActionReveiced += this.OnActionReceived; this.networkService.OnReset += this.OnReset; this.networkService.Updated += this.OnUpdated; this.networkService.Rendered += this.OnRendered; this.Owner.Scene.Pause(); this.Owner.Scene.IsVisible = false; } else { this.Reset(); } }
/// <summary> /// Resolves the dependencies. /// </summary> protected override void ResolveDependencies() { base.ResolveDependencies(); this.rndService = WaveServices.Random; this.Direction.X = (float)Math.Cos(this.rndService.NextInt()); this.Direction.Y = (float)Math.Cos(this.rndService.NextInt()); }
/// <summary> /// Set the current settings to the particle system attached /// </summary> private void LoadParticleSystem() { this.random = WaveServices.Random; if (this.mesh != null) { if (this.mesh.IndexBuffer != null) { this.GraphicsDevice.DestroyIndexBuffer(this.mesh.IndexBuffer); } if (this.mesh.VertexBuffer != null) { this.GraphicsDevice.DestroyVertexBuffer(this.mesh.VertexBuffer); } this.mesh = null; } this.settings = this.System; this.numParticles = this.System.NumParticles; this.numPrimitives = this.numParticles * 2; this.numVertices = this.numParticles * 4; this.numIndices = this.numParticles * 6; this.particles = new Particle[this.numParticles]; // Create Indexbuffer ushort[] indices = new ushort[this.numIndices]; for (int i = 0; i < this.numParticles; i++) { indices[(i * 6) + 0] = (ushort)((i * 4) + 0); indices[(i * 6) + 1] = (ushort)((i * 4) + 2); indices[(i * 6) + 2] = (ushort)((i * 4) + 1); indices[(i * 6) + 3] = (ushort)((i * 4) + 0); indices[(i * 6) + 4] = (ushort)((i * 4) + 3); indices[(i * 6) + 5] = (ushort)((i * 4) + 2); } IndexBuffer indexBuffer = new IndexBuffer(indices); // Initialize Particles for (int i = 0; i < this.numParticles; i++) { this.particles[i] = new Particle() { Alive = true, Life = TimeSpan.FromMilliseconds(this.random.NextDouble() * (this.numParticles * InitTimeMultipler)).TotalMilliseconds }; } this.vertices = new VertexPositionColorTexture[this.numVertices]; DynamicVertexBuffer vertexBuffer = new DynamicVertexBuffer(VertexPositionColorTexture.VertexFormat); vertexBuffer.SetData(this.vertices, this.numVertices); this.mesh = new Mesh(0, vertexBuffer.VertexCount, 0, indexBuffer.IndexCount / 3, vertexBuffer, indexBuffer, PrimitiveType.TriangleList); }
public BridgeBehavior() : base("BridgeBehavior") { this.tables = new List<Entity>(); this.secondsTime = 0; this.index = 0; this.random = WaveServices.Random; this.boxes = new List<Entity>(NUM_BOXES); }
public BridgeBehavior() : base("BridgeBehavior") { this.tables = new List <Entity>(); this.secondsTime = 0; this.index = 0; this.random = WaveServices.Random; this.boxes = new List <Entity>(NUM_BOXES); }
protected override void DefaultValues() { StartingLinesCount = 1; MaxLinesCount = 10000; Size = 200; lines = new List <Line>(); random = WaveServices.Random; l = new Line(); }
protected override void DefaultValues() { base.DefaultValues(); this.tables = new List <Entity>(); this.secondsTime = 0; this.index = 0; this.random = WaveServices.Random; this.boxes = new List <Entity>(NUM_BOXES); this.tableSize = new Vector3(20, 1, 50); this.box_size = Vector3.One; }
/// <summary> /// Initialize sound manager /// </summary> protected override void Initialize() { base.Initialize(); this.random = WaveServices.Random; this.soundPlayer = WaveServices.SoundPlayer; this.bank = new SoundBank(this.Assets) { MaxConcurrentSounds = 40 }; this.soundPlayer.RegisterSoundBank(this.bank); this.LoadSounds(); }
public DrawableLines(int numOfLines) : base("DrawableLines")//, Layer.Opaque) { lines = new List<Line>(); random = WaveServices.Random; l = new Line(); for (int i = 0; i < numOfLines; i++) { AddNewLine(); } }
public DrawableLines(int numOfLines) : base("DrawableLines")//, Layer.Opaque) { lines = new List <Line>(); random = WaveServices.Random; l = new Line(); for (int i = 0; i < numOfLines; i++) { AddNewLine(); } }
public BoardGenerator() { this.candyColors = (CandyColors[])Enum.GetValues(typeof(CandyColors)); this.random = WaveServices.Random; }
/// <summary> /// Resolves the dependencies. /// </summary> protected override void ResolveDependencies() { base.ResolveDependencies(); this.rndService = WaveServices.Random; this.Direction.X = (float)Math.Cos(this.rndService.NextInt()); this.Direction.Y = (float)Math.Cos(this.rndService.NextInt()); this.Direction.Z = (float)Math.Cos(this.rndService.NextInt()); this.color = this.GetRandomColor(); }
protected override void Initialize() { base.Initialize(); this.virtualScreenManager = this.Owner.Scene.VirtualScreenManager; this.randomService = WaveServices.Random; }
protected override void DefaultValues() { base.DefaultValues(); this.tables = new List<Entity>(); this.secondsTime = 0; this.index = 0; this.random = WaveServices.Random; this.boxes = new List<Entity>(NUM_BOXES); this.tableSize = new Vector3(20, 1, 50); this.box_size = Vector3.One; }
/// <summary> /// Set the current settings to the particle system attached /// </summary> private void LoadParticleSystem() { this.random = WaveServices.Random; if (this.mesh != null) { if (this.mesh.IndexBuffer != null) { this.GraphicsDevice.DestroyIndexBuffer(this.mesh.IndexBuffer); } if (this.mesh.VertexBuffer != null) { this.GraphicsDevice.DestroyVertexBuffer(this.mesh.VertexBuffer); } this.mesh = null; } this.settings = this.System; this.numParticles = this.System.NumParticles; this.numPrimitives = this.numParticles * 2; this.numVertices = this.numParticles * 4; this.numIndices = this.numParticles * 6; this.particles = new Particle[this.numParticles]; // Sets the time passed between 2 particles creation. this.emitLapse = (this.settings.EmitRate > 0) ? 1000 / this.settings.EmitRate : 0; // Create Indexbuffer ushort[] indices = new ushort[this.numIndices]; for (int i = 0; i < this.numParticles; i++) { indices[(i * 6) + 0] = (ushort)((i * 4) + 0); indices[(i * 6) + 1] = (ushort)((i * 4) + 2); indices[(i * 6) + 2] = (ushort)((i * 4) + 1); indices[(i * 6) + 3] = (ushort)((i * 4) + 0); indices[(i * 6) + 4] = (ushort)((i * 4) + 3); indices[(i * 6) + 5] = (ushort)((i * 4) + 2); } IndexBuffer indexBuffer = new IndexBuffer(indices); // Initialize Particles for (int i = 0; i < this.numParticles; i++) { double life = (this.settings.EmitRate > 0) ? -1 : TimeSpan.FromMilliseconds(this.random.NextDouble() * (this.numParticles * InitTimeMultipler)).TotalMilliseconds; this.particles[i] = new Particle() { Alive = true, Life = life }; } this.vertices = new VertexPositionColorTexture[this.numVertices]; // Initializes the coordinate textures of the vertices for (int i = 0; i < this.numVertices; i++) { this.vertices[i++].TexCoord = TEXCOORD1; this.vertices[i++].TexCoord = TEXCOORD2; this.vertices[i++].TexCoord = TEXCOORD3; this.vertices[i].TexCoord = TEXCOORD4; } DynamicVertexBuffer vertexBuffer = new DynamicVertexBuffer(VertexPositionColorTexture.VertexFormat); vertexBuffer.SetData(this.vertices, this.numVertices); this.mesh = new Mesh(0, vertexBuffer.VertexCount, 0, indexBuffer.IndexCount / 3, vertexBuffer, indexBuffer, PrimitiveType.TriangleList); }
protected override void DefaultValues() { StartingLinesCount = 1; MaxLinesCount = 10000; Size = 200; lines = new List<Line>(); random = WaveServices.Random; l = new Line(); }