Пример #1
0
    public void loadHeroPossition()
    {
        int[] heroesOrder = { 3, 1, 0, 2 };

        for (int i = 0; i < buttonForCameraMovement.getHeroesObjects().Count - 1; i++)
        {
            GameObject      tempObject = buttonForCameraMovement.getHeroesObjects()[heroesOrder[3 - i]];
            SpriteRenderer  spriteRendererOfTempObject = tempObject.GetComponent <SpriteRenderer>();
            FightModeObject tempFightModeObject        = new FightModeObject(tempObject.transform.position,
                                                                             spriteRendererOfTempObject.bounds.size.x, spriteRendererOfTempObject.bounds.size.y, "hero");
            heroObjectsArray.Add(tempFightModeObject);
        }
    }
Пример #2
0
    public void generateFightModeScene(int idOfCorridor, int idOfEnemyParty)
    {
        GameObject     tempObject;
        SpriteRenderer spriteRender;
        string         filePath             = "FightSceneBackground/";
        string         typeOfDungeonTexture = "Icy_Background";

        tempObject = Instantiate(factoryObject);
        tempObject.SetActive(false);

        Debug.Log("DungeonsGenerator || generateFightModeScene || CreatedFightBackgroundScene ");

        //----------------------------------------------------------------------------------------------------------------------

        //Adding SpriteRenderer to component (later we can change it to add it into cloned object)
        spriteRender = tempObject.AddComponent <SpriteRenderer>();


        spriteRender.sprite = Resources.Load <Sprite>(filePath + typeOfDungeonTexture);
        tempObject.transform.SetParent(GameObject.Find("Dungeon").transform, false);
        tempObject.transform.localScale = new Vector3(100, 100, 1);

        tempObject.name = "BattleBackgroundObject";
        tempObject.SetActive(true);

        //Using minus here because coordinates are from -400 to 400
        float halfOfCanvasWidth = (float)(dungeonCanvas.GetComponent <RectTransform>().rect.width *(-0.5));
        //90 is original space and we're scaling it by 5/7
        float scaledSpaceBetweenHeroes = 90 * 5 / 7;

        //Due to order of drawing heroes in corridors i had to make a map of orders
        int[] heroesOrder = { 3, 1, 0, 2 };

        //After generating last chunk we are generating border chunks
        for (int i = 0; i < movementButton.getHeroesObjects().Count; i++)
        {
            movementButton.getHeroesObjects()[heroesOrder[3 - i]].transform.localPosition = new Vector3(halfOfCanvasWidth + (((3 - i) + 1) * scaledSpaceBetweenHeroes), movementButton.getHeroesObjects()[heroesOrder[3 - i]].transform.localPosition.y, 0);
            //Now i'm gonna scale it down to 5/7 of the original size (35)
            movementButton.getHeroesObjects()[heroesOrder[3 - i]].transform.localScale = new Vector3(25, 25, 1);
        }

        //Here i should load enemyParty
        EnemyParty encounteredEnemyParty = loadSpecificEnemyParty(idOfCorridor, idOfEnemyParty);

        for (int i = 0; i < dungeonManager.getLevelsArray().Find(x => x.getIdOfLevel() == idOfCorridor).getEnemyParties()[idOfEnemyParty].getEnemyObjectArray().Count; i++)
        {
            Debug.Log("EnemyObject_" + idOfEnemyParty + "." + i);
        }
    }