public override Node Clone() { var vp = (Viewport3D)base.Clone(); vp.CameraRef = CameraRef?.Clone(); return(vp); }
public static void CameraCreate( CameraRef cameraRef) { ThrowOut( SUCameraCreate( out cameraRef.intPtr), "Could not create camera."); }
public static void ModelGetCamera( ModelRef modelRef, CameraRef cameraRef) { ThrowOut( SUModelGetCamera( modelRef.intPtr, out cameraRef.intPtr), "Could not get camera."); }
public override Node Clone() { var vp = (Viewport3D)base.Clone(); vp.opaqueList = new List <RenderItem>(); vp.transparentList = new List <RenderItem>(); vp.CameraRef = CameraRef?.Clone(); vp.LightSourceRef = LightSourceRef?.Clone(); return(vp); }
public void DestroyCamera(object cRef) { CameraRef reference = (CameraRef)cRef; if (reference != null && reference.Camera != null) { reference.Camera.IsOn = false; m_mapCameras.Remove(reference.Camera); reference.Camera = null; } }
public static void CameraSetOrientation( CameraRef cameraRef, Point3D position, Point3D target, Vector3D upVector) { ThrowOut( SUCameraSetOrientation( cameraRef.intPtr, ref position, ref target, ref upVector), "Could not set orientation."); }
public bool IsVisible(MapPos mappos, int weight, object cRef = null) { int mapSize = m_map.GetMapSizeWith(weight); if (mappos.Row < 0 || mappos.Col < 0 || mappos.Row >= mapSize || mappos.Col >= mapSize) { return(false); } if (cRef != null) { CameraRef reference = (CameraRef)cRef; return(reference.Camera.IsVisible(mappos, weight)); } return(m_mapCameras.Any(cam => cam.IsVisible(mappos, weight))); }
/// <summary> /// /// </summary> /// <param name="mappos"></param> /// <param name="weight"></param> /// <param name="cRef">if cRef is null camera visiblity check is skipped</param> /// <returns></returns> public MapCell GetCell(MapPos mappos, int weight, object cRef) { int mapSize = m_map.GetMapSizeWith(weight); if (mappos.Row < 0 || mappos.Col < 0 || mappos.Row >= mapSize || mappos.Col >= mapSize) { return(null); } if (cRef != null) { CameraRef reference = (CameraRef)cRef; if (!reference.Camera.IsVisible(mappos, weight)) { return(null); } } return(Map.Get(mappos.Row, mappos.Col, weight)); }
private void ChangeState(KeyboardState state, float?pos = null) { if (CurrentState == state) { return; } NormalKeys.SetPage(0, NextSpecialPage); Vector3 fromPosition = Vector3.zero; Vector3 toPosition = Vector3.zero; Action callback = null; _isEnabled = false; bool inverted = ((int)CameraRef.transform.rotation.eulerAngles.z) == 180; switch (state) { case KeyboardState.Closed: default: fromPosition = transform.position; toPosition = transform.position + transform.up * -5; callback = () => { _isEnabled = true; if (Display.isActiveAndEnabled) { Display.ResetDisplayPosition(); Text = ""; } }; break; case KeyboardState.Open: Show(); fromPosition = CameraRef.ViewportToWorldPoint(new Vector3(0.5f, inverted ? 1 : 0, 7.5f)) + transform.up * -5; toPosition = CameraRef.ViewportToWorldPoint(new Vector3(0.5f, inverted ? 1 : 0, 7.5f)); if (Display.isActiveAndEnabled) { Display.ReturnText(); } callback = () => { _isEnabled = true; }; break; case KeyboardState.Text: Show(); fromPosition = transform.position; toPosition = CameraRef.ViewportToWorldPoint(new Vector3(0.5f, inverted ? 1.29f : -0.29f, 7.5f)); if (Display.isActiveAndEnabled) { Display.CenterText(); } break; case KeyboardState.Custom: Show(); if (Display.isActiveAndEnabled) { Display.ReturnText(); } callback = () => { _isEnabled = true; }; if (CurrentState == KeyboardState.Open) { fromPosition = transform.position; toPosition = transform.position; toPosition.x = pos.GetValueOrDefault(); } else { fromPosition = CameraRef.ViewportToWorldPoint(new Vector3(0.5f, inverted ? 1 : 0, 7.5f)) + transform.up * -5; fromPosition.x = pos.GetValueOrDefault(); toPosition = CameraRef.ViewportToWorldPoint(new Vector3(0.5f, inverted ? 1 : 0, 7.5f)); toPosition.x = pos.GetValueOrDefault(); } state = KeyboardState.Open; break; } CurrentState = state; _tween.Stop(); _tween.SetPosition(fromPosition, toPosition); _tween.Play(callback); EnableButtons(); }
public void SetCameraWeight(int radius, object cRef) { CameraRef reference = (CameraRef)cRef; reference.Camera.Radius = radius; }
public int GetCameraWeight(object cRef) { CameraRef reference = (CameraRef)cRef; return(reference.Camera.Weight); }
public void MoveCamera(int rowOffset, int colOffset, object cRef) { CameraRef reference = (CameraRef)cRef; reference.Camera.Move(rowOffset, colOffset); }
public void SetCameraPosition(int row, int col, object cRef) { CameraRef reference = (CameraRef)cRef; reference.Camera.SetCamera(row, col, reference.Camera.Weight); }
public MapPos GetCameraPosition(object cRef) { CameraRef reference = (CameraRef)cRef; return(new MapPos(reference.Camera.Row, reference.Camera.Col)); }