public void CorrectCameraToCursor(MapCursor cursor, Vector2 screenDimensions, Vector2 mapSize) { if (currentCamPosition != targetCamPosition) { return; } if (cursor.GetMapCoordinates().X *GameDriver.CellSize < GetWestBound(currentCamPosition.X)) { MoveCameraInDirection(CameraDirection.Left); } if (cursor.GetMapCoordinates().X *GameDriver.CellSize > GetEastBound(screenDimensions.X, currentCamPosition.X)) { MoveCameraInDirection(CameraDirection.Right); } if (cursor.GetMapCoordinates().Y *GameDriver.CellSize < GetNorthBound(currentCamPosition.Y)) { MoveCameraInDirection(CameraDirection.Up); } if (cursor.GetMapCoordinates().Y *GameDriver.CellSize > GetSouthBound(screenDimensions.Y, currentCamPosition.Y)) { MoveCameraInDirection(CameraDirection.Down); } CorrectCameraToMap(screenDimensions, mapSize); }
private GameScreen() { handlers = new Stack <IInputHandler>(); mapCursor = new MapCursor(); titleFont = IO.LoadFont("Data/Global/TitleFont"); actionFont = IO.LoadFont("Data/Global/ActionFont"); messageFont = IO.LoadFont("Data/Global/MessageFont"); topEdgePosition = Vector2.Zero; bottomEdgePosition = new Vector2(0, 788); leftEdgePosition = new Vector2(0, 12); midleEdgePosition = new Vector2(980, 12); rightEdgePosition = new Vector2(1268, 12); hEdgeTexture = IO.LoadSingleTexture(GAME_ROOT_DIRECTORY + "horizontaledge"); vEdgeTexture = IO.LoadSingleTexture(GAME_ROOT_DIRECTORY + "verticaledge"); tacticsTitlePosition = new Vector2(183, 339); battleTitlePosition = new Vector2(137, 339); titleColor = new Color(0, 0, 0, 255); actionBoxTexture = IO.LoadSingleTexture(GAME_ROOT_DIRECTORY + "actionbox"); actionBox = new ActionBox(actionFont, actionBoxTexture); infoBox = new InfoBox(); chatBox = new ChatBox(); }
private void Awake() { // Hidden by default m_VisualRoot.SetActive(false); m_Cursor = FindObjectOfType <MapCursor>(); }
void Awake() { Engine.InputManager = GetComponent <InputManager>(); Engine.CameraManager = GameObject.Find("Camera Rig").GetComponent <CameraManager>(); Engine.MapCursor = GameObject.Find("Map Cursor").GetComponent <MapCursor>(); Engine.PathManager = GameObject.Find("Tiles").GetComponent <PathManager>(); Engine.TileManager = GameObject.Find("Tiles").GetComponent <TileManager>(); Engine.CombatManager = GameObject.Find("Units").GetComponent <CombatManager>(); Engine.SoundManager = GetComponent <SoundManager>(); Engine.TimelineManager = GameObject.Find("Timelines").GetComponent <TimelineManager>(); }
public override void OnInspectorGUI() { base.OnInspectorGUI(); MapCursor mapCursor = (MapCursor)target; if (GUILayout.Button("Show")) { mapCursor.Show(); } if (GUILayout.Button("Hide")) { mapCursor.Hide(); } }
// Use this for initialization void Start() { //get things if not set if (!board) { board = GameObject.FindGameObjectWithTag(boardTag).GetComponent <BoardManager>(); } if (!cursor) { cursor = GameObject.FindGameObjectWithTag(cursorTag).GetComponent <MapCursor>(); } cursor.GoToTile(cursorStartTile); }
// Use this for initialization void Start() { if (miniMap == null) { miniMap = GameObject.Find("Minimap"); miniMaprtf = miniMap.GetComponent <RectTransform>(); miniMapSize = new Vector2(miniMaprtf.rect.width, miniMaprtf.rect.height); quondam = Instantiate(miniMaprtf); } MapCursor.GetComponent <RectTransform>().SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, MapCursorRadius); MapCursor.GetComponent <RectTransform>().SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, MapCursorRadius); backgroundimage = miniMap.GetComponent <UnityEngine.UI.RawImage>(); mapProperty = backgroundimage.material; pool.EOnUsed += OnObjChane; init(); originalSize = miniMapSize; //StartCoroutine(() => //{ // yield return 0.1; //};) }
public MapContainer(List <MapObject[, ]> gameGrid, ITexture2D cursorTexture) { this.gameGrid = gameGrid; mapCursor = BuildMapCursor(cursorTexture); }
private void Awake() { m_Cursor = FindObjectOfType <MapCursor>(); m_Tooltip = FindObjectOfType <BuildingTooltipController>(); }
private void Awake() { m_Cursor = FindObjectOfType <MapCursor>(); }
private void Start() { m_Building = GetComponentInParent <Building>(); m_Cursor = FindObjectOfType <MapCursor>(); }