예제 #1
0
		void _NewHoveredTile(Tile tile){
			hoveredTile=tile;
			
			if(AbilityManager.InTargetMode()){
				SetTargetModeHoveredTile(tile);
				return;
			}
			
			bool isWalkable=walkableTileList.Contains(tile);
			
			bool isSelectedUnitTile=GameControl.GetSelectedUnit()==null ? false : true;
			if(isSelectedUnitTile) isSelectedUnitTile=GameControl.GetSelectedUnit().tile!=tile ? false : true ;
			
			//show cover overlay if cover-system is enabled
			if(GameControl.EnableCover() && (isWalkable || isSelectedUnitTile)){
				OverlayManager.ShowCoverOverlay(tile);
			}
			
			//highlight potential target for the unit to be moved into this tile
			if(isWalkable && GameControl.GetSelectedUnit().CanAttack()){
				SetWalkableHostileList(tile);
			}
			
			TBTK.OnHoverTile(tile);
		}
예제 #2
0
		void _ClearHoveredTile(){
			if(hoveredTile!=null){
				ClearWalkableHostileList();
			}
			
			ShowHostileIndicator(attackableTileList);
			
			hoveredTile=null;
			
			OverlayManager.HideCoverOverlay();
			
			if(AbilityManager.InTargetMode()) ClearTargetModeHoveredTile();
			
			TBTK.OnHoverTile(null);
		}
예제 #3
0
		public void _OnCursorDown(int cursorID=-1){
			//Debug.Log("_OnCursorDown");
			
			if(hoveredTile==null) return;
			
			if(TBTK.IsCursorOnUI(cursorID)) return;
			
			if(!TurnControl.ClearToProceed()) return;
			
			if(GameControl.GetGamePhase()==_GamePhase.Over) return;
			
			if(GameControl.GetGamePhase()==_GamePhase.UnitDeployment){
				if(hoveredTile.unit==null) FactionManager.DeployUnitOnTile(hoveredTile);
				else if(hoveredTile.unit!=null) FactionManager.UndeployUnit(hoveredTile.unit);
				return;
			}
			
			if(AbilityManager.InTargetMode()){
				Debug.Log("AbilityTargetSelected");
				targetModeTargetSelected(hoveredTile);
			}
			else OnTile(hoveredTile);
		}
예제 #4
0
        IEnumerator OnLeftCursorDown(int pointer = -1)
        {
            yield return(null);

            if (UI.IsCursorOnUI(pointer))
            {
                yield break;
            }

            Tile tile = GridManager.GetHoveredTile();

            if (tile != null)
            {
                if (GameControl.GetGamePhase() == _GamePhase.UnitDeployment)
                {
                    GridManager.OnCursorDown();
                    yield break;
                }

                if (AbilityManager.InTargetMode())
                {
                    GridManager.OnCursorDown();
                    yield break;
                }

                heldTile        = tile;
                holdStartedTime = Time.time;

                if (touchMode && GridManager.CanAttackTile(GridManager.GetHoveredTile()))
                {
                    NewClickTile(tile);
                }
                else if (touchMode && GridManager.CanMoveToTile(GridManager.GetHoveredTile()))
                {
                    NewClickTile(tile);
                }
                else
                {
                    if (!GridManager.CanPerformAction(tile))
                    {
                        //ClearLastClickTile();     dont call last click tile, we dont want to hide unit info if there's any
                        lastClickTile = null;
                        UIInputOverlay.SetNewHoveredTile(null);
                    }
                    else
                    {
                        GridManager.OnCursorDown();                             //ClearLastClickTile() will be called as soon as unit move or attack or cast ability
                    }
                }
            }
            else
            {
                ClearLastClickTile();
            }

            //~ if(tile!=null){
            //~ if(tile.unit!=null){
            //~ if(!GameControl.CanSelectUnit(tile.unit)) UIUnitInfo.Show(tile);
            //~ else{
            //~ GridManager.OnCursorDown();
            //~ UIUnitInfo.Hide();
            //~ return;
            //~ }
            //~ }
            //~ else UIUnitInfo.Hide();

            //~ if(touchMode && GridManager.CanAttackTile(GridManager.GetHoveredTile())){
            //~ NewClickTile(tile);
            //~ }
            //~ else if(touchMode && GridManager.CanMoveToTile(GridManager.GetHoveredTile())){
            //~ NewClickTile(tile);
            //~ }
            //~ else{
            //~ if(!GridManager.CanPerFormAction(tile)){
            //~ //ClearLastClickTile();     dont call last click tile, we dont want to hide unit info if there's any
            //~ lastClickTile=null;
            //~ UIInputOverlay.SetNewHoveredTile(null);
            //~ }
            //~ else GridManager.OnCursorDown();	//ClearLastClickTile() will be called as soon as unit move or attack or cast ability
            //~ }
            //~ }
            //~ else ClearLastClickTile();
        }