コード例 #1
0
ファイル: PlayerInputs.cs プロジェクト: SachsA/MiningBattle
 public void SwitchBetweenSelection()
 {
     if (selectSpaceshipManager.GetActive() == true)
     {
         digButtonAnimator.SetTrigger("EnableDig");
     }
     else
     {
         digButtonAnimator.SetTrigger("DisableDig");
     }
     selectSpaceshipManager.SetActive(!selectSpaceshipManager.GetActive());
     mineZoneSelection.SetActive(!mineZoneSelection.GetActive());
 }
コード例 #2
0
    private void Inputs()
    {
        if (!_selectSpaceshipManager.GetActive())
        {
            return;
        }
        if (Input.GetMouseButtonDown(1))
        {
            if (EventSystem.current.IsPointerOverGameObject())
            {
                return;
            }
            var mousePosition = pathfinder.GetMousePosition();

            Tile tile = pathfinder.worldData.TileManager.GetTileFromPosition(mousePosition);
            if (tile != null)
            {
                _selectedSeekers = _selectSpaceshipManager.GetSelectedSeekers();

                var index = 0;
                foreach (var selectedSeeker in _selectedSeekers)
                {
                    selectedSeeker.SetIndexSeeker(index);

                    Miner miner = selectedSeeker.gameObject.GetComponent <Miner>();
                    if (miner != null)
                    {
                        miner.ManualMove(tile);
                    }


                    index++;
                }
                pathfinder.FindPath(tile, _selectedSeekers);
            }
        }
    }