public override void CreateGameObject(ObjectCreationRequest request) { if (request.ObjectType == typeof(TestUnit)) { Random rnd = new Random(); var item = new TestUnit(this.Bus) { Velocity = new Vect3(rnd.Next(-10, 10) * rnd.NextDouble(), rnd.Next(-10, 10) * rnd.NextDouble(), rnd.Next(-10, 10) * rnd.NextDouble()), TeamColour = Color.FromArgb(rnd.Next(0, 255), rnd.Next(0, 255), rnd.Next(0, 255)), Selected = Convert.ToBoolean(rnd.Next(0, 1)) }; this.GameObjects.Add(item); Bus.Add(new ObjectCreated(request.TimeSent, item)); } base.CreateGameObject(request); }
public override void CreateGameObject(ObjectCreationRequest request) { if (request.ObjectType == typeof(Planet)) { var item = new Planet(_idTally++, Bus); lock (GameObjectsLock) { GameObjects.Add(item); } Bus.Add(new ObjectCreated(request.TimeSent, item)); } else if (request.ObjectType == typeof(SkyBox)) { var item = new SkyBox(_idTally++, Bus); lock (GameObjectsLock) { GameObjects.Add(item); } Bus.Add(new ObjectCreated(request.TimeSent, item)); } base.CreateGameObject(request); }
public override void CreateGameObject(ObjectCreationRequest request) { if (request.ObjectType == typeof(VoxelGreen)) { var item = new VoxelGreen(_idTally++, Bus); lock (GameObjectsLock) { GameObjects.Add(item); } Bus.Add(new ObjectCreated(request.TimeSent, item)); } Console.WriteLine(request.ObjectType); if (request.ObjectType == typeof(TopMenu)) { var item = new TopMenu(_idTally++, Bus); lock (GameObjectsLock) { GameObjects.Add(item); Bus.Add(new ObjectCreated(request.TimeSent, item)); } } base.CreateGameObject(request); }
public virtual void CreateGameObject(ObjectCreationRequest m) { }