예제 #1
0
    private bool TrapsSpring(MapSquare square)
    {
        List <MapObject> mapObjects = square.GetMapObjects();

        foreach (MapObject mapObject in mapObjects)
        {
            if (mapObject.GetObjectType() == "Trap" && mapObject.GetIsActive() == true)
            {
                mapObject.TriggerTrap(square);
                return(true);
            }
        }
        return(false);
    }
    private MapObject GetTrapObjectFromSquare()
    {
        List <MapObject> mapObjects = currentSquare.GetMapObjects();

        foreach (MapObject mapObject in mapObjects)
        {
            if (mapObject.GetObjectType() == "Trap")
            {
                return(mapObject);
            }
        }

        // This should never happen...
        return(mapObjects[0]);
    }
    public void InitializeMenu(MapSquare newSquare)
    {
        gameObject.SetActive(true);
        square = newSquare;

        locationImage = square.GetLocationImage();

        Image[] images = GetComponentsInChildren <Image>();
        foreach (Image image in images)
        {
            switch (image.name)
            {
            case "LocationImageContent":
                image.sprite = locationImage;
                break;
            }
        }

        poiMenu.SetupButtons(square.GetMapObjects());
        hackMenu.SetupButtons(square.GetHackTargets());

        UpdateEffectsButton();
    }
예제 #4
0
    private void DisableATrap(MapSquare currentSquare)
    {
        MapSquare[]      squares          = FindObjectsOfType <MapSquare>();
        List <MapSquare> squaresWithTraps = new List <MapSquare>();

        foreach (MapSquare square in squares)
        {
            if (square.IsActive())
            {
                List <MapObject> mapObjects = square.GetMapObjects();
                foreach (MapObject mapObject in mapObjects)
                {
                    if (mapObject.GetObjectType() == "Trap" && mapObject.GetIsActive() == true)
                    {
                        squaresWithTraps.Add(square);
                    }
                }
            }
        }

        // Sort to get the nearest trap
        squaresWithTraps.Sort(SortByDistance);

        if (squaresWithTraps.Count > 0)
        {
            MapSquare        squareToDisable = squaresWithTraps[0];
            List <MapObject> mapObjects      = squareToDisable.GetMapObjects();
            foreach (MapObject mapObject in mapObjects)
            {
                if (mapObject.GetObjectType() == "Trap")
                {
                    mapObject.SetIsActive(false);
                    Debug.Log("Disabled a Trap");
                }
            }
        }
    }
    public void InitializeMenu(MapSquare mapSquare)
    {
        gameObject.SetActive(true);
        square          = mapSquare;
        locationImage   = square.GetLocationImage();
        hackTargets     = square.GetHackTargets();
        mapObjects      = square.GetMapObjects();
        poiScoutLevel   = square.GetPOIScoutLevel();
        enemyScoutLevel = square.GetEnemyScoutLevel();

        Image[] images = GetComponentsInChildren <Image>();
        foreach (Image image in images)
        {
            switch (image.name)
            {
            case "LocationImageContent":
                image.sprite = locationImage;
                break;
            }
        }

        enemy = mapSquare.GetEnemy();

        if (enemy != null || enemyScoutLevel == 1)
        {
            enemyInfo.SetupEnemyInfo(enemy, square, enemyScoutLevel);
        }
        else if (enemy == null && enemyScoutLevel == 3 || enemy == null && enemyScoutLevel == 2)
        {
            enemyInfo.SetupEmptyEnemy(square);
        }

        SetupHackTargets();
        CheckIsPlayerAdjacent();
        UpdateEffectsButton();
    }