/// <summary> /// Method checks if the player pushed the space grab button and adds mouse delta /// values to the component's direction property. /// </summary> /// <param name="cameraMoveComponent">Reference to the current camera move component</param> private void ProcessSpaceGrab(ref CameraMoveComponent cameraMoveComponent) { if (!(_spaceGrab > 0)) { return; } // Add inverted values, because we want to grab and pull the view cameraMoveComponent.Direction.x -= _mouseDelta.x; cameraMoveComponent.Direction.y -= _mouseDelta.y; }
private static int OnCodeInPlayerCenterCheck(TileCode code, List <TileCode> codes, Vector2 collisionCenter, int i, GameObject player) { switch (code.Code) { case TileCodes.Transition: if (EngineState.GameState == EngineStates.Editor) { break; } Ingame.GetInstance().Activate(); LevelManager.LoadLevel <Map <TileCode>, TileCode>(code.Message); GameVariableProvider.SaveManager.CurrentSaveState.Keys.Clear(); GameVariableProvider.SaveManager.CurrentSaveState.BossDead = false; break; case TileCodes.Dialog: if (InputMapper.StrictAction) { DialogHelper.PlayDialog(code.Message); } break; case TileCodes.Save: GameVariableProvider.SaveManager.Save(); codes.Remove(new TileCode(TileCodes.Save)); --i; break; case TileCodes.PushLeft: player.Send("PHYSICS_PUSHLEFT", true); break; case TileCodes.PushRight: player.Send("PHYSICS_PUSHRIGHT", true); break; case TileCodes.PushUp: player.Send("PHYSICS_PUSHUP", true); break; case TileCodes.PushDown: player.Send("PHYSICS_PUSHDOWN", true); break; case TileCodes.Deadly: player.Send <string>("KILL", null); break; case TileCodes.Trigger: if (code.Message == "BOSS") { foreach (var boss in GameVariableProvider.Bosses) { boss.Send <string>("SHOOT", null); } } break; case TileCodes.CameraFocusTrigger: var parts = code.Message.Split('_'); var pointName = parts[0]; int frameCount; int.TryParse(parts[1], out frameCount); EntityManager.AddEntity(new GameObject(CameraMoveComponent.GetInstance(pointName, frameCount))); break; } return(i); }