private void Start() { if (ld == null) { ld = GetComponent <LittleDude>(); } if (!battleInfo) { battleInfo = BattleInfo.instance.battleInfo.GetComponent <BattleInfo>(); } if (ld.isBlue) { enemyFlag = battleInfo.redFlag; } else { enemyFlag = battleInfo.blueFlag; } if (ld.navTarget != enemyFlag.transform.position) { ld.SetDestination(enemyFlag.transform.position); } }
public void SetData(BattleInfo battle) { switch (battle.BattleState) { case BattleState.Day: case BattleState.AirRaid: _day = new Result { Damage = battle.Result, Rank = battle.ResultRank }; _night = null; break; case BattleState.SpNight: _day = null; goto case BattleState.Night; case BattleState.Night: _night = new Result { Damage = battle.Result, Rank = battle.ResultRank }; break; } if (battle.BattleState != BattleState.Night) { SetNonStateData(battle); } }
protected override void Awake() { game = BaseSaver.getGame(); GameObject.Find("HeaderTxt").GetComponent <Text> ().text = game.name; gridCanvas = GetComponentInChildren <Canvas>(); hexMesh = GetComponentInChildren <HexMesh>(); BattleInfo thisBattle = BaseSaver.getBattle(); if (thisBattle != null) { boardHeight = thisBattle.height > 0 ? thisBattle.height : 10; boardWidth = thisBattle.width > 0 ? thisBattle.width : 10; } else { boardHeight = 6; boardWidth = 8; } cells = new HexCell[boardHeight * boardWidth]; for (int z = 0, i = 0; z < boardHeight; z++) { for (int x = 0; x < boardWidth; x++) { CreateCell(x, z, i++); } } }
public Task StartNewBattle(BattleInfo battleInfo) { if (battleInfo == null) { throw new ArgumentNullException(nameof(battleInfo)); } if (string.IsNullOrEmpty(battleInfo.BattleId)) { throw new ArgumentNullException(nameof(battleInfo.BattleId)); } if (string.IsNullOrEmpty(battleInfo.Map)) { throw new ArgumentNullException(nameof(battleInfo.Map)); } try { return(this.battleCollection.InsertOneAsync(battleInfo)); } catch (MongoDuplicateKeyException ex) { throw new BattleAlreadyExistsException($"{nameof(battleInfo.BattleId)} == {battleInfo.BattleId} уже существует", ex); } }
public void BacktoTitle() { Firstspawn.Reset(); BattleInfo.Reset(); Time.timeScale = 1; SceneManager.LoadScene("Title"); }
void Awake() { for (int i = 0; i < all_character.Length; i++) { BattleInfo.SetCharacterInbattle(all_character[i].name, all_character[i].characterObj, all_character[i].Hp, all_character[i].Ag, all_character[i].At); } }
public async Task <ActionResult> StartNewBattle([FromBody] BattleInfo battleInfo) { if (battleInfo == null || string.IsNullOrEmpty(battleInfo.BattleId) || string.IsNullOrEmpty(battleInfo.Map)) { return(this.BadRequest()); } try { await this.battleStorage.StartNewBattle(battleInfo); // TODO: может быть, стоит сделать получение информации о битве по battleId - карты, кол-ва фрейом, участников, // победителей. Тогда сделать тут правильно: return this.Created() return(this.Ok()); } catch (BattleAlreadyExistsException ex) { this.logger.LogWarning(ex, $"Попытка стартовать бой {battleInfo.BattleId} повторно"); return(this.BadRequest(nameof(battleInfo.BattleId))); } catch (Exception ex) { this.logger.LogWarning(ex, $"Ошибка начала боя {battleInfo.BattleId}"); return(this.StatusCode(500)); } }
private void OnNew(GameObject go) { config_map_item config_map_item = new config_map_item(); config_map_item.id = resourceMgr.config_map.data[resourceMgr.config_map.GetDataCount() - 1].id + 1; config_map_item.icon = config_map_item.id; config_map_item.name = "" + (config_map_item.id % 10000); config_map_item.desc = ""; config_map_item.pre_id = (config_map_item.id - 1); config_map_item.task = "10101|20,10102|20,10103|20,10104|20,10105|20"; config_map_item.step = 32; config_map_item.build = 10000; config_map_item.fill = 10000; config_map_item.judge = "1800,3500,5200"; config_map_item.forbid_skill = ""; resourceMgr.config_map.data.Add(config_map_item); BattleInfo battleInfo = new BattleInfo(); battleInfo.mapId = config_map_item.id; battleInfo.FillNew(GridModel.Instance.set_start_x, GridModel.Instance.set_start_y, GridModel.Instance.set_end_x, GridModel.Instance.set_end_y, GridModel.Instance.set_battle_width, GridModel.Instance.set_battle_height); BattleModel.Instance.battles.Add(battleInfo); ToggleList toggleList = togglePart.UpDateList(FightLayerType.map); GameObject toggleItem = toggleList.list.GetItemByName("item_" + config_map_item.id); Toggle toggle = toggleItem.GetComponent <Toggle> (); toggle.isOn = true; }
/// <summary> /// 二次匹配初始化 /// </summary> public static void Init() { CMD_MAP_MATCH_result = -1; role_res = -1; seat_res = 0; seat_binary = 0; gameInfo = new Res_merge(); gameInfo_sitdown = new SitDown(); battleinfo = new BattleInfo(); playerid2 = 0; Round = 1; PreMove = 0; Pid_Tid = new Dictionary <int, int>(); Attacking = 0; Moving = false; GameChooseStatus = -1; GameLoading = 0; GameLoading_Cnt = 0; for (int i = 1; i <= 10; i++) { GameLoading_num[i] = 0; GameChoose_num[i] = 0; } for (int i = 0; i < 20; i++) { Skill_CD[i] = 0; } }
private void DelegateOnGetBattleInfoCallback(Object obj) { ResponseMsg msg = obj as ResponseMsg; if (msg.ErrorCode == RpcErrorCodeEnum.Ok) { GetBattleInfoResponse resp = GetBattleInfoResponse.ParseFrom(msg.ProtoData); BattleInfo battleInfo = resp.BattleInfo; AppValues.CurrentTurnInfo = battleInfo.CurrentTurnInfo; AppValues.CellInfos = new List <int>(battleInfo.BattleCellInfoList); AppValues.BattleUserBriefInfos = new List <UserBriefInfo>(battleInfo.UserBriefInfosList); AppValues.LastEventNum = battleInfo.LastEventNum; RefreshUiForBattleInfo(); // 如果自己没有确认准备开始游戏,需要准备开始 if (battleInfo.NotReadyUserIdsList != null && battleInfo.NotReadyUserIdsList.Contains(AppValues.UserInfoBuilder.UserId)) { // 发出准备好开始对战的请求 ReadyToStartGameRequest.Builder builder = ReadyToStartGameRequest.CreateBuilder(); WebSocketManager.SendMessage(RpcNameEnum.ReadyToStartGame, builder.Build().ToByteArray(), OnReadyToStartGameCallback); } } else { string tips = string.Format("获取战场信息失败,errorCode = {0}", msg.ErrorCode); MessageBox.Show(this, tips, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } }
IEnumerator BattleStartSequence(GameObject enemyFromOverworld, BattleInfo battleInfo) { savedPosition = player.transform.position; horizScript.enabled = false; vertScript.enabled = false; playerRB.velocity = Vector3.zero; playerRB.useGravity = false; battleInitiationImage.Transition(); yield return(new WaitUntil(() => battleInitiationImage.fadedIn)); battleInitiationImage.fadedIn = false; //for next battle Destroy(enemyFromOverworld); platformSpawner.SpawnPlatforms(battleInfo); //The platform spawner will call the enemy spawner. yield return(new WaitUntil(() => enemySpawner.enemySpawnComplete)); enemySpawner.enemySpawnComplete = false; //for next battle MetaControl.controlMode = MetaControl.ControlMode.Standard; player.transform.position = Vector3.zero; playerRB.useGravity = true; yield return(new WaitUntil(() => battleInitiationImage.fadedOut)); battleInitiationImage.fadedOut = false; //for next battle yield return(new WaitForSeconds(1)); TakeHeadCount(this, EventArgs.Empty); TransitionToPlayerTurn(); //todo make enemy turn happen under certain conditions }
public void Start(BattleInfo info) { foreach (var entry in info.Units) { SpawnUnit(entry.Flag, entry.Info, entry.SpawnX, entry.SpawnY); } }
public void InitCrtBattle(config_map_item config) { crtConfig = config; BattleInfo battleInfo = GetBattle(crtConfig.id); if (battleInfo == null) { battleInfo = new BattleInfo(); battleInfo.mapId = crtConfig.id; battles.Add(battleInfo); byte[] battleInfoBytes = GameMgr.resourceMgr.GetTextBytes("dat/map.ab", battleInfo.mapId.ToString()); battleInfo.FillByte(battleInfoBytes); } else { if (battleInfo.clearCaching) { byte[] battleInfoBytes = GameMgr.resourceMgr.GetTextBytes("dat/map.ab", battleInfo.mapId.ToString()); battleInfo.FillByte(battleInfoBytes); } } battleInfo.need_open_fill = true;//todo crtBattle = battleInfo; }
public void StartBattle(BattleInfo info) { _currentInfo = info; CreateEnemies(); CreateHeroes(); InitView(); }
internal protected AerialCombatStage(BattleInfo rpOwner, ApiData rpData) : base(rpOwner) { var rRawData = rpData.Data as IAerialCombatSecondRound; AerialCombatFirstRound = new AerialCombatPhase(this, rRawData.AerialCombat, PhaseRound.First); AerialCombatSecondRound = new AerialCombatPhase(this, rRawData.AerialCombatSecondRound, PhaseRound.Second); }
private void Awake() { instance = this; battleInfo = gameObject; PopulateTeamLists(); }
protected override void checkEnd() { bool playersLeft = checkCells(true); bool enemyLeft = checkCells(false); if (!playersLeft || !enemyLeft) { if (!playersLeft) { Debug.Log("Enemy Wins!"); } else { Debug.Log("Player Wins!"); } BattleInfo battle = BaseSaver.getBattle(); //This means that the player was attacked by the monster if (battle == null) { battle = new BattleInfo(); battle.redirect = "AdventureScene"; } battle.won = playersLeft; BaseSaver.putBattle(battle); SceneManager.LoadScene(battle.redirect); } }
void Start() { if (!battleInfo) { battleInfo = BattleInfo.instance.battleInfo.GetComponent <BattleInfo>(); } }
void OnTriggerEnter2D(Collider2D other) { if (shouldDelete) { return; } if (other.gameObject.CompareTag("Player")) { string sceneName = SceneManager.GetActiveScene().name; BattleInfo battleInfo = new BattleInfo(sceneName); Enemy[] enemiesInGroup = GetComponentsInChildren <Enemy>(); foreach (Enemy enemy in enemiesInGroup) { battleInfo.Add(enemy.getEnemyID(), enemy.unit); } BattleSystem.currentBattle = battleInfo; LoadNewArea loadArea = gameObject.AddComponent <LoadNewArea>(); loadArea.sceneToLoad = "BattleArea"; loadArea.LoadArea(); } }
private void SetNonStateData(BattleInfo battle) { Formation = battle.Formation; FighterPower = battle.FighterPower; EnemyFighterPower = battle.EnemyFighterPower; AirControlLevel = battle.AirControlLevel; SupportType = battle.SupportType; }
public void CmdAttackFlag(bool flag) { print("flag"); BattleInfo temp = info; temp.enemyAttackFlag = flag; info = temp; }
public void OnSceneWasLoaded(object[] arguments) { StageModel stage_model = arguments[0] as StageModel; model_ = stage_model.BattleInfo; BattleData.SetStageModel(stage_model); Debug.Log("OnSceneWasLoaded." + model_.name); }
public static ByteArray ReceiveBattleInfo(BattleInfo info) { ByteArray byteArray = new ByteArray(); byteArray.WriteInt(0x51a0a8fc); info.WriteToByteArray(byteArray); return(byteArray); }
private static bool OnReceiveBattleInfo(ByteArray byteArray, IPokemonBattleClientService clientService) { BattleInfo info = new BattleInfo(); info.ReadFromByteArray(byteArray); clientService.OnReceiveBattleInfo(info); return(true); }
public void CmdFightMessage(string message) { print("fight message"); BattleInfo temp = info; temp.fightMessage = message; info = temp; }
public void Start() { _battleInfo = BattleInfoFactory.CreateBattleInfo(GameData.BattleToLoad); initializeComponents(); CanvasFade.StartFadeOut(null); }
public QuestCounter(QuestInfo questInfo, ItemInventory itemInventory, ShipInventory shipInventory, BattleInfo battleInfo) { _questInfo = questInfo; _quests = questInfo.QuestDictionary; _itemInventory = itemInventory; _shipInventory = shipInventory; _battleInfo = battleInfo; }
internal void Update(BattleInfo info) { _deathCount = info._deathCount; _killCount = info._killCount; _meat = info._meat; _site = info._site; _point = info._point; }
private static bool OnReceiveBattleInfo(int sessionID, ByteArray byteArray, IPokemonBattleServerService serverService) { BattleInfo info = new BattleInfo(); info.ReadFromByteArray(byteArray); serverService.OnReceiveBattleInfo(sessionID, info); return(true); }
public void CmdEnemyMaxTimes(float one, float two, float three) { BattleInfo temp = info; temp.enemy0Max = one; temp.enemy1Max = two; temp.enemy2Max = three; info = temp; }
internal protected DayNormalStage(BattleInfo rpOwner, ApiData rpData) : base(rpOwner) { var rRawData = rpData.Data as RawDay; AerialCombat = new AerialCombatPhase(this, rRawData.AerialCombat); SupportingFire = new SupportingFirePhase(this, rRawData.SupportingFire); OpeningTorpedo = new TorpedoSalvoPhase(this, rRawData.OpeningTorpedoSalvo); ShellingFirstRound = new ShellingPhase(this, rRawData.ShellingFirstRound); ShellingSecondRound = new ShellingPhase(this, rRawData.ShellingSecondRound); ClosingTorpedo = new TorpedoSalvoPhase(this, rRawData.ClosingTorpedoSalvo); }
internal protected CombinedFleetCTFDayNormalStage(BattleInfo rpOwner, ApiData rpData) : base(rpOwner) { var rRawData = rpData.Data as RawCombinedFleetDay; LandBaseAerialSupport = new LandBaseAerialSupportPhase(this, rRawData.LandBaseAerialSupport); AerialCombat = new AerialCombatPhase(this, rRawData.AerialCombat); SupportingFire = new SupportingFirePhase(this, rRawData.SupportingFire); OpeningTorpedo = new TorpedoSalvoPhase(this, rRawData.OpeningTorpedoSalvo, true); ShellingFirstRound = new ShellingPhase(this, rRawData.ShellingFirstRound, true); ClosingTorpedo = new TorpedoSalvoPhase(this, rRawData.ClosingTorpedoSalvo, true); ShellingSecondRound = new ShellingPhase(this, rRawData.ShellingSecondRound); ShellingThirdRound = new ShellingPhase(this, rRawData.ShellingThirdRound); }
internal protected EnemyCombinedFleetDay(BattleInfo rpOwner, ApiInfo rpInfo) : base(rpOwner) { var rRawData = rpInfo.Data as RawEnemyCombinedFleetDay; LandBaseAerialSupport = new LandBaseAerialSupportPhase(this, rRawData.LandBaseAerialSupport); AerialCombat = new AerialCombatPhase(this, rRawData.AerialCombat); SupportingFire = new SupportingFirePhase(this, rRawData.SupportingFire); OpeningASW = new OpeningASWPhase(this, rRawData.OpeningASW, true); OpeningTorpedo = new TorpedoSalvoPhase(this, rRawData.OpeningTorpedoSalvo, true); ShellingFirstRound = new ShellingPhase(this, rRawData.ShellingFirstRound, rpIsEnemyEscortFleet: true); ClosingTorpedo = new TorpedoSalvoPhase(this, rRawData.ClosingTorpedoSalvo, true); ShellingSecondRound = new ShellingPhase(this, rRawData.ShellingSecondRound); ShellingThirdRound = new ShellingPhase(this, rRawData.ShellingThirdRound); }
public void init() { int i; BattleGlobal.Core = this; this._random = new MTRandom(); // test 设置固定随机种子 this.initRandomSeed(); this._playerList = new List<Player>(); for (i=0;i<2;i++) { this._playerList.Add(new Player()); this._playerList[i].init(); } if (this._info == null) { this._info = new BattleInfo(); } this._info.reset(); this._isGameStarted = false; // 初始化战场区域 Chessboard.init(); }
internal protected AerialAttackStage(BattleInfo rpOwner, ApiData rpData) : base(rpOwner) { var rRawData = rpData.Data as IAerialCombat; AerialAttack = new AerialCombatPhase(this, rRawData.AerialCombat, PhaseRound.First); }
internal protected CombinedFleetNightOnlyStage(BattleInfo rpOwner, ApiData rpData) : base(rpOwner) { var rRawData = rpData.Data as RawCombinedFleetNightOnly; Shelling = new ShellingPhase(this, rRawData.Shelling, true); }
internal protected Night(BattleInfo rpOwner) : base(rpOwner) { }
internal protected CombinedFleetNight(BattleInfo rpOwner) : base(rpOwner) { }
internal protected EnemyCombinedFleetNight(BattleInfo rpOwner, ApiInfo rpInfo) : base(rpOwner) { var rRawData = rpInfo.Data as RawEnemyCombinedFleetNight; Shelling = new ShellingPhase(this, rRawData.Shelling) { ParticipantingFleet = rRawData.ParticipatingFleet }; }
internal protected Day(BattleInfo rpOwner) : base(rpOwner) { }
void loadChoosenBattleScene() { #if UNITY_EDITOR if (GlobalController.instance.battleChoosen >= 0) { choosenBattle = GlobalController.instance.dataFile.battlesData.battles[GlobalController.instance.battleChoosen]; } else { Debug.LogWarning("DEVELOPMENT battle choosen"); choosenBattle = GlobalController.instance.dataFile.battlesData.battles[developmentBattle]; } #else choosenBattle = GlobalController.instance.dataFile.battlesData.battles[GlobalController.instance.battleChoosen]; #endif Instantiate(choosenBattle.terrain); mobSpawner = Instantiate(choosenBattle.mobSpawner); mobSpawner.transform.SetParent(transform); }
internal protected NightNormalStage(BattleInfo rpOwner, ApiInfo rpInfo) : base(rpOwner) { var rRawData = rpInfo.Data as RawNight; Shelling = new ShellingPhase(this, rRawData.Shelling); }
internal protected CombinedFleetNightNormalStage(BattleInfo rpOwner, ApiInfo rpInfo) : base(rpOwner) { var rRawData = rpInfo.Data as RawCombinedFleetNight; Shelling = new ShellingPhase(this, rRawData.Shelling, true); }
private void SetInfos( ) { int battleId = int.Parse( HttpContext.Current.Request.QueryString["id"] ); bInfo = Universe.instance.GetBattle( battleId ); sInfo = _ruler.GetBattle( battleId, bInfo.BattleType ); if( bInfo == null || sInfo == null) { Redirect(); } }
internal protected NightOnlyStage(BattleInfo rpOwner, ApiData rpData) : base(rpOwner) { var rRawData = rpData.Data as RawNightOnly; Shelling = new ShellingPhase(this, rRawData.Shelling); }