public ServerShipManager(World serverWorld, EventManager eventManager, YmfasServer _server) { serverShipLog = Mogre.LogManager.Singleton.CreateLog("server-ship.log"); serverShipLog.LogMessage("creating ssm"); world = serverWorld; eventMgr = eventManager; server = _server; //init ships ShipTypeData curShipType = new ShipTypeData(); curShipType.Class = ShipClass.Interceptor; curShipType.Model = ShipModel.MogreFighter; //player ships foreach (int id in server.PlayerIds ) { Vector3 curPosition = Vector3.ZERO;//new Vector3(Mogre.Math.RangeRandom(-TestEngine.WorldSizeParam / 1.5f, TestEngine.WorldSizeParam / 1.5f), Mogre.Math.RangeRandom(-TestEngine.WorldSizeParam / 1.5f, TestEngine.WorldSizeParam / 1.5f), Mogre.Math.RangeRandom(-TestEngine.WorldSizeParam / 1.5f, TestEngine.WorldSizeParam / 1.5f)); Quaternion curOrientation = Quaternion.IDENTITY; ShipInit curShipInit = new ShipInit(id, curShipType, curPosition, curOrientation, server.GetPlayerName(id)); eventMgr.SendEvent(curShipInit); Util.Log("sent init for ship " + id); //put them in world Ship s = new Ship(world, id, curPosition, curOrientation); shipTable.Add(id, s); } //init listeners ShipControlStatus.FiringEvent += new GameEventFiringHandler(handleShipControlStatus); }
private void handleShipInit(GameEvent e) { ShipInit ee = (ShipInit)e; ClientShip ship = new ClientShip(engine.World, engine.SceneManager, null, ee.PlayerId, ee.Position, ee.Orientation); shipTable.Add(ship.ID, ship); if (ship.ID == engine.PlayerId) { engine.AttachCamera(ship); } Util.Log("Ship " + ship.ID + "inited. my ID is " + engine.PlayerId); }
public ServerShipManager(World serverWorld, EventManager eventManager, YmfasServer _server) { serverShipLog = Mogre.LogManager.Singleton.CreateLog("server-ship.log"); serverShipLog.LogMessage("creating ssm"); world = serverWorld; eventMgr = eventManager; server = _server; //init ships ShipTypeData curShipType = new ShipTypeData(); curShipType.Class = ShipClass.Interceptor; curShipType.Model = ShipModel.MogreFighter; //player ships foreach (int id in server.PlayerIds) { Vector3 curPosition = Vector3.ZERO; //new Vector3(Mogre.Math.RangeRandom(-TestEngine.WorldSizeParam / 1.5f, TestEngine.WorldSizeParam / 1.5f), Mogre.Math.RangeRandom(-TestEngine.WorldSizeParam / 1.5f, TestEngine.WorldSizeParam / 1.5f), Mogre.Math.RangeRandom(-TestEngine.WorldSizeParam / 1.5f, TestEngine.WorldSizeParam / 1.5f)); Quaternion curOrientation = Quaternion.IDENTITY; ShipInit curShipInit = new ShipInit(id, curShipType, curPosition, curOrientation, server.GetPlayerName(id)); eventMgr.SendEvent(curShipInit); Util.Log("sent init for ship " + id); //put them in world Ship s = new Ship(world, id, curPosition, curOrientation); shipTable.Add(id, s); } //init listeners ShipControlStatus.FiringEvent += new GameEventFiringHandler(handleShipControlStatus); }