protected override bool Init() { this._clsNightCombat = BattleTaskManager.GetBattleManager().GetNightCombatData(); this._clsHougekiList = BattleTaskManager.GetBattleManager().GetHougekiList_Night(); if (this._clsHougekiList == null) { this.EndPhase(BattleUtils.NextPhase(BattlePhase.NightCombat)); base.ImmediateTermination(); } else { this._nCurrentShellingCnt = 1; this._clsState = new StatementMachine(); this._prodShellingAttack = new ProdShellingAttack(); this._vCameraOriginPos = BattleTaskManager.GetBattleCameras().fieldCameras.get_Item(0).get_transform().get_position(); if (!BattleTaskManager.GetIsSameBGM()) { KCV.Utils.SoundUtils.SwitchBGM((BGMFileInfos)BattleTaskManager.GetBattleManager().GetBgmId()); } this._clsState.AddState(new StatementMachine.StatementMachineInitialize(this.InitNightMessage), new StatementMachine.StatementMachineUpdate(this.UpdateNightMessage)); Transform transform = Object.Instantiate(BattleTaskManager.GetPrefabFile().prefabSearchLightSceneController, Vector3.get_zero(), Quaternion.get_identity()) as Transform; this._ctrlSearchLight = transform.GetComponent <SearchLightSceneController>(); Transform transform2 = Object.Instantiate(BattleTaskManager.GetPrefabFile().prefabFlareBulletSceneController, Vector3.get_zero(), Quaternion.get_identity()) as Transform; this._ctrlFlareBullet = transform2.GetComponent <FlareBulletSceneController>(); } return(true); }
private void OnCommandBufferFinished() { BattleCutInCamera cutInCamera = BattleTaskManager.GetBattleCameras().cutInCamera; cutInCamera.eventMask = (Generics.Layers.UI2D | Generics.Layers.CutIn); BattleTaskManager.ReqPhase(BattleUtils.NextPhase(BattlePhase.Command)); }
private IEnumerator PlayForceCallback() { UIBattleNavigation uibn = BattleTaskManager.GetPrefabFile().battleNavigation; uibn.SetNavigationInWithdrawalDecision(_iMode); Dlg.Call(ref _actForceCallback); _uiTacticalSituation = UITacticalSituation.Instantiate(((Component)_prefabUITacticalSituation).GetComponent <UITacticalSituation>(), BattleTaskManager.GetBattleCameras().cutInCamera.transform, BattleTaskManager.GetBattleManager()); _uiTacticalSituation.Init(OnTacticalSituationBack); _uiTacticalSituation.panel.depth = panel.depth + 1; yield return(StartCoroutine(BattleUtils.ClearMemory())); _listHexExBtns.ForEach(delegate(UIWithdrawalButton x) { var _003CPlayForceCallback_003Ec__IteratorF = this; x.SetActive(isActive: true); x.Play(delegate { x.isFocus = ((x.index == 0) ? true : false); x.isColliderEnabled = true; if (x.index == 0) { _isInputPossible = true; _clsState.AddState(InitWithdrawalSelection, UpdateWithdrawalSelection); uibn.Show(); } }); }); yield return(null); }
public static Vector2 GetToZonePosSimpleNumberVector2(this Vector3 o, float h, int dec = 1) { var var3 = o.GetSimpleNumber(dec); var zonevar3 = BattleUtils.UnityPos2ZonePos(h, var3); return(new Vector2(zonevar3.X, zonevar3.Y)); }
private bool InitFriendFleetAdvent(object data) { this._dicPSClouds.get_Item(FleetType.Friend).SetActive(true); this._dicPSClouds.get_Item(FleetType.Friend).Play(); BattleFieldCamera cam = BattleTaskManager.GetBattleCameras().fieldCameras.get_Item(0); UIBattleShip uIBattleShip = BattleTaskManager.GetBattleShips().dicFriendBattleShips.get_Item(0); Vector3 position = BattleTaskManager.GetBattleField().dicFleetAnchor.get_Item(FleetType.Friend).get_position(); position.y = uIBattleShip.pointOfGaze.y; ShipUtils.PlayBattleStartVoice(uIBattleShip.shipModel); cam.ReqViewMode(CameraActor.ViewMode.RotateAroundObject); cam.SetRotateAroundObjectCamera(position, BattleDefines.FLEET_ADVENT_START_CAM_POS.get_Item(0), -10f); List <float> rotDst = this.CalcCloseUpCamDist(cam.rotateDistance, 30f); cam.get_transform().LTValue(cam.rotateDistance, rotDst.get_Item(0), 1f).setEase(BattleDefines.FLEET_ADVENT_FLEET_CLOSEUP_EASEING_TYPE).setOnUpdate(delegate(float x) { cam.rotateDistance = x; }).setOnComplete(delegate { cam.get_transform().LTValue(cam.rotateDistance, rotDst.get_Item(1), 1f).setEase(BattleDefines.FLEET_ADVENT_FLEET_CLOSEUP_EASEING_TYPE).setOnUpdate(delegate(float x) { cam.rotateDistance = x; }).setOnComplete(delegate { this.EndPhase(BattleUtils.NextPhase(BattlePhase.FleetAdvent)); }); }); return(false); }
private void DecideAdvancinsWithDrawalBtn(UIHexButtonEx btn) { if (btn.index == 2) { MapManager mapManager = SortieBattleTaskManager.GetMapManager(); mapManager.ChangeCurrentDeck(); } if (BattleTaskManager.IsSortieBattle() && SingletonMonoBehaviour <FadeCamera> .Instance != null) { SingletonMonoBehaviour <FadeCamera> .Instance.FadeOut(0.2f, delegate { RetentionData.SetData(BattleUtils.GetRetentionDataAdvancingWithdrawal(SortieBattleTaskManager.GetMapManager(), ShipRecoveryType.None)); if (btn.index == 0) { SingletonMonoBehaviour <FadeCamera> .Instance.isDrawNowLoading = false; SingletonMonoBehaviour <AppInformation> .Instance.NextLoadScene = Generics.Scene.Strategy; Application.LoadLevel(Generics.Scene.LoadingScene.ToString()); } else { SingletonMonoBehaviour <FadeCamera> .Instance.isDrawNowLoading = true; Dlg.Call <ShipRecoveryType>(ref this._actOnGotoSortieMap, ShipRecoveryType.None); } }); } }
protected override bool Init() { this._clsState = new StatementMachine(); this._clsBattleResult = BattleTaskManager.GetBattleManager().GetBattleResult(); this._listRewardModels = this._clsBattleResult.GetRewardItems(); if (this._listRewardModels.get_Count() > 0) { for (int i = 0; i < this._listRewardModels.get_Count(); i++) { if (this._listRewardModels.get_Item(i) is IReward_Ship) { this._clsState.AddState(new StatementMachine.StatementMachineInitialize(this._initShipGet), new StatementMachine.StatementMachineUpdate(this._updateShipGet)); } if (this._listRewardModels.get_Item(i) is IReward_Slotitem) { this._clsState.AddState(new StatementMachine.StatementMachineInitialize(this._initSlotItemGet), new StatementMachine.StatementMachineUpdate(this._updateSlotItemGet)); } if (this._listRewardModels.get_Item(i) is IReward_Useitem) { this._clsState.AddState(new StatementMachine.StatementMachineInitialize(this._initUseItemGet), new StatementMachine.StatementMachineUpdate(this._updateUseItemGet)); } } } else { BattleTaskManager.ReqPhase(BattleUtils.NextPhase(BattlePhase.ClearReward)); base.ImmediateTermination(); } return(true); }
private void TryAttack() { for (int i = 0; i < skillObjects.Count; i++) { SkillObject skillObject = (SkillObject)skillObjects[i]; Vector2 v = BattleUtils.PositionToGrid(skillObject.transform.position); ArrayList gameObjects = BattleControllor.GetGameObjectsByPosition(v); for (int j = 0; j < gameObjects.Count; j++) { Charactor c = (Charactor)gameObjects[j]; if (c.GetType() != this.attackOne.GetType() && c.IsActive() == true) { bool crit = BattleControllor.Crit(skillConfig.crit); float damage = BattleControllor.Attack(attackOne.GetAttribute(), c.GetAttribute(), skillConfig.demageratio, skillConfig.b, crit); c.ChangeHP(damage, crit); if (c.GetAttribute().hp > 0) { c.PlayAttacked(); } else { c.PlayDead(); } } } } }
private float Random(float baseValue, float amplitude, int density) { float left = baseValue - amplitude / 2f; float[] pos = new float[density]; for (int i = 0; i < pos.Length; i++) { float delta = 0; if (amplitude == 1) { delta = amplitude / 2; } else { delta = amplitude / (density - 1); } if (density == 1) { pos[i] = left + delta; } else { pos[i] = left + i * delta; } } int index = BattleUtils.RandomRangeInt(0, pos.Length); return(pos[index]); }
void RefreshPos(IntVector2 fromPos, IntVector2 toPos) { Vector3 pos = BattleUtils.LogicPosToScenePos(toPos); mRootTf.transform.LookAt(pos); mRootTf.transform.position = pos; }
protected override bool Init() { _clsState = new StatementMachine(); _clsBattleResult = BattleTaskManager.GetBattleManager().GetBattleResult(); _listRewardModels = _clsBattleResult.GetRewardItems(); if (_listRewardModels.Count > 0) { for (int i = 0; i < _listRewardModels.Count; i++) { if (_listRewardModels[i] is IReward_Ship) { _clsState.AddState(_initShipGet, _updateShipGet); } if (_listRewardModels[i] is IReward_Slotitem) { _clsState.AddState(_initSlotItemGet, _updateSlotItemGet); } if (_listRewardModels[i] is IReward_Useitem) { _clsState.AddState(_initUseItemGet, _updateUseItemGet); } } } else { BattleTaskManager.ReqPhase(BattleUtils.NextPhase(BattlePhase.ClearReward)); ImmediateTermination(); } return(true); }
private void _onTorpedoExplosionFinished() { BattleCutInEffectCamera efcam = BattleTaskManager.GetBattleCameras().cutInEffectCamera; UICircleHPGauge circleHPGauge = BattleTaskManager.GetPrefabFile().circleHPGauge; circleHPGauge.transform.localScaleZero(); PlayProdDamage(_clsRaigeki, delegate { efcam.isCulling = true; Observable.Timer(TimeSpan.FromSeconds(1.0)).Subscribe(delegate { ObserverActionQueue observerAction = BattleTaskManager.GetObserverAction(); observerAction.Register(delegate { BattleTaskManager.GetTorpedoHpGauges().Hide(); }); EndPhase(BattleUtils.NextPhase(BattlePhase.OpeningTorpedoSalvo)); }); }); if (_prodTorpedoSalvoPhase3 != null) { UnityEngine.Object.Destroy(_prodTorpedoSalvoPhase3.transform.gameObject); } _prodTorpedoSalvoPhase3 = null; }
protected override bool Init() { _clsNightCombat = BattleTaskManager.GetBattleManager().GetNightCombatData(); _clsHougekiList = BattleTaskManager.GetBattleManager().GetHougekiList_Night(); if (_clsHougekiList == null) { EndPhase(BattleUtils.NextPhase(BattlePhase.NightCombat)); ImmediateTermination(); } else { _nCurrentShellingCnt = 1; _clsState = new StatementMachine(); _prodShellingAttack = new ProdShellingAttack(); _vCameraOriginPos = BattleTaskManager.GetBattleCameras().fieldCameras[0].transform.position; if (!BattleTaskManager.GetIsSameBGM()) { KCV.Utils.SoundUtils.SwitchBGM((BGMFileInfos)BattleTaskManager.GetBattleManager().GetBgmId()); } _clsState.AddState(InitNightMessage, UpdateNightMessage); Transform transform = UnityEngine.Object.Instantiate(BattleTaskManager.GetPrefabFile().prefabSearchLightSceneController, Vector3.zero, Quaternion.identity) as Transform; _ctrlSearchLight = ((Component)transform).GetComponent <SearchLightSceneController>(); Transform transform2 = UnityEngine.Object.Instantiate(BattleTaskManager.GetPrefabFile().prefabFlareBulletSceneController, Vector3.zero, Quaternion.identity) as Transform; _ctrlFlareBullet = ((Component)transform2).GetComponent <FlareBulletSceneController>(); } return(true); }
private bool _updateChkNextCell(object data) { if (!_clsMapManager.IsNextFinal()) { if (BattleTaskManager.GetRootType() == Generics.BattleRootType.Rebellion && BattleTaskManager.GetBattleManager().ChangeableDeck&& BattleTaskManager.GetBattleManager().Ships_f[0].DmgStateEnd == DamageState_Battle.Taiha && !BattleTaskManager.GetBattleManager().Ships_f[0].HasRecoverYouin() && !BattleTaskManager.GetBattleManager().Ships_f[0].HasRecoverMegami()) { BattleTaskManager.ReqPhase(BattlePhase.AdvancingWithdrawal); return(true); } if (BattleTaskManager.GetBattleManager().Ships_f[0].DmgStateEnd == DamageState_Battle.Taiha && !ShipUtils.HasRepair(_clsResultModel.Ships_f[0])) { BattleTaskManager.ReqPhase(BattlePhase.FlagshipWreck); return(true); } BattleTaskManager.ReqPhase(BattlePhase.EscortShipEvacuation); return(true); } if (SingletonMonoBehaviour <FadeCamera> .Instance != null) { SingletonMonoBehaviour <FadeCamera> .Instance.isDrawNowLoading = false; SingletonMonoBehaviour <FadeCamera> .Instance.FadeOut(0.2f, delegate { RetentionData.SetData(BattleUtils.GetRetentionDataMapOpen(SortieBattleTaskManager.GetMapManager(), _clsResultModel)); SingletonMonoBehaviour <AppInformation> .Instance.NextLoadScene = Generics.Scene.Strategy; Application.LoadLevel(Generics.Scene.LoadingScene.ToString()); }); } return(true); }
private void _onSupportAerialFinishedPhase2() { PlayProdDamage(_clsAerial, delegate { EndPhase(BattleUtils.NextPhase(BattlePhase.SupportingFire)); }); }
private void ChkNextCell() { if (!_clsMapManger.IsNextFinal()) { if (BattleCutManager.GetBattleType() == Generics.BattleRootType.Rebellion && BattleCutManager.GetBattleManager().ChangeableDeck&& BattleCutManager.GetBattleManager().Ships_f[0].DmgStateEnd == DamageState_Battle.Taiha && !BattleCutManager.GetBattleManager().Ships_f[0].HasRecoverMegami() && !BattleCutManager.GetBattleManager().Ships_f[0].HasRecoverYouin()) { BattleCutManager.ReqPhase(BattleCutPhase.AdvancingWithdrawal); } else if (_clsResultModel.Ships_f[0].DmgStateEnd == DamageState_Battle.Taiha && !ShipUtils.HasRepair(_clsResultModel.Ships_f[0])) { BattleCutManager.ReqPhase(BattleCutPhase.FlagshipWreck); } else { BattleCutManager.ReqPhase(BattleCutPhase.EscortShipEvacuation); } } else if (SingletonMonoBehaviour <FadeCamera> .Instance != null) { SingletonMonoBehaviour <FadeCamera> .Instance.SetActive(isActive : true); SingletonMonoBehaviour <FadeCamera> .Instance.isDrawNowLoading = false; SingletonMonoBehaviour <FadeCamera> .Instance.FadeOut(0.2f, delegate { SingletonMonoBehaviour <SoundManager> .Instance.soundVolume.BGM = BattleDefines.SOUND_KEEP.BGMVolume; SingletonMonoBehaviour <SoundManager> .Instance.rawBGMVolume = BattleDefines.SOUND_KEEP.BGMVolume; Mst_DataManager.Instance.PurgeUIBattleMaster(); RetentionData.SetData(BattleUtils.GetRetentionDataMapOpen(BattleCutManager.GetMapManager(), _clsResultModel)); SingletonMonoBehaviour <AppInformation> .Instance.NextLoadScene = Generics.Scene.Strategy; Application.LoadLevel(Generics.Scene.LoadingScene.ToString()); }); } }
private bool InitFriendFleetAdvent(object data) { ((Component)_dicPSClouds[FleetType.Friend]).SetActive(isActive: true); _dicPSClouds[FleetType.Friend].Play(); BattleFieldCamera cam = BattleTaskManager.GetBattleCameras().fieldCameras[0]; UIBattleShip uIBattleShip = BattleTaskManager.GetBattleShips().dicFriendBattleShips[0]; Vector3 position = BattleTaskManager.GetBattleField().dicFleetAnchor[FleetType.Friend].position; Vector3 pointOfGaze = uIBattleShip.pointOfGaze; position.y = pointOfGaze.y; ShipUtils.PlayBattleStartVoice(uIBattleShip.shipModel); cam.ReqViewMode(CameraActor.ViewMode.RotateAroundObject); cam.SetRotateAroundObjectCamera(position, BattleDefines.FLEET_ADVENT_START_CAM_POS[0], -10f); List <float> rotDst = CalcCloseUpCamDist(cam.rotateDistance, 30f); cam.transform.LTValue(cam.rotateDistance, rotDst[0], 1f).setEase(BattleDefines.FLEET_ADVENT_FLEET_CLOSEUP_EASEING_TYPE).setOnUpdate(delegate(float x) { cam.rotateDistance = x; }) .setOnComplete((Action) delegate { cam.transform.LTValue(cam.rotateDistance, rotDst[1], 1f).setEase(BattleDefines.FLEET_ADVENT_FLEET_CLOSEUP_EASEING_TYPE).setOnUpdate(delegate(float x) { cam.rotateDistance = x; }) .setOnComplete((Action) delegate { EndPhase(BattleUtils.NextPhase(BattlePhase.FleetAdvent)); }); }); return(false); }
private void _onSupportShellingFinished() { PlayProdDamage(_clsShelling, delegate { EndPhase(BattleUtils.NextPhase(BattlePhase.SupportingFire)); }); }
//Calculate the chance of hitting/critting/etc public void CalcRates(Character caster, Character target, BattleCommand skill) { hitRate = BattleUtils.GetHitRate(caster, target, skill, this); critRate = BattleUtils.GetCritRate(caster, target, skill, this); blockRate = BattleUtils.GetBlockRate(caster, target, skill, this); parryRate = BattleUtils.GetParryRate(caster, target, skill, this); resistRate = BattleUtils.GetResistRate(caster, target, skill, this); }
override protected void OnAttach() { base.OnAttach(); var unitsPerSecond = ((BattleBuilding)target).unitsPerSecond; _unitsPerTick = BattleUtils.floor(unitsPerSecond / engine.configuration.ticksPerSecond); }
public bool WithinStayPos() { if (BattleUtils.Distance2(barrackSoliderPos, GetPosition()) < 0.1f) { return(true); } return(false); }
public override void Die(DateTime tick, CommandResultContainer actionContainer = null) { if (IsAlive()) { // todo: does retail if (lastAttacker is Pet && lastAttacker.aiContainer.GetController <PetController>() != null && lastAttacker.aiContainer.GetController <PetController>().GetPetMaster() is Player) { lastAttacker = lastAttacker.aiContainer.GetController <PetController>().GetPetMaster(); } if (lastAttacker is Player) { //I think this is, or should be odne in DoBattleAction. Packet capture had the message in the same packet as an attack // <actor> defeat/defeats <target> if (actionContainer != null) { actionContainer.AddEXPAction(new CommandResult(actorId, 30108, 0)); } if (lastAttacker.currentParty != null && lastAttacker.currentParty is Party) { foreach (var memberId in ((Party)lastAttacker.currentParty).members) { var partyMember = zone.FindActorInArea <Character>(memberId); // onDeath(monster, player, killer) lua.LuaEngine.CallLuaBattleFunction(this, "onDeath", this, partyMember, lastAttacker); // todo: add actual experience calculation and exp bonus values. if (partyMember is Player) { BattleUtils.AddBattleBonusEXP((Player)partyMember, this, actionContainer); } } } else { // onDeath(monster, player, killer) lua.LuaEngine.CallLuaBattleFunction(this, "onDeath", this, lastAttacker, lastAttacker); //((Player)lastAttacker).QueuePacket(BattleActionX01Packet.BuildPacket(lastAttacker.actorId, 0, 0, new BattleAction(actorId, 30108, 0))); } } if (positionUpdates != null) { positionUpdates.Clear(); } aiContainer.InternalDie(tick, despawnTime); //this.ResetMoveSpeeds(); // todo: reset cooldowns lua.LuaEngine.GetInstance().OnSignal("mobkill"); } else { var err = String.Format("[{0}][{1}] {2} {3} {4} {5} tried to die ded", actorId, GetUniqueId(), positionX, positionY, positionZ, GetZone().GetName()); Program.Log.Error(err); //throw new Exception(err); } }
void Start() { playAnimation = true; rendererPosition = spriteRenderer.transform.localPosition; spriteRenderer.sortingOrder = -(int)(this.transform.localPosition.y * 10); point = BattleUtils.PositionToGrid(this.transform.localPosition); }
public override void Init() { _clsBattleResult = BattleCutManager.GetBattleManager().GetBattleResult(); startHP = GetStartHP(_clsBattleResult); isAnimEnd = false; key = new KeyControl(); SetResultShips(); _clsMVPShip.Init(_clsBattleResult.MvpShip); _clsMVPShip.PlayMVPVoice(BattleUtils.IsPlayMVPVoice(_clsBattleResult.WinRank)); }
public override void Init() { this._clsBattleResult = BattleCutManager.GetBattleManager().GetBattleResult(); this.startHP = this.GetStartHP(this._clsBattleResult); this.isAnimEnd = false; this.key = new KeyControl(0, 0, 0.4f, 0.1f); this.SetResultShips(); this._clsMVPShip.Init(this._clsBattleResult.MvpShip); this._clsMVPShip.PlayMVPVoice(BattleUtils.IsPlayMVPVoice(this._clsBattleResult.WinRank)); }
private bool UpdateEnemyFleetFocus(object data) { BattleFieldCamera battleFieldCamera = BattleTaskManager.GetBattleCameras().fieldCameras.get_Item(0); if (Vector3.Distance(battleFieldCamera.eyePosition, this._tpFocusPoint.Item1) <= this._tpFocusPoint.Item2) { this.EndPhase(BattleUtils.NextPhase(BattlePhase.Detection)); return(true); } return(false); }
public void SetInfo(GDSKit.SkillEffect effectGds, IntVector2 effectPos, int targetUnitId , short effectAngler, short param1, short param2, CampType casterCampType) { mEffectConfig = effectGds; mEffectPos = effectPos; mEffectAngler = effectAngler; mEffectParam1 = param1; mEffectParam2 = param2; mTargetUnitId = targetUnitId; mEffectCamp = mEffectConfig.isEffectSelfCamp ? casterCampType : BattleUtils.GetAnotherCamp(casterCampType); }
//是否在攻击范围内 public bool WithinRange(CharacterInfo target) { if (BattleUtils.Distance2(this.GetPosition(), target.GetPosition()) <= 100) { return(true); } else { return(false); } }
//Order of what (probably) happens when a skill is used: //Buffs that alter things like recast times or that only happen once per skill usage like Power Surge are activated //Script calculates damage and handles any special requirements //Rates are calculated //Buffs that impact indiviudal hits like Blindside or Blood for Blood are activated //The final hit type is determined //Stoneskin takes damage //Final damage amount is calculated using the hit type and defender's stats //Buffs that activate or respond to damage like Rampage. Stoneskin gets removed AFTER damage if it falls off. //Additional effects that are a part of the skill itself or weapon in case of auto attacks take place like status effects //Certain buffs that alter the whole skill fall off (Resonance, Excruciate) public void DoAction(Character caster, Character target, BattleCommand skill, CommandResultContainer results) { //First calculate rates for hit/block/etc CalcRates(caster, target, skill); //Next, modify those rates based on preaction buffs //Still not sure how we shouldh andle these PreAction(caster, target, skill, results); BattleUtils.DoAction(caster, target, skill, this, results); }
public void Excute() { if (atkInfo == null) { return; } if (BattleUtils.Distance2(atkInfo.GetPosition(), monsterInfo.GetPosition()) < 20) { monsterInfo.ChangeState("attack", new StateParam(atkInfo)); } }