public static void Main() { //Start the audio system so sound can be played SwinGame.OpenAudio(); //Open the game window SwinGame.OpenGraphicsWindow("GameMain", 800, 600); SwinGame.ShowSwinGameSplashScreen(); StateHandler _statehandler = new StateHandler (); ObjectsHandler _objecthandler = new ObjectsHandler (_statehandler); Input_Handler _inputhandler = new Input_Handler(_statehandler,_objecthandler); GraphicsHandler _graphicshandler = new GraphicsHandler (_statehandler,_objecthandler); //Run the game loop while(false == SwinGame.WindowCloseRequested()) { //Fetch the next batch of UI interaction SwinGame.ProcessEvents(); //Clear the screen and draw the framerate SwinGame.ClearScreen(Color.Black); _graphicshandler.Run (); _inputhandler.Run (); _statehandler.Run (); _objecthandler.Run (); SwinGame.DrawFramerate(0,0); //Draw onto the screen SwinGame.RefreshScreen(); System.Threading.Thread.Sleep (2); } //End the audio SwinGame.CloseAudio(); //Close any resources we were using SwinGame.ReleaseAllResources(); }
void Start() { //startingPosition = transform.localPosition; myRenderer = GetComponent <Renderer>(); handler = FindObjectOfType <ObjectsHandler>(); SetGazedAt(false); }
public void Init(NetworkConnection connection, int cnnId) { this.connection = connection; this.hostId = cnnId; isStarted = false; players = connection.gameObject.GetComponent <PlayersHandler>(); objects = connection.gameObject.GetComponent <ObjectsHandler>(); objects.SetClient(this); rooms = connection.gameObject.GetComponent <RoomHandler>(); rooms.SetClient(this); }
public void TestCaseCharPosReset() { // test that character starts in default position after the level resets StateHandler sh = new StateHandler (); ObjectsHandler oh = new ObjectsHandler (sh); Input_Handler ih = new Input_Handler(sh,oh); Character c = oh.LevelCharacter; c.Xpos = 150; c.Ypos = 250; ih.ResetCharacter (); // check that is at defualt pos Assert.IsTrue (c.Xpos == 110); Assert.IsTrue (c.Ypos == 552); Assert.IsTrue (sh.Gamestate == GameState.Menu); Assert.IsTrue (sh.Characterstate == CharacterState.Standing); }
public void TestCaseBarrelCollide() { // test character dies when hit by barrel StateHandler s = new StateHandler (); ObjectsHandler h = new ObjectsHandler (s); // adds a barrel at location 100,119 h.AddBarrel (); Character c = h.LevelCharacter; c.Xpos = 100; c.Ypos = 119; Assert.IsTrue (h.LevelCharacter.Xpos == 100); Assert.IsTrue (h.LevelCharacter.Ypos == 119); Assert.IsTrue (s.Characterstate == CharacterState.Standing); h.LevelCharacterObject (); s.Run (); Assert.IsTrue (s.Characterstate == CharacterState.Dying); }
internal void setHandler(ObjectsHandler objectsHandler) { handler = objectsHandler; }
public GraphicsHandler(StateHandler _state,ObjectsHandler _object) { _objecthandler = _object; _statehandler = _state; }
public Input_Handler(StateHandler _state,ObjectsHandler _object) { _statehandler = _state; _objecthandler = _object; }