public GameHud(BaseLevel pLevel, MCamera pCam) : base(false) { Instance = this; _hudRatioX = (float)game.width / Settings.ScreenResolutionX; _hudRatioY = (float)game.height / Settings.ScreenResolutionY; _level = pLevel; _cam = pCam; Cam = _cam; _cam.AddChild(this); SetXY(-_cam.Width / 2f, -_cam.Height / 2f); _flashbackCounterHudPanel = new FlashbackCounterHudPanel(); AddChild(_flashbackCounterHudPanel); _flashbackCounterHudPanel.SetXY(70, 36); _memoriesHudPanel = new MemoriesHudPanel(); _memoriesHudPanel.SetXY(70, 36); _resetFlashbackButton = new ResetFlashbackDetectiveButtonHud(); _resetFlashbackButton.SetOriginToCenter(); AddChild(_resetFlashbackButton); _resetFlashbackButton.SetXY(game.width - 166, 60); _resetFlashbackButton.SetActive(false); CoroutineManager.StartCoroutine(Start(), this); }
public override bool Open() { try { lock (FCameraLock) { if (FCamera == null) { MCameraManager.WaitForInitialization(); FCamera = MCameraManager.GetCamera(); if (FCamera == null || !FCamera.IsValid()) { throw (new Exception("Cannot open camera, no device attached")); } } FCamera.SetVideoType(this.FMode); FCamera.Start(); ApplyCaptureProperty(); FCamera.FrameAvailable += FCamera_FrameAvailable; Status = "OK"; return(true); } } catch (Exception e) { this.Status = e.Message; return(false); } }
public void ShowVelocityGUI() { if(move == null) move = target as MCamera; move.vel = EditorGUILayout.FloatField("Velocity",move.vel); move.accel = EditorGUILayout.FloatField("Accel",move.vel); }
public FogSystemManager(MCamera pCam, GameObject pTarget) : base(false) { _lightAlpha = new Bitmap("data/player_light_grid_map.png"); _lightSprite = new Sprite("data/player_light_grid_map.png", false, false); _brushes = new Brush[4]; SetBrushes(HatchStyle.Cross); _bg = new EasyDraw(game.width, game.height); pCam.AddChild(_bg); _bg.SetOriginToCenter(); _bg.Clear(Color.FromArgb(100, Color.Black)); _cam = pCam; _mainTarget = pTarget; string[] hatchesStrs = new string[51]; for (int i = 0; i < 51; i++) { var hatchStyle = (HatchStyle)i; hatchesStrs[i] = hatchStyle.ToString(); } hatchesStrs = hatchesStrs.OrderBy(h => h).ToArray(); _hatchStyles = new HatchStyle[51]; for (int i = 0; i < _hatchStyles.Length; i++) { var hatchStyle = Enum.Parse(typeof(HatchStyle), hatchesStrs[i]); _hatchStyles[i] = (HatchStyle)hatchStyle; } Console.WriteLine($"{this}: {string.Join("\r\n", _hatchStyles)}"); }
// Update is called once per frame void Update() { if (touchInput) { updateTouchController(); } if (fill < capacity) { if (touchInput) { if (doubleTap) { //mousedown setSucking(true); } else if (Input.GetMouseButton(0) == false) { //mouseup setSucking(false); } } else { if (Input.GetKey(KeyCode.S) || Input.GetMouseButtonDown(0)) { setSucking(true); } else if (Input.GetMouseButtonUp(0)) { setSucking(false); } } } else { if (touchInput) { if (doubleTap) { //mouedown shootJunk(); } } else { if (Input.GetKeyDown(KeyCode.S) || Input.GetMouseButtonDown(0)) { shootJunk(); } } } if (sucking) { MCamera.ScreenShake(.2f, .25f); } prevTouches = Input.touchCount; }
//MSceneObject Target; public MCameraHandler() : base(EType.Other, "MCameraHandler") { //MScene.UtilityRoot.Add(this); _camera = MScene.Camera; Globals.Network.TeleportHandler += Network_TeleportHandler; //MMessageBus.UpdateHandler += MMessageBus_UpdateHandler; MStateMachine.StateChanged += MStateMachine_StateChanged; }
public override void OnInspectorGUI() { ShowMovementName(); if(move == null) move = target as MCamera; move.target = (Camera)EditorGUILayout.ObjectField("Target",move.target,typeof(Camera)); ShowMovementType(); ShowDefaultGUI(); }
public void TakePicture(string fileName) { Log.Info(TAG, "Taking picture"); this.mPictureFileName = fileName; // Postview and jpeg are sent in the same buffers if the queue is not empty when performing a capture. // Clear up buffers to avoid mCamera.takePicture to be stuck because of a memory issue MCamera.SetPreviewCallback(null); // PictureCallback is implemented by the current class MCamera.TakePicture(null, null, this); }
public void ShowCurveGUI() { if(move == null) move = target as MCamera; move.curve = EditorGUILayout.CurveField("Curve",move.curve); if(move.kindOfMove != MoveCameraType.Color) { move.dst = EditorGUILayout.FloatField("Destination",move.dst); } else { move.dstColor = EditorGUILayout.ColorField("Destination",move.dstColor); } }
public void OnPictureTaken(byte[] data, Camera camera) { Log.Info(TAG, "Saving a bitmap to file"); // The camera preview was automatically stopped. Start it again. MCamera.StartPreview(); MCamera.SetPreviewCallback(this); // Write the image in a file (in jpeg format) try { FileOutputStream fos = new FileOutputStream(mPictureFileName); fos.Write(data); fos.Close(); } catch (Exception ex) { Log.Error("PictureDemo", "Exception in photoCallback", ex); } }
public void ShowMovementType() { if(move == null) move = target as MCamera; move.type = (MovementType)EditorGUILayout.EnumPopup("Move Type",move.type); move.kindOfMove = (MoveCameraType)EditorGUILayout.EnumPopup("Kind Of Move Type",move.kindOfMove); EditorGUILayout.Space(); bool isRect = false; switch(move.type) { case MovementType.velocity: ShowVelocityGUI(); break; case MovementType.curve: ShowCurveGUI(); break; } move.moveTime = EditorGUILayout.FloatField("Move Time",move.moveTime); EditorGUILayout.Space(); }
public bool isEffectSupported() { return(MCamera.GetParameters().ColorEffect != null); }
// Use this for initialization void Awake() { instance = this; }
public BaseLevel(CaveLevelMapGameObject pCaveLevel, MCamera pCam) { _caveLevelMap = pCaveLevel; _cam = (FollowCamera)pCam; AddChild(_caveLevelMap); var doorsManager = new DoorsManager(_caveLevelMap, this); AddChild(doorsManager); var memoriesManager = new HistoryPickupsManager(_caveLevelMap, this); AddChild(memoriesManager); var oilPickUpManager = new OilPickUpsManager(_caveLevelMap, this); AddChild(oilPickUpManager); var flashbacksTriggerManager = new FlashBackTriggersManager(_caveLevelMap, this); AddChild(flashbacksTriggerManager); var flashbackPickupsManager = new FlashbackPickupsManager(_caveLevelMap, this); AddChild(flashbackPickupsManager); var hiddenRoomManager = new HiddenRoomCoverManager(this); AddChild(hiddenRoomManager); var flashbacksManager = new FlashbackManager(this, flashbacksTriggerManager.FlashTriggersMap.Count); AddChild(flashbacksManager); var darkHallManager = new DarkHallManager(_caveLevelMap, this); AddChild(darkHallManager); var particlesManager = new ParticleManager(); _player = new Player(); AddChild(_player); var spawnPoint = GetPlayerSpawnPoint(); _player.SetXY(spawnPoint.x, spawnPoint.y); AddChild(_cam); _cam.Target = _player; _cam.Map = _caveLevelMap; _cam.SetXY(spawnPoint.x, spawnPoint.y); _playerCollision = new PlayerCollision(_player, _caveLevelMap, _cam); AddChild(_playerCollision); CoroutineManager.StartCoroutine(Start(), this); }
void OnTriggerEnter2D(Collider2D collider) { if (collider.gameObject.tag == "Bullet" && (collider.gameObject.GetComponent <Suckable>() == null || !collider.gameObject.GetComponent <Suckable>().beingSucked)) { if (GetComponent <Helicopter>() != null) // && collider.gameObject.GetComponentInChildren<JunkBullet>() == null) { return; } hitPoints -= collider.gameObject.GetComponent <Bullet>().damage; GameUI.UpdateUI(); Instantiate(collider.gameObject.GetComponent <Bullet>().explosion, collider.transform.position, Quaternion.identity); if (isBig) { if (collider.gameObject.GetComponent <Bullet>().damage < 1f) { MCamera.ScreenShake(.15f, .5f); } else { MCamera.ScreenShake(.3f, 1f); } if (collider.gameObject.GetComponentInChildren <JunkBullet>() != null) { collider.gameObject.GetComponentInChildren <JunkBullet>().numhits -= 1; if (collider.gameObject.GetComponentInChildren <JunkBullet>().numhits <= 0) { Destroy(collider.gameObject); } } else { Destroy(collider.gameObject); } } if (hitPoints <= 0f) { if (collider.gameObject.GetComponentInChildren <JunkBullet>() != null) { GameEngine.instance.score += points; GameEngine.instance.getDefconPoints(defconPoints); } if (gameObject.tag == "Roomba") { //Debug.Log("game over"); //GameEngine.instance.Roombacalypse(); GameEngine.instance.playerDefeated(); //return; } if (GetComponentInParent <Tank>() != null) { Instantiate(GetComponentInParent <Tank>().crater, transform.position, Quaternion.identity); Destroy(transform.parent.gameObject); } else { if (GetComponent <Civilian>() != null) { GetComponent <Civilian>().SplatterBlood(); } Destroy(transform.gameObject); } } } }
public Size getResolution() { return(MCamera.GetParameters().PreviewSize); }
public List <Size> getResolutionList() { return(MCamera.GetParameters().SupportedPreviewSizes.ToList()); }
public PlayerCollision(Player pPlayer, CaveLevelMapGameObject pCaveLevel, MCamera pCam) { _player = pPlayer; _caveLevel = pCaveLevel; _cam = pCam; }
public IList <String> getEffectList() { return(MCamera.GetParameters().SupportedColorEffects); }
public void SetOrientation(int degrees) { DisconnectCamera(); MCamera.SetDisplayOrientation(90); ConnectCamera(Width, Height); }
public static void fadeToWhite() { instance.isFading = true; MCamera.ScreenShake(4f, 3f); }
void Start() { wait_for_anim = 0; camera = GameObject.FindGameObjectWithTag("MainCamera").transform.GetComponent <MCamera>(); }
public String getEffect() { return(MCamera.GetParameters().ColorEffect); }
public void setEffect(String effect) { Camera.Parameters param = MCamera.GetParameters(); param.ColorEffect = effect; MCamera.SetParameters(param); }