Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        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>();
    }
Ejemplo n.º 4
0
 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>();
 }
Ejemplo n.º 5
0
    public override void OnInspectorGUI()
    {
        base.OnInspectorGUI();
        MapCursor mapCursor = (MapCursor)target;

        if (GUILayout.Button("Show"))
        {
            mapCursor.Show();
        }
        if (GUILayout.Button("Hide"))
        {
            mapCursor.Hide();
        }
    }
Ejemplo n.º 6
0
    // 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);
    }
Ejemplo n.º 7
0
 // 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;
     //};)
 }
Ejemplo n.º 8
0
 public MapContainer(List <MapObject[, ]> gameGrid, ITexture2D cursorTexture)
 {
     this.gameGrid = gameGrid;
     mapCursor     = BuildMapCursor(cursorTexture);
 }
Ejemplo n.º 9
0
 private void Awake()
 {
     m_Cursor  = FindObjectOfType <MapCursor>();
     m_Tooltip = FindObjectOfType <BuildingTooltipController>();
 }
 private void Awake()
 {
     m_Cursor = FindObjectOfType <MapCursor>();
 }
Ejemplo n.º 11
0
 private void Start()
 {
     m_Building = GetComponentInParent <Building>();
     m_Cursor   = FindObjectOfType <MapCursor>();
 }