public void SetMapData(MapGrid newMapGrid, MapSquare mapSquare, HackTarget newHackTarget)
 {
     mapGrid          = newMapGrid;
     currentMapSquare = mapSquare;
     hackTarget       = newHackTarget;
     trapType         = mapSquare.GetTriggeredTrapType();
 }
    public void SpawnTransportationNode()
    {
        HackTarget newHackTarget = ScriptableObject.CreateInstance <HackTarget>();

        newHackTarget.SetupHackTarget("Transportation");
        hackTargets.Add(newHackTarget);
    }
 public void ReopenHackMenu(HackTarget hackTarget)
 {
     foreach (MenuHackButton button in buttons)
     {
         if (button.GetHackTarget() == hackTarget)
         {
             button.OpenHackMenu();
             break;
         }
     }
 }
    public void ReopenHackMenu(HackTarget hackTarget)
    {
        if (mapConfig == null)
        {
            mapConfig = FindObjectOfType <MapConfig>();
        }
        mapConfig.SetIsAMenuOpen(true);
        CurrentNodeMenu menu = mapConfig.GetCurrentNodeMenu();

        menu.InitializeMenu(this);
        menu.ReopenHackMenu(hackTarget);
    }
    public void LoadHackFromMap(MapSquare mapSqare, HackTarget hackTarget)
    {
        MapGrid mapGrid = FindObjectOfType <MapGrid>();

        currentHack = Instantiate(hackBattleData);
        currentHack.SetCharacterData(currentRunner, currentHacker);
        currentHack.SetMapData(mapGrid, mapSqare, hackTarget);

        //Destroy(FindObjectOfType<MapGrid>());
        //SceneManager.LoadScene(hackSceneName);
        Transitioner.Instance.TransitionToScene(hackSceneName);
        StartCoroutine(WaitForHackToLoadFromMap());
    }
예제 #6
0
    public void InitializeHackOptionsLine(string newColor, int newCost, string newDescription, HackTarget newHackTarget, string newPopupHelperDescription)
    {
        popupHelperDescription = newPopupHelperDescription;
        hackTarget             = newHackTarget;
        color       = newColor;
        cost        = newCost;
        description = newDescription;

        pointColorIcon.sprite = FindObjectOfType <MapSquareImageHolder>().GetPointSquareByColor(color);
        pointCostField.text   = cost.ToString();
        descriptionField.text = description;
        buttonImage.sprite    = buttonActive;
    }
    public void InitializeMapHackMenu(HackTarget newHackTarget)
    {
        mapSquare  = currentNodeMenu.GetMapSquare();
        hackTarget = newHackTarget;
        MapSquareImageHolder imageHolder = FindObjectOfType <MapSquareImageHolder>();

        hackTypeImage.sprite = imageHolder.GetImageForHackOrPOI(hackTarget.getHackType());
        hackTypeIcon.sprite  = imageHolder.GetButtonImageByName(hackTarget.getHackType(), true);

        SetupHackButtonOrPoints();
        SetupHackOptionsLines();
        CheckHackCosts();
    }
예제 #8
0
    public void SetupButton(HackTarget newHackTarget)
    {
        hackTarget = newHackTarget;
        Image image = GetComponent <Image>();

        image.enabled = true;
        GetComponent <Button>().enabled = true;
        image.sprite = FindObjectOfType <MapSquareImageHolder>().GetButtonImageByName(hackTarget.getHackType(), hackTarget.GetIsActive());
        if (!hackTarget.GetIsActive())
        {
            GetComponent <Button>().enabled = false;
        }
        hackName.enabled = true;
        hackName.text    = hackTarget.getHackType();
    }
예제 #9
0
    public void SetUpMapFromHack(MapSquare currentSquare, HackTarget currentHackTarget)
    {
        SetupPlayerPortraits();
        runner.MapSetup();

        mapConfig = FindObjectOfType <MapConfig>();
        mapConfig.SetupPipManagers(runner, setupTimeInSeconds, securityLevel);

        MapSquare[] mapSquares = FindObjectsOfType <MapSquare>();
        foreach (MapSquare square in mapSquares)
        {
            if (square.GetIsPlayerPresent())
            {
                square.SetPlayerStart();
                break;
            }
        }

        currentSquare.ReopenHackMenu(currentHackTarget);
    }
    private void SetupHacksAndObjects(bool isFirstSquare)
    {
        SetupHackObjectSpawnLists(isFirstSquare);

        // random 1-3
        int objectsToSpawn = Random.Range(1, 4);

        while (objectsToSpawn > 0)
        {
            int random = Random.Range(0, 100);
            if (random <= 45)
            {
                HackTarget newHackTarget = ScriptableObject.CreateInstance <HackTarget>();
                string     newHackType   = availableHackTypes[Random.Range(0, availableHackTypes.Count)];

                if (newHackType == "Transportation")
                {
                    hasTransportationNode = true;
                    parentRow.GetMapGrid().AddATransportationNode();
                }

                newHackTarget.SetupHackTarget(newHackType);
                availableHackTypes.Remove(newHackType);

                hackTargets.Add(newHackTarget);
                objectsToSpawn--;
            }
            else if (random > 45)
            {
                MapObject newMapObject     = ScriptableObject.CreateInstance <MapObject>();
                string    newMapObjectType = availableObjectTypes[Random.Range(0, availableObjectTypes.Count)];
                newMapObject.SetupMapObject(newMapObjectType);
                availableObjectTypes.Remove(newMapObjectType);

                mapObjects.Add(newMapObject);
                objectsToSpawn--;
            }
        }
    }
 public void ReopenHackMenu(HackTarget hackTarget)
 {
     hackMenu.ReopenHackMenu(hackTarget);
 }
 private IEnumerator WaitForMapToLoadFromHack(MapGrid mapGrid, MapSquare currentSquare, HackTarget currentHackTarget, int redPoints, int bluePoints, int greenPoints)
 {
     while (SceneManager.GetActiveScene().name != mapSceneName)
     {
         yield return(null);
     }
     mapGrid.gameObject.SetActive(true);
     currentHackTarget.SetPoints(redPoints, bluePoints, greenPoints);
     currentMap.SetUpMapFromHack(currentSquare, currentHackTarget);
     CenterCameraOnPlayer();
     DestroyExtraGrids();
 }
    public void LoadMapFromHack(int redPoints, int bluePoints, int greenPoints, MapSquare currentSquare, HackTarget currentHackTarget)
    {
        MapGrid mapGrid = FindObjectOfType <HackBattleData>().GetMapGrid();

        //SceneManager.LoadScene(mapSceneName);
        Transitioner.Instance.TransitionToScene(mapSceneName);

        currentMap = FindObjectOfType <MapData>();
        currentMap.TrackCompletedHack();

        HackBattleData previousHack = FindObjectOfType <HackBattleData>();

        currentMap.RemoveFromTemporaryCardIds(previousHack.GetTemporaryCardIdsToRemove());
        Destroy(previousHack.gameObject);

        StartCoroutine(WaitForMapToLoadFromHack(mapGrid, currentSquare, currentHackTarget, redPoints, bluePoints, greenPoints));
    }