public void TurnOnBattleScene(BattleDef recivedBattleDef)
 {
     battleDef = recivedBattleDef;
     SetUpBattle();
     battleFolder.SetActive(true);
     Debug.Log("SET OVERWORLD TO FALSE !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
     overworldFolder.SetActive(false);
     Invoke("ShowTitle", .3f);
 }
Beispiel #2
0
 public BattleDef RollEncounter(DangerZoneDef dZ)
 {
     if (RollIfEncounterHappened(dZ))
     {
         BattleDef battleDef = new BattleDef();
         battleDef.encounterType = RollEncounterType(dZ);
         battleDef.enemyMix      = RollEnemyMix(dZ);
         return(battleDef);
     }
     else
     {
         return(null);
     }
 }
        void Start()
        {
            if (BattleWrapper.Def != null)
                return;

            var def = new BattleDef(Stage, Party.Build())
            {
            #if BALANCE
                UseDataInput = false,
            #endif
            };

            def.RealtimeEnabled = RealtimeEnabled;
            BattleWrapper.Def = def;
        }
        void Start()
        {
            Debug.Assert(Def != null);
            if (Def == null) return;
            Battle = new Battle(Def);
            Def = null;

            _viewController.enabled = true;
            _battleController.enabled = true;
            _hudController.enabled = true;

            #if UNITY_EDITOR
            var partyDebugView = gameObject.AddComponent<PartyDebugView>();
            partyDebugView.BattleWrapper = this;

            var bossDebugView = gameObject.AddComponent<BossDebugView>();
            bossDebugView.BattleWrapper = this;
            #endif
        }
Beispiel #5
0
    private void CheckForEncounter()
    {
        Debug.Log("Get cur zone");
        DangerZoneDef dangerZone = heatMapTileInfo.GetCurZone(transform.position);
        BattleDef     newBattle  = new BattleDef();

        if (dangerZone == null)
        {
            Debug.Log("failed to find a danger zone at this location. Is your heat map painted? does your heat map string name correspond to the name of a danger zone?");
        }
        else
        {
            newBattle = GetComponent <EncounterRoller>().RollEncounter(dangerZone);
            if (newBattle != null)
            {
                //returnPosition = transform.position;
                Debug.Log("start new battle");
                newBattle.pcsInBattle = PartyManager.curParty.partyMembers;
                battleStarter.TurnOnBattleScene(newBattle);
            }
        }
    }
    public void SetUpBattle()
    {
        ResetBattle();
        if (battleDef == null)
        {
            battleDef = defaultBd;
        }
        SetupBackground();
        SetupEncounter();
        SetupSituations();
        SetupPCBlanks();
        SetupMonsters();


        objectsInBattle.ExitBattle = Victory;

        battleFolder.SetActive(true);
        objectsInBattle.CollectObjectsInBattle();
        battleMenuManager.SetupBattleMenuManager();

        overworldFolder.SetActive(false);
    }
Beispiel #7
0
    void CheckForInteraction()
    {
        RaycastHit2D rh2d = Physics2D.Raycast(((Vector2)transform.position + oM.raycastOffset), direction, .5f, mask);

        if (rh2d.transform != null)
        {
            if (rh2d.transform.gameObject.layer == LayerMask.NameToLayer("BattlePC"))
            {
                BattleDef newBattle = GetComponent <EncounterRoller>().RollEncounter(tempArmyDangerZone);
                if (newBattle != null)
                {
                    //returnPosition = transform.position;
                    newBattle.pcsInBattle = PartyManager.curParty.partyMembers;
                    battleStarter.GetComponent <BattleStarter>().TurnOnBattleScene(newBattle);
                }

                EndTurn();
                //Start special battle
            }
            else if (rh2d.transform.gameObject.layer == LayerMask.NameToLayer("Settlement"))
            {
                this.enabled = false;
                BattleArmy enemyBattleArmy = rh2d.transform.gameObject.GetComponent <BattleArmy>();
                BattleArmy thisBattleArmy  = GetComponent <BattleArmy>();

                thisBattleArmy.DoAttackTurn(enemyBattleArmy);

                enemyBattleArmy.DoAttackTurn(thisBattleArmy);
                EndTurn();
                //Resolve 1 round of strategic battle
            }
            else if (rh2d.transform.gameObject.layer == army.value)
            {
                EndTurn();
                //Resolve 1 round of strategic battle
            }
        }
    }