Beispiel #1
0
    /// <summary>
    /// 我的回合结束
    /// </summary>
    public void MyTurnEnd()
    {
        //补给各地块
        //todo
        curCampIndex = (curCampIndex + 1) % CampCount;
        List <int> campIDs = new List <int>(GameDataSet.Instance.CampModelDic.Keys);

        CurCamp = CampDic[campIDs[curCampIndex]];
        if (BattleEndMyTurn != null)
        {
            BattleEndMyTurn();
        }
        //目前模拟本地人人对战
        //把if括号加上就是人机回合
        //if (CurCamp == MyCamp)
        //{
        CurBattleState = BattleStateDictionary[BattleStateEnum.MyRound];
        CurBattleState.EnterStateWithMouse(ref BattleMap.mapEnterAction, ref BattleMap.mapClickAction, ref BattleMap.mapExitAction);
        //}
        //else
        //{
        //    //转到下一回合
        //    CurBattleState = BattleStateDictionary[BattleStateEnum.None];
        //    CurBattleState.EnterState();
        //}
    }
Beispiel #2
0
    private void Awake()
    {
        BattleStateDictionary = new Dictionary <BattleStateEnum, BattleStateBase>();
        BattleStateDictionary.Add(BattleStateEnum.None, new BattleStateBase());
        BattleStateDictionary.Add(BattleStateEnum.SelectCaptital, new SelectCapitalState());
        BattleStateDictionary.Add(BattleStateEnum.MyRound, new MyRoundState());

        CurBattleState = BattleStateDictionary[BattleStateEnum.None];
        CurBattleState.EnterState();

        BattleStart += SetCurCampCanAttack;
        BattleFinishAttackOneLand += OnFinshAttackOneLand;
    }
Beispiel #3
0
    /// <summary>
    /// 生成对战地图,应该只调用一次
    /// </summary>
    /// <param name="mapSize"></param>
    /// <param name="campCount"></param>
    public void GenerateMapInScene(int mapHeight, int campCount)
    {
        SetMapInfo(mapHeight, campCount);
        SetCamps();

        GameObject battleMap   = Resources.Load("Prefabs/GameMap") as GameObject;
        GameObject MapInstance = Instantiate(battleMap);

        BattleMap = MapInstance.GetComponent <BattleMap>();


        InitalMap();
        //进入选首都阶段状态
        CurBattleState = BattleStateDictionary[BattleStateEnum.SelectCaptital];
        CurBattleState.EnterStateWithMouse(ref BattleMap.mapEnterAction, ref BattleMap.mapClickAction, ref BattleMap.mapExitAction);
    }
Beispiel #4
0
    private void Awake()
    {
        BattleStateDictionary = new Dictionary <BattleStateEnum, BattleStateBase>();
        BattleStateDictionary.Add(BattleStateEnum.None, new BattleStateBase());
        BattleStateDictionary.Add(BattleStateEnum.SelectCaptital, new SelectCapitalState());
        BattleStateDictionary.Add(BattleStateEnum.MyRound, new MyRoundState());
        BattleStateDictionary.Add(BattleStateEnum.AI, new AIState());

        CurBattleState = BattleStateDictionary[BattleStateEnum.None];
        CurBattleState.EnterStateWithoutMouse();
        //事件注册回调
        BATTLE_EVENT_BattleStart         += SetCurCampCanAttack;
        BATTLE_EVENT_BattleStart         += InitalNumOfRounds;
        BATTLE_EVENT_FinishAttackOneLand += OnFinshAttackOneLand;
        BATTLE_EVENT_MyTurnStart         += SetCurCampCanAttack;
        BATTLE_EVENT_MyTurnStart         += MyTurnStartAction;
    }
Beispiel #5
0
    /// <summary>
    /// 回合结束
    /// </summary>
    public IEnumerator  BattleTurnEnd()
    {
        OnTurnEnd();

        float time = CurCamp.ownedLands[0].BattleBaseUnitSupplyTip.GetAnimationTime();

        yield return(new WaitForSeconds(time));

        if (BATTLE_EVENT_EndTurn != null)
        {
            BATTLE_EVENT_EndTurn();
        }
        //****************分界线*********************//
        //下一个回合开始

        //当前回合数+1
        CurNumOfRounds++;

        //修改当前阵营为下一阵营
        curCampIndex = (curCampIndex + 1) % CampDic.Count;
        campIDs      = new List <int>(CampDic.Keys);
        CurCamp      = CampDic[campIDs[curCampIndex]];


        //目前模拟本地人人对战
        //把if括号加上就是人机回合
        if (CurCamp == MyCamp)
        {
            CurBattleState = BattleStateDictionary[BattleStateEnum.MyRound];
            CurBattleState.EnterStateWithMouse(ref BattleMap.mapEnterAction, ref BattleMap.mapClickAction, ref BattleMap.mapExitAction);
        }
        else
        {
            //转到下一回合
            CurBattleState = BattleStateDictionary[BattleStateEnum.AI];
            CurBattleState.EnterState();
        }
    }
Beispiel #6
0
 private void Update()
 {
     CurBattleState.OnUpdateFunc();
 }