public void ChangeButtonColor() { CameraTranslation cam = Camera.main.GetComponent <CameraTranslation>(); if (cam.NoSwitch || cam.InRoomConnector) { StartCoroutine(SignalNoCamSwitch()); } }
/// <summary> /// Create CameraTranslation for an IDrawableEntity /// </summary> /// <param name="entity">IDrawableEntity to create CamereTranslation from</param> /// <returns>new CameraTranslation</returns> private CameraTranslation ToCT(IDrawableEntity entity) { var ct = new CameraTranslation { LocationTranslation = new Point(entity.X, entity.Y), SizeTranslation = new Point(entity.Width, entity.Height) }; return(ct); }
/// <summary> /// Translate CameraTranslation to Draw screen /// </summary> /// <param name="ct">CameraTranslation to translate</param> /// <returns>new CameraTranslation</returns> private CameraTranslation TranslateToDrawScreen(CameraTranslation ct) { var transloc = new Point(ct.LocationTranslation.X + CameraSizeX / 2, ct.LocationTranslation.Y + CameraSizeY / 2); var newct = new CameraTranslation() { LocationTranslation = transloc, SizeTranslation = ct.SizeTranslation }; return(newct); }
/// <summary> /// Translate a CameraTranslation to the difference of the camera center /// </summary> /// <param name="ct">CameraTranslation you want to change</param> /// <returns>New CameraTranslation</returns> private CameraTranslation TranslateToCenter(CameraTranslation ct) { var translate = new Point(ct.LocationTranslation.X - X, ct.LocationTranslation.Y - Y); var newct = new CameraTranslation() { LocationTranslation = translate, SizeTranslation = ct.SizeTranslation }; return(newct); }
/// <summary> /// Translates a CameraTranslation to the Zoom /// </summary> /// <param name="ct">CameraTranslation you wish to change</param> /// <returns>new CameraTranslation</returns> private CameraTranslation TranslateZoom(CameraTranslation ct) { var transloc = new Point((int)(ct.LocationTranslation.X * Zoom), (int)(ct.LocationTranslation.Y * Zoom)); var transsize = new Point((int)(ct.SizeTranslation.X * Zoom), (int)(ct.SizeTranslation.Y * Zoom)); var newct = new CameraTranslation() { LocationTranslation = transloc, SizeTranslation = transsize }; return(newct); }