public void OnGUI() { if (status == CombatStatus.Pending) { return; } string label = status == CombatStatus.Victory ? "Victory!" : "Defeat."; int x = Screen.width / 2 - statusWidth / 2; int y = Screen.height / 2 - statusHeight / 2; GUI.Label(new Rect(x, y, statusWidth, statusHeight), label); if (GUI.Button(new Rect(Screen.width - 200, Screen.height - 50, 200, 50), "Continue")) { ExperienceManager.ModifyExperience(status == CombatStatus.Victory ? victoryExp : defeatExp); if (status == CombatStatus.Victory) { GameObject player = GameObject.FindGameObjectWithTag("ShipBlueprint"); player.GetComponent<PlayerDamage>().ExitCombat(); } status = CombatStatus.Pending; Application.LoadLevel("Star Map"); } }
public void handleDeath() { if (player) { SceneManager.LoadScene("GameOver"); } else if (this is Carriage && id == 1) { SceneManager.LoadScene("GameOver"); } if (this is Wolf && ((Wolf)this).isBoss) { ((Wolf)this).GetDialogController().trueEndGameDialog(); GameObject.Find("VictorySound").GetComponent <AudioSource>().enabled = true; AudioSource[] audios = ((Wolf)this).GetComponents <AudioSource>(); foreach (AudioSource audio in audios) { audio.enabled = false; } } startCountingTime = false; lastTotalCombatTime += combatTotalTime; combatTotalTime = 0; //finishCombat(); combatStatus = CombatStatus.COMBAT_STATUS_CORPSE; setCurrentAnimation("dead"); foreach (Unit unit in unitsInCombatWith) { unit.exitCombatWith(this); } // Desactivamos el icono de target if (gameObject.transform.Find("TargetIndicator")) { gameObject.transform.Find("TargetIndicator").gameObject.SetActive(false); } // Updateamos la matriz de la AI if (this is Carriage) { return; } string enemytype = ""; if (this is Wolf) { enemytype = "wolf"; } else if (this is Bandit) { enemytype = "agressiveBandit"; } PrincessController.updateQMatrix(attackDamage, attackDamage, attackDamage, combatAttackDelay + combatAttackWindow, 0.85f, lastTotalCombatTime, damageDoneToPlayer, damageDoneToCarriage, damageRecevied, enemytype); }
public void Clear() { DestroyAllEntities(); //刷新一次view UpdateView(0, 0, false); _combatStatus = CombatStatus.None; }
public virtual CombatStatus Combat(Combatant combatant) { this.Energy -= combatant.Force; combatant.Energy -= this.Force; CombatStatus status = CombatStatus.OnlyColide; if (this.Energy <= 0) { status |= CombatStatus.MeDie; this.intLifes--; if (!this.IsDead) { this.Energy = this.MaxEnergy; } } if (combatant.Energy <= 0) { status |= CombatStatus.CombatantDie; combatant.Lifes = combatant.Lifes - 1; if (!combatant.IsDead) { combatant.Energy = combatant.MaxEnergy; } } return(status); }
public void OnGUI() { if (status == CombatStatus.Pending) { return; } string label = status == CombatStatus.Victory ? "Victory!" : "Defeat."; int x = Screen.width / 2 - statusWidth / 2; int y = Screen.height / 2 - statusHeight / 2; GUI.Label(new Rect(x, y, statusWidth, statusHeight), label); if (GUI.Button(new Rect(Screen.width - 200, Screen.height - 50, 200, 50), "Continue")) { ExperienceManager.ModifyExperience(status == CombatStatus.Victory ? victoryExp : defeatExp); if (status == CombatStatus.Victory) { GameObject player = GameObject.FindGameObjectWithTag("ShipBlueprint"); player.GetComponent <PlayerDamage>().ExitCombat(); } status = CombatStatus.Pending; Application.LoadLevel("Star Map"); } }
public override bool TakeAction() { if (!string.IsNullOrEmpty(ContextUser.MercenariesID)) { Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); GuildBossCombat bossCombat = new GuildBossCombat(ContextUser.MercenariesID); UserGuild guild = bossCombat.UserGuild; if (guild != null) { GameActive gameActive = new ShareCacheStruct <GameActive>().FindKey(_activeId); CombatStatus combatStatus = guild.CombatStatus; if (combatStatus == CombatStatus.Wait || combatStatus == CombatStatus.Combat) { int total; var tempList = bossCombat.RefreshRanking(); _bossUserList = tempList.GetPaging(1, Top, out total); _rankingNo = tempList.FindIndex(m => m.UserId == Uid) + 1; } } stopwatch.Stop(); new BaseLog().SaveLog("公会boss伤害排名所需时间:" + stopwatch.Elapsed.TotalMilliseconds + "ms"); } return(true); }
public override bool TakeAction() { if (_isCurr == 0) { var bossFirst = ServerEnvSet.Get(ServerEnvKey.FirstHalfBoss, 0); if (!string.IsNullOrEmpty(bossFirst)) { int total; var tempList = JsonUtils.Deserialize <List <BossUser> >(bossFirst); if (tempList != null && tempList.Count > 0) { _bossUserList = tempList.GetPaging(1, Top, out total); _rankingNo = tempList.FindIndex(m => m.UserId == Uid) + 1; var killUserId = ServerEnvSet.GetInt(ServerEnvKey.KillBossUserID, 0); var killUser = tempList.Find(t => t.UserId == killUserId.ToString()); if (killUser != null) { _damageNum = killUser.DamageNum; _nickName = killUser.NickName; var userEntity = new PersonalCacheStruct <GameUser>().FindKey(killUserId.ToString()); if (userEntity != null) { _userLv = userEntity.UserLv; } } } } } else if (_isCurr == 1) { BossCombat bossCombat = new BossCombat(_activeId); GameActive gameActive = bossCombat.GameActive; if (gameActive == null) { return(true); } CombatStatus combatStatus = gameActive.CombatStatus; if (combatStatus == CombatStatus.Wait || combatStatus == CombatStatus.Combat) { int total; var tempList = bossCombat.RefreshRanking(); _bossUserList = tempList.GetPaging(1, Top, out total); _rankingNo = tempList.FindIndex(m => m.UserId == Uid) + 1; var killUserId = ServerEnvSet.GetInt(ServerEnvKey.KillBossUserID, 0); var killUser = tempList.Find(t => t.UserId == killUserId.ToString()); if (killUser != null) { _damageNum = killUser.DamageNum; _nickName = killUser.NickName; var userEntity = new PersonalCacheStruct <GameUser>().FindKey(killUserId.ToString()); if (userEntity != null) { _userLv = userEntity.UserLv; } } } } return(true); }
public void GoAttack(GameObject target) { if (_currEnemyAlertStatus != EnemyAlertStatus.Ignore) { TargetedEnemy = target; _currCombatStatus = CombatStatus.Chasing; } }
private CombatStatusChangedEventArgs OnCombatStatusChanged(CombatStatus combatStatus) { CombatStatusChangedEventArgs args = new CombatStatusChangedEventArgs(combatStatus); OnCombatStatusChanged(args); return(args); }
public void updateAttackStatus(int framesOffset) { switch (combatStatus) { case CombatStatus.COMBAT_STATUS_ATTACKING: ////Debug.Log(gameObject.name + ": En ventana de ataque!"); setCurrentAnimation("attack"); //combatAttackWindow -= framesOffset; combatAttackWindow -= Time.deltaTime; ////Debug.Log("El combatAttackWindows es " + combatAttackWindow); if (combatAttackWindow <= 0) { attackUnit(target); resetCombatAttackDelay(); resetAttackWindow(); combatStatus = CombatStatus.COMBAT_STATUS_WAITING_FOR_ATTACK; } break; case CombatStatus.COMBAT_STATUS_WAITING_FOR_ATTACK: setCurrentAnimation("idle"); reduceCombatAttackDelayBy(framesOffset); ////Debug.Log(gameObject.name + ": Mi timer se reduce en " + framesOffset + ", me quedan " + combatAttackDelay + " para poder volver a atacar"); // Si es menor o igual que 0, nuestro ataque está listo. Reseteamos el timer if (combatAttackDelay <= 0) { combatStatus = CombatStatus.COMBAT_STATUS_ATTACK_READY; //Debug.Log(gameObject.name + ": Mi siguiente ataque está listo!"); } break; case CombatStatus.COMBAT_STATUS_ATTACK_READY: break; case CombatStatus.COMBAT_STATUS_STUNNED: setCurrentAnimation("damage"); stunnedTime -= Time.deltaTime; if (stunnedTime < 0) { setCombatStatus(CombatStatus.COMBAT_STATUS_WAITING_FOR_ATTACK); } break; default: break; } }
public void hardcoreFinishCombat() { target = null; unitsInAttackRange = new ArrayList(); unitsInCombatWith = new ArrayList(); inCombat = false; combatStatus = CombatStatus.COMBAT_STATUS_IDLE; //Debug.Log(name + ": Abandonando combate por fuerza bruta"); }
public void handleDeath() { combatStatus = CombatStatus.COMBAT_STATUS_CORPSE; setCurrentAnimation("dead"); // Desactivamos el icono de target if (gameObject.transform.Find("TargetIndicator")) { gameObject.transform.Find("TargetIndicator").gameObject.SetActive(false); } }
private void HandleCombatStatus() { switch (_currCombatStatus) { case CombatStatus.OutOfCombat: break; case CombatStatus.Chasing: // if enemy is in range, start attacking if (TargetedEnemy) { if ((TargetedEnemy.transform.position - transform.position).sqrMagnitude < ((_enemyAttackRange / 2) * (_enemyAttackRange / 2))) { _currCombatStatus = CombatStatus.Attacking; _currAttackChargeTime = 0.0f; _currCooldownTime = 0.0f; } } break; case CombatStatus.Attacking: _currAttackChargeTime += Time.deltaTime; if (_currAttackChargeTime >= _maxAttackChargeTime) { _currAttackChargeTime = 0.0f; // try to deal damage if (!TargetedEnemy) { _currCombatStatus = CombatStatus.OutOfCombat; break; } if ((TargetedEnemy.transform.position - transform.position).sqrMagnitude < (_enemyAttackRange * _enemyAttackRange)) { TargetedEnemy.GetComponent <Health>().DealDamage(_damage, gameObject); } _currCombatStatus = CombatStatus.Cooldown; } break; case CombatStatus.Cooldown: _currCooldownTime += Time.deltaTime; if (_currCooldownTime >= _maxCooldownTime) { _currCooldownTime = 0.0f; _currCombatStatus = CombatStatus.Chasing; } break; } }
public override bool TakeAction() { if (!string.IsNullOrEmpty(ContextUser.MercenariesID)) { GuildBossCombat bossCombat = new GuildBossCombat(ContextUser.MercenariesID); UserGuild guild = bossCombat.UserGuild; if (guild != null) { CombatStatus combatStatus = guild.CombatStatus; if (combatStatus == CombatStatus.Killed || CombatHelper.GuildBossKill(ContextUser.MercenariesID)) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St5405_BossKilled; return(false); } else if (combatStatus == CombatStatus.Wait) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St5405_CombatWait; return(false); } else if (combatStatus == CombatStatus.Over) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St5405_CombatOver; return(false); } else if (combatStatus == CombatStatus.Combat) { var cuser = bossCombat.GetCombatUser(Uid); if (cuser != null && cuser.CodeTime > 0) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St5402_IsReliveError; return(false); } Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); IsWin = bossCombat.Combat(ContextUser, bossProcess); stopwatch.Stop(); new BaseLog().SaveLog("公会boss战斗所需时间:" + stopwatch.Elapsed.TotalMilliseconds + "ms"); } else { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St5402_CombatNoStart; return(false); } } } return(true); }
public void attackUnit(Unit victim) { Debug.Log(gameObject.name + " Ataca a " + victim.gameObject.name); // Si no se está defencdiendo, le dañamos if (victim.getCombatStatus() != Unit.CombatStatus.COMBAT_STATUS_DEFENDING) { dealDamageToUnit(victim); } resetCombatAttackDelay(); resetAttackWindow(); combatStatus = CombatStatus.COMBAT_STATUS_WAITING_FOR_ATTACK; }
public LogSearchEventsParser(LogSearchParameters logSearchParameters, IWurmApi wurmApi, ILogger logger) { if (logSearchParameters == null) { throw new ArgumentNullException("logSearchParameters"); } if (wurmApi == null) { throw new ArgumentNullException("wurmApi"); } this.logSearchParameters = logSearchParameters; this.wurmApi = wurmApi; CombatStatus = new CombatStatus(logSearchParameters.CharacterName); processor = new CombatResultsProcessor(CombatStatus, logger, wurmApi); }
void Start() { this.returnBuffer = new List <Fighter>(); this.fighters = GameObject.FindObjectsOfType <Fighter>(); this.SortFightersBySpeed(); this.MakeTeams(); LogPanel.Write("Battle initiated."); this.combatStatus = CombatStatus.NEXT_TURN; this.fighterIndex = -1; this.isCombatActive = true; StartCoroutine(this.CombatLoop()); }
public CombatResultsProcessor(CombatStatus combatStatus, ILogger logger, IWurmApi wurmApi) { if (combatStatus == null) { throw new ArgumentNullException("combatStatus"); } if (logger == null) { throw new ArgumentNullException("logger"); } this.combatStatus = combatStatus; this.logger = logger; damageEntryParser = new DamageEntryParser(logger); skillEntryParser = new SkillEntryParser(wurmApi); SetupRules(); }
public override bool TakeAction() { if (CombatHelper.IsBossKill(_activeId)) { this.ErrorCode = 1; this.ErrorInfo = LanguageManager.GetLang().St5405_BossKilled; return(false); } BossCombat bossCombat = new BossCombat(_activeId); _gameActive = bossCombat.GameActive; CombatStatus combatStatus = _gameActive.RefreshStatus(); if (combatStatus == CombatStatus.Wait || combatStatus == CombatStatus.Combat) { bossCombat.Append(ContextUser); BossUser bossUser = bossCombat.GetCombatUser(Uid); if (bossUser != null) { _inspirePercent = bossUser.InspirePercent; _reliveInspirePercent = bossUser.ReliveInspirePercent; _reLiveNum = bossUser.ReliveNum; _combatNum = bossUser.CombatNum; _damageNum = bossUser.DamageNum; _codeTime = bossUser.CodeTime; } } List <BossUser> userList = bossCombat.GetCombatUser(); _regNum = userList.Count; int recordCount = 0; _bossUserList = userList.GetPaging(_pageIndex, _pageSize, out recordCount); CombatGeneral boss = bossCombat.Boss; if (boss != null) { _bossLiftNum = boss.LifeNum; _bossMaxLift = boss.LifeMaxNum; } return(true); }
public LiveLogsEventsMonitor(string characterName, IWurmApi wurmApi, ILogger logger) { if (characterName == null) { throw new ArgumentNullException("characterName"); } if (wurmApi == null) { throw new ArgumentNullException("wurmApi"); } if (logger == null) { throw new ArgumentNullException("logger"); } this.characterName = characterName; this.wurmApi = wurmApi; this.logger = logger; CombatStatus = new CombatStatus(characterName); processor = new CombatResultsProcessor(CombatStatus, logger, wurmApi); wurmApi.LogsMonitor.Subscribe(characterName, LogType.AllLogs, LogHandler); }
public void Victory() { status = CombatStatus.Victory; }
/// <summary> /// 刷新活动 /// </summary> private static void RefreshActive(object sender) { try { Trace.WriteLine("刷新活动被执行"); foreach (var gameActive in _gameActiveList) { string[] list = gameActive.EnablePeriod.Split(new char[] { ',' }); //有多个时间段 foreach (string item in list) { gameActive.BeginTime = item.ToDateTime(DateTime.MinValue); gameActive.EndTime = gameActive.BeginTime.AddMinutes(gameActive.Minutes); if (gameActive.BossPrize == null && gameActive.ActiveType == FunctionEnum.Booszhang) { gameActive.BossPrize = JsonUtils.Deserialize <BossActivePrize>(gameActive.ActivePize); } DateTime currTime = DateTime.Now; if (gameActive.CombatStatus != CombatStatus.Killed && gameActive.WaitMinutes > 0 && currTime >= gameActive.BeginTime && currTime <= gameActive.BeginTime.AddMinutes(gameActive.WaitMinutes)) { LoadData(gameActive); gameActive.CombatStatus = CombatStatus.Wait; } else if (gameActive.CombatStatus != CombatStatus.Killed && currTime >= gameActive.BeginTime && currTime <= gameActive.EndTime) { LoadData(gameActive); gameActive.CombatStatus = CombatStatus.Combat; } else if (currTime < gameActive.BeginTime) { gameActive.CombatStatus = CombatStatus.NoStart; } else if (currTime > gameActive.EndTime) { gameActive.CombatStatus = CombatStatus.Over; } CombatStatus combatStatus = gameActive.RefreshStatus(); if (combatStatus == CombatStatus.Wait) { //有等待时间 int minute = gameActive.WaitMinutes; if (combatStatus != CombatStatus.Killed && currTime >= gameActive.BeginTime.AddMinutes(minute) && currTime <= gameActive.EndTime) { ServerEnvSet.Set(ServerEnvKey.KillBossUserID, 0); gameActive.CombatStatus = CombatStatus.Combat; } break; } else if (combatStatus == CombatStatus.Combat) { break; } else if (combatStatus == CombatStatus.Over) { DisposeData(gameActive); } } } } catch (Exception ex) { new BaseLog().SaveLog(ex); } }
public CombatStatus Update(SpaceShip user, GenericStage stage, double timeElapsed) { SpaceShip enemy = this; this.Update(timeElapsed); if (this.Position.X >= 800) { this.Velocity.X = -this.Velocity.X; this.Position.Y += 34; } else if (this.Position.X <= 0) { this.Velocity.X = -this.Velocity.X; this.Position.Y += 34; } if (this.Position.Y >= (stage.Position.Y + 600)) { this.Velocity.Y = -this.Velocity.Y; this.BulletSettings.InitialVelocity.Y = -this.BulletSettings.InitialVelocity.Y; } else if (this.Position.Y >= (stage.Position.Y + 600)) { this.Velocity.Y = -this.Velocity.Y; this.BulletSettings.InitialVelocity.Y = -this.BulletSettings.InitialVelocity.Y; } if (this.Position.Y >= (stage.Position.Y + 800)) { this.Velocity.Y = -this.Velocity.Y; this.BulletSettings.InitialVelocity.Y = -this.BulletSettings.InitialVelocity.Y; return(CombatStatus.MeDie); } if (this.Position.Y <= stage.Position.Y) { this.Velocity.Y = -this.Velocity.Y; this.BulletSettings.InitialVelocity.Y = -this.BulletSettings.InitialVelocity.Y; } if (this.Position.Y > stage.Position.Y && this.Position.Y < (stage.Position.Y + 630)) { if (TimeAcummulator.IsOverflow) { this.BulletSettings.InitialVelocity = user.Position - this.Position; //this.BulletSettings.InitialVelocity = this.BulletSettings.InitialVelocity.GetNormal() * this.BulletSettings.NominalVelocity; this.BulletSettings.InitialVelocity = this.BulletSettings.InitialVelocity.GetMultNormal(this.BulletSettings.NominalVelocity); Vector2D posB; posB.X = this.Position.X + this.AddPosBullet; posB.Y = this.Position.Y; this.BulletSettings.AddBullets(stage.EnemiesBullets, posB, stage, false); } } if (this.HasItem) { this.Item.Position = this.Position; } CombatStatus statusUser = user.VerifyCombat(this); if (statusUser != CombatStatus.None) { stage.Explosions.Add(new Explosion(user.Position, ExplosionType.Two)); } return(statusUser); }
public override bool TakeAction() { if (!VipHelper.GetVipOpenFun(ContextUser.VipLv, ExpandType.BossChongSheng)) { this.ErrorCode = LanguageManager.GetLang().ErrorCode; this.ErrorInfo = LanguageManager.GetLang().St_VipNotEnoughNotFuntion; return(false); } if (CombatHelper.IsBossKill(_activeId)) { this.ErrorCode = LanguageManager.GetLang().ErrorCode; this.ErrorInfo = LanguageManager.GetLang().St5405_BossKilled; return(false); } BossCombat bossCombat = new BossCombat(_activeId); GameActive gameActive = bossCombat.GameActive; CombatStatus combatStatus = gameActive.CombatStatus; if (combatStatus != CombatStatus.Wait && combatStatus != CombatStatus.Combat) { this.ErrorCode = LanguageManager.GetLang().ErrorCode; this.ErrorInfo = LanguageManager.GetLang().St5402_CombatNoStart; return(false); } this.ErrorCode = Ops; BossUser bossUser = bossCombat.GetCombatUser(Uid); if (bossUser != null && !bossUser.IsRelive) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St5403_IsLive; return(false); } if (bossUser != null && bossUser.ReliveNum >= MaxNum) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St5403_IsReLiveMaxNum; return(false); } int goldNum = GoldNum * (bossUser.ReliveNum + 1); if (Ops == 1) { ErrorInfo = string.Format(LanguageManager.GetLang().St5403_CombatGoldTip, goldNum); } else if (Ops == 2) { if (ContextUser.GoldNum < goldNum) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St_GoldNotEnough; return(false); } if (bossUser != null && bossUser.IsRelive) { ContextUser.UseGold = MathUtils.Addition(ContextUser.UseGold, goldNum, int.MaxValue); //ContextUser.Update(); bossUser.IsRelive = false; bossUser.ReliveBeginDate = DateTime.MinValue; bossUser.ReliveInspirePercent = MathUtils.Addition(bossUser.ReliveInspirePercent, CountryCombat.InspireIncrease, 1); _reliveInspirePercent = bossUser.ReliveInspirePercent; bossUser.ReliveNum++; } } return(true); }
public override bool TakeAction() { if (!string.IsNullOrEmpty(ContextUser.MercenariesID) && ContextUser.MercenariesID == guildID) { if (CombatHelper.GuildBossKill(ContextUser.MercenariesID)) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St5405_BossKilled; return(false); } Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); GameActive gameActive = new ShareCacheStruct <GameActive>().FindKey(_activeId); if (gameActive != null) { bossPlotID = gameActive.BossPlotID; GuildBossCombat bossCombat = new GuildBossCombat(guildID); if (bossCombat.HasCombat) { _guild = bossCombat.UserGuild; if (_guild != null && _guild.GuildBossInfo != null) { if (_guild.GuildBossInfo.EnableWeek > 0 && _guild.GuildBossInfo.BossLv > 0) { _guild.BeginTime = UserHelper.GuildBossDate(_guild.GuildBossInfo); _guild.EndTime = _guild.BeginTime.AddMinutes(gameActive.Minutes); CombatStatus combatStatus = _guild.GuildBossRefreshStatus(); if (UserHelper.IsCurrentWeek(_guild.BeginTime) && UserHelper.IsCurrentWeek(_guild.GuildBossInfo.RefreshDate)) { if (DateTime.Now < _guild.BeginTime) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St6101_GuildBossNotOpen; return(false); } else if ((combatStatus == CombatStatus.Killed && DateTime.Now < _guild.EndTime) || DateTime.Now > _guild.EndTime) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St6101_GuildBossOver; return(true); } } else { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St6101_GuildBossSet; return(false); } if (combatStatus == CombatStatus.Wait || combatStatus == CombatStatus.Combat) { bossCombat.Append(ContextUser); BossUser bossUser = bossCombat.GetCombatUser(ContextUser.UserID); if (bossUser != null) { _inspirePercent = bossUser.InspirePercent; _reliveInspirePercent = bossUser.ReliveInspirePercent; _reLiveNum = bossUser.ReliveNum; } } List <BossUser> userList = bossCombat.GetCombatUser(); _regNum = userList.Count; int recordCount = 0; _bossUserList = userList.GetPaging(_pageIndex, _pageSize, out recordCount); } } } else { UserGuild guild = new ShareCacheStruct <UserGuild>().FindKey(ContextUser.MercenariesID); if (guild != null && guild.GuildBossInfo != null) { if (guild.GuildBossInfo.EnableWeek > 0 && guild.GuildBossInfo.BossLv > 0) { guild.BeginTime = UserHelper.GuildBossDate(guild.GuildBossInfo); guild.EndTime = guild.BeginTime.AddMinutes(gameActive.Minutes); if (UserHelper.IsCurrentWeek(guild.BeginTime) && UserHelper.IsCurrentWeek(guild.GuildBossInfo.RefreshDate)) { if (DateTime.Now < guild.BeginTime.AddMinutes(1)) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St6101_GuildBossNotOpen; return(false); } else { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St6101_GuildBossOver; return(true); } } else { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St6101_GuildBossSet; return(false); } } } else { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St6101_GuildBossSet; return(false); } } } stopwatch.Stop(); new BaseLog().SaveLog("公会boss6101所需时间:" + stopwatch.Elapsed.TotalMilliseconds + "ms"); } return(true); }
public CombatStatusChangedEventArgs(CombatStatus combatStatus) { CombatStatus = combatStatus; }
public override void Update(double elapsedTime) { if (this.IsPaused) { return; } if (this.Position.Y <= 0) { this.State = StageState.Stop; } if (!this.IsStopedMove) { this.UpdateY(elapsedTime); } if (this.v2dNextUserPosition.Y >= this.Position.Y && this.v2dNextUserPosition.Y <= (this.Position.Y + 500)) { ssUser.Position.Y = this.v2dNextUserPosition.Y; } else { ssUser.Position.Y += this.Velocity.Y * elapsedTime; } if (this.v2dNextUserPosition.X >= this.Position.X && this.v2dNextUserPosition.X <= (this.Position.X + 800)) { ssUser.Position.X = this.v2dNextUserPosition.X; } #region createBullet ssUser.TimeAcummulator.Update(elapsedTime); if (createBullet) { if (ssUser.TimeAcummulator.IsOverflow) { Vector2D posB; posB.X = ssUser.Position.X + ssUser.AddPosBullet; posB.Y = ssUser.Position.Y; ssUser.BulletSettings.AddBullets(lstUserBullets, posB, this, true); createBullet = false; } } #endregion #region enemy.Update for (int ie = 0; ie < lstEnemies.Count; ie++) { EnemySpaceShip enemy = lstEnemies[ie]; switch (enemy.Update(ssUser, this, elapsedTime)) { case CombatStatus.MeDie: case CombatStatus.BothDie: lstEnemies.RemoveAt(ie); ie--; if (enemy.HasItem) { this.Items.Add(enemy.Item); } enemy.Dispose(); break; } } #endregion #region lstUserBullets for (int i = 0; i < lstUserBullets.Count; ++i) { Bullet bullet = lstUserBullets[i]; bullet.Update(elapsedTime); if (bullet.Position.Y <= this.Position.Y) { lstUserBullets.RemoveAt(i); bullet.Dispose(); --i; continue; } for (int j = 0; j < lstEnemies.Count; ++j) { EnemySpaceShip enemy = lstEnemies[j]; CombatStatus cs = bullet.VerifyCombat(enemy); bool breakFor = false; switch (cs) { case CombatStatus.BothDie: #region CombatStatus.BothDie this.lstExplosions.Add(new Explosion(bullet.Position, ExplosionType.One)); lstUserBullets.RemoveAt(i); bullet.Dispose(); --i; lstEnemies.RemoveAt(j); --j; if (enemy.HasItem) { lstItem.Add(enemy.Item); } enemy.Dispose(); breakFor = true; break; #endregion case CombatStatus.MeDie: #region CombatStatus.MeDie this.lstExplosions.Add(new Explosion(bullet.Position, ExplosionType.One)); lstUserBullets.RemoveAt(i); bullet.Dispose(); --i; breakFor = true; break; #endregion case CombatStatus.CombatantDie: #region CombatStatus.CombatantDie this.lstExplosions.Add(new Explosion(bullet.Position, ExplosionType.One)); lstEnemies.RemoveAt(j); --j; if (enemy.HasItem) { lstItem.Add(enemy.Item); } enemy.Dispose(); break; #endregion } if (breakFor) { break; } } } #endregion #region lstEnemiesBullets for (int i = 0; i < lstEnemiesBullets.Count; ++i) { Bullet enBullet = lstEnemiesBullets[i]; enBullet.Update(elapsedTime); if (enBullet.Position.Y >= (this.Position.Y + 816)) { lstEnemiesBullets.RemoveAt(i); enBullet.Dispose(); --i; continue; } if (enBullet.VerifyCombat(ssUser) != CombatStatus.None) { this.lstExplosions.Add(new Explosion(enBullet.Position, ExplosionType.Two)); lstEnemiesBullets.RemoveAt(i); enBullet.Dispose(); --i; break; } } #endregion #region lstExplosions for (int i = 0; i < lstExplosions.Count; ++i) { Explosion exp = lstExplosions[i]; exp.Update(elapsedTime); if (exp.Destroy()) { lstExplosions.RemoveAt(i); exp.Dispose(); --i; } } #endregion #region lstItem for (int i = 0; i < lstItem.Count; ++i) { Item ib = lstItem[i]; if (ib.Update(elapsedTime, ssUser)) { lstItem.RemoveAt(i); ib.Dispose(); --i; } } #endregion }
public void ChangeCombatStatus(CombatStatus combatStatus) { OnCombatStatusChanged(new CombatStatusChangedEventArgs(combatStatus)); }
private void HandleEnemyStrategy() { switch (_currEnemyAlertStatus) { case EnemyAlertStatus.Aggressive: if (!TargetedEnemy) { GameObject closestEnemy = EnemyBehaviour.GetClosestEnemy(transform.position); if (closestEnemy) { if ((closestEnemy.transform.position - transform.position).sqrMagnitude < (_enemyDetectRange * _enemyDetectRange)) { TargetedEnemy = closestEnemy; _currCombatStatus = CombatStatus.Chasing; } } } if (TargetedEnemy) { if ((TargetedEnemy.transform.position - transform.position).sqrMagnitude > (30.0f * 30.0f)) { TargetedEnemy = null; _currCombatStatus = CombatStatus.OutOfCombat; } else { SetTarget(TargetedEnemy.transform); } } else if (Target) { SetTarget(Target.transform); } break; case EnemyAlertStatus.Defensive: if (TargetedEnemy) { if ((TargetedEnemy.transform.position - transform.position).sqrMagnitude > (30.0f * 30.0f)) { TargetedEnemy = null; _currCombatStatus = CombatStatus.OutOfCombat; } else { _attachedNavMeshAgent.isStopped = false; SetTarget(TargetedEnemy.transform); } } break; case EnemyAlertStatus.Ignore: // literally nothing break; case EnemyAlertStatus.Guard: _accuPatrolSeconds += Time.deltaTime; if (_accuPatrolSeconds >= _maxPatrolSeconds) { _accuPatrolSeconds -= _maxPatrolSeconds; NPCsGuild.AddInfluenceFor(_villToDefend.gameObject, 1); } if (!TargetedEnemy) { // Handle patrolling float acceptableDistance = 5.0f; GameObject currPatrolPoint = _villToDefend.GetComponent <PatrolRoute>().RoutePoints[_currPatrolPointIdx]; if ((currPatrolPoint.transform.position - transform.position).sqrMagnitude < acceptableDistance) { _currPatrolPointIdx = (_currPatrolPointIdx + 1) % _villToDefend.GetComponent <PatrolRoute>().RoutePoints.Count; } Target = _villToDefend.GetComponent <PatrolRoute>().RoutePoints[_currPatrolPointIdx]; // Search for an enemy GameObject closestEnemy = EnemyBehaviour.GetClosestEnemy(transform.position); if (closestEnemy) { if ((closestEnemy.transform.position - transform.position).sqrMagnitude < (_enemyDetectRange * _enemyDetectRange)) { TargetedEnemy = closestEnemy; _currCombatStatus = CombatStatus.Chasing; } } } if (!TargetedEnemy) { _attachedNavMeshAgent.SetDestination(Target.transform.position); } else { _attachedNavMeshAgent.SetDestination(TargetedEnemy.transform.position); } break; } }
public void Defeat() { status = CombatStatus.Defeat; }
public override bool TakeAction() { if (!string.IsNullOrEmpty(ContextUser.MercenariesID)) { if (CombatHelper.GuildBossKill(ContextUser.MercenariesID)) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St5405_BossKilled; return(false); } GuildBossCombat bossCombat = new GuildBossCombat(ContextUser.MercenariesID); UserGuild guild = bossCombat.UserGuild; if (guild != null) { CombatStatus combatStatus = guild.CombatStatus; if (combatStatus != CombatStatus.Wait && combatStatus != CombatStatus.Combat) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St5402_CombatNoStart; return(false); } ErrorCode = ops; if (ops == 1) { ErrorInfo = string.Format(LanguageManager.GetLang().St5202_InspireTip, ExpNum); } else if (ops == 2) { if (ContextUser.ExpNum < ExpNum) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St_ExpNumNotEnough; return(false); } if (!bossCombat.Inspire(Uid, false, out inspirePercent)) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St_InspireFailed; } if (ContextUser.ExpNum >= ExpNum) { ContextUser.ExpNum = MathUtils.Subtraction(ContextUser.ExpNum, ExpNum, 0); //ContextUser.Update(); } } else if (ops == 3) { ErrorInfo = string.Format(LanguageManager.GetLang().St5202_InspireGoldTip, GlodNum); } else if (ops == 4) { if (ContextUser.GoldNum < GlodNum) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St_GoldNotEnough; return(false); } if (!bossCombat.Inspire(Uid, true, out inspirePercent)) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St_InspireFailed; } if (ContextUser.GoldNum >= GlodNum) { ContextUser.UseGold = MathUtils.Addition(ContextUser.UseGold, GlodNum, int.MaxValue); //ContextUser.Update(); } } } } return(true); }
void Awake() { status = GetComponent<CombatStatus>(); controller = GetComponent<PlayerController>(); Weapon = new PlasmaWeapon(BulletPrefab); BombCount = 1; }