Exemplo n.º 1
0
    void HandleInput()
    {
        if (editmode == true)
        {
            currIndex = select.ChangeTerrain(colors, activeColor);
        }
        else
        {
            currIndex = select.GetCurrIndex();
        }

        if (currIndex == selIndex) //TODO return if hit UI object
        {
            return;
        }

        //-----Selector--------------
        Debug.Log(currIndex);
        GameObject selEntityObj    = hexGrid.GetEntityObject(selIndex);
        GameObject currEntityObj   = hexGrid.GetEntityObject(currIndex);
        GameObject currBuildingObj = hexGrid.GetBuildingObject(currIndex);

        avaliableActions = new List <string>();

        if (entityStorage.GetPlayerEntityList(playerManager.currPlayer).Contains(currEntityObj))
        {
            movement.UnhighlightPossMovement(hexGrid.GetEntityObject(selIndex));
            movement.UnhighlightPossAttack(hexGrid.GetEntityObject(selIndex));
            //display all possible positions
            movement.HighlightPossMovement(currEntityObj, currIndex);
            movement.HighlightPossAttack(currEntityObj, currIndex);
            //TODO list info for curr entity, display it
            avaliableActions = entityStats.GetCurrSpecialActions(currEntityObj);
            lockbattle       = false;
        }
        if (buildingStorage.GetPlayerBuildingList(playerManager.currPlayer).Contains(currBuildingObj))
        {
            buildingManager.DisplayBuilding(currIndex);
            //TODO GUI for buildings
        }
        //ensures attacks only happen once per update
        //TODO add here: lock ability for user to save while attack in progress because battle object is not saved
        if (lockbattle == false && selEntityObj != null)
        {
            battle.PerformAction(selIndex, currIndex, chosenAction);
            lockbattle = true;
        }

        selIndex = currIndex;
    }