private void HandleMouseSelection()
    {
        if (_playerMovingTrigger)
        {
            return;
        }

        if (EventSystem.current.IsPointerOverGameObject())
        {
            return;
        }

        if (Input.GetMouseButtonDown(0))
        {
            RaycastHit hitInfo = new RaycastHit();
            bool       hit     = Physics.Raycast(Camera.main.ScreenPointToRay(Input.mousePosition), out hitInfo);

            if (hit)
            {
                GameObject             parentObject     = hitInfo.transform.parent.gameObject;
                WorldMapSectionHandler wmSectionHandler = parentObject.GetComponent <WorldMapSectionHandler>();

                if (wmSectionHandler != null)
                {
                    int posX = wmSectionHandler.PositionX;
                    int posY = wmSectionHandler.PositionY;

                    CommandHandler.Send(new MoveCharRequestCmdBuilder(posX, posY));
                }
            }
        }
    }
示例#2
0
        public void InstantiateOnScene(ISpecificSceneManager sceneManager)
        {
            _sceneManager = sceneManager;
            GameObject mapSectionPrefab = (GameObject)Resources.Load("Prefabs/WorldMap/WorldMapSection", typeof(GameObject));

            _worldMapSectionInstance = _sceneManager.InstantiateExternally(mapSectionPrefab, null);
            _sectionHandler          = _worldMapSectionInstance.GetComponent <WorldMapSectionHandler>();
        }