Exemplo n.º 1
0
    // Update is called once per frame

    void GetGrid()
    {
        grid              = gridCombatSystem.GetGrid();
        lastActiveCell    = grid.GetGridObject(0, 0);
        lastPlayerCell    = grid.GetGridObject(player.transform.position);
        rangeCombatPlayer = player.rangeCombat;
    }
Exemplo n.º 2
0
 public void UpdateObjectsInCellRefrences()
 {
     grid.GetGridObject(player.transform.position).SetObjectInTile(player.gameObject);
     grid.TriggerGridObjectChange(grid.GetGridObject(player.transform.position).x(), grid.GetGridObject(player.transform.position).y());
     foreach (var character in charactersInFight)
     {
         grid.GetGridObject(character.transform.position).SetObjectInTile(character);
         grid.TriggerGridObjectChange(grid.GetGridObject(character.transform.position).x(), grid.GetGridObject(character.transform.position).y());
     }
 }
Exemplo n.º 3
0
            void VisualizeRadious(GridObject playerCell)
            {
                int poolingCount  = 0;
                int maxCellOffset = player.MaxCellMovmentRadious();

                for (int i = -maxCellOffset - 1; i <= maxCellOffset; i++)
                {
                    for (int j = -maxCellOffset - 1; j <= maxCellOffset; j++)
                    {
                        GridObject cell = grid.GetGridObject(playerCell.x() + i, playerCell.y() + j);
                        if (cell != null && cell.isWalkable() && player.CellInRadious(cell))
                        {
                            radiousVisualizationnPool[poolingCount].transform.position = cell.GetCellPos();
                            radiousVisualizationnPool[poolingCount].SetActive(true);
                            poolingCount++;
                        }
                    }
                }
            }
Exemplo n.º 4
0
    void Update()
    {
        mousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
        var currentActiveCell = grid.GetGridObject(Camera.main.ScreenToWorldPoint(Input.mousePosition));
        var playerCell        = grid.GetGridObject(player.transform.position);

        pathAndRadiousVisualiation.ActiveCellVisualization(currentActiveCell);
        if (gridCombatSystem.GetState() == GridCombatSystem.State.playerRound)
        {
            pathAndRadiousVisualiation.HandlePlayerRadiousVisualiation(currentActiveCell, playerCell);
            HandlePathFindingAndVisualiation(currentActiveCell, playerCell);
            HandleMouseInput(mousePos);
        }
        else
        {
            pathAndRadiousVisualiation.ClearVisualization();
        }
        DebugInput();
    }