protected virtual Vector3 CalcProtecterPos(Vector3 close4)
        {
            BattleField battleField = BattleTaskManager.GetBattleField();
            Vector3     vector      = Vector3.Lerp(_listBattleShips[1].spPointOfGaze, close4, 0.58f);
            Vector3     position    = _listBattleShips[1].transform.position;
            Vector3     seaLevelPos = battleField.seaLevelPos;

            position.y = seaLevelPos.y;
            position.z = vector.z;
            return(position);
        }
Пример #2
0
        protected void CorFleetAnchorDifPosition()
        {
            BattleField battleField = BattleTaskManager.GetBattleField();
            Vector3     to          = (!this._listBattleShips.get_Item(0).shipModel.IsFriend()) ? this._listBattleShips.get_Item(1).get_transform().get_position() : this._listBattleShips.get_Item(0).get_transform().get_position();
            Vector3     to2         = this._listBattleShips.get_Item(0).shipModel.IsFriend() ? this._listBattleShips.get_Item(1).get_transform().get_position() : this._listBattleShips.get_Item(0).get_transform().get_position();
            Vector3     vector      = Mathe.Direction(Vector3.get_zero(), to);
            Vector3     vector2     = Mathe.Direction(Vector3.get_zero(), to2);

            battleField.dicFleetAnchor.get_Item(FleetType.Friend).get_transform().AddPosX(-vector.x);
            battleField.dicFleetAnchor.get_Item(FleetType.Enemy).get_transform().AddPosX(-vector2.x);
        }
        protected void CorFleetAnchorDifPosition()
        {
            BattleField battleField = BattleTaskManager.GetBattleField();
            Vector3     to          = (!_listBattleShips[0].shipModel.IsFriend()) ? _listBattleShips[1].transform.position : _listBattleShips[0].transform.position;
            Vector3     to2         = _listBattleShips[0].shipModel.IsFriend() ? _listBattleShips[1].transform.position : _listBattleShips[0].transform.position;
            Vector3     vector      = Mathe.Direction(Vector3.zero, to);
            Vector3     vector2     = Mathe.Direction(Vector3.zero, to2);

            battleField.dicFleetAnchor[FleetType.Friend].transform.AddPosX(0f - vector.x);
            battleField.dicFleetAnchor[FleetType.Enemy].transform.AddPosX(0f - vector2.x);
        }
 private bool InitWithdrawalSelection(object data)
 {
     _prodWithdrawalDecisionSelection.Play(delegate
     {
         BattleTaskManager.GetPrefabFile().DisposeProdCommandBuffer();
         ObserverActionQueue observerAction = BattleTaskManager.GetObserverAction();
         observerAction.Executions();
         BattleField battleField = BattleTaskManager.GetBattleField();
         battleField.ResetFleetAnchorPosition();
         battleField.enemySeaLevel.SetActive(isActive: true);
         battleField.ReqTimeZone(KCV.Battle.Utils.TimeZone.Night, BattleTaskManager.GetSkyType());
         battleField.AlterWaveDirection(FleetType.Friend, FleetType.Friend);
         battleField.AlterWaveDirection(FleetType.Enemy, FleetType.Enemy);
         BattleShips battleShips = BattleTaskManager.GetBattleShips();
         battleShips.RadarDeployment(isDeploy: false);
         battleShips.SetShipDrawType(FleetType.Enemy, ShipDrawType.Normal);
         battleShips.SetStandingPosition(StandingPositionType.OneRow);
         battleShips.SetLayer(Generics.Layers.ShipGirl);
         BattleCameras battleCameras = BattleTaskManager.GetBattleCameras();
         battleCameras.InitEnemyFieldCameraDefault();
         battleCameras.SetVerticalSplitCameras(isSplit: false);
         if (!battleCameras.isSplit)
         {
             battleCameras.SetSplitCameras(isSplit: true);
         }
         battleCameras.ResetFieldCamSettings(FleetType.Friend);
         battleCameras.ResetFieldCamSettings(FleetType.Enemy);
         battleCameras.fieldDimCameraEnabled(isEnabled: false);
         BattleFieldCamera battleFieldCamera = BattleTaskManager.GetBattleCameras().fieldCameras[0];
         battleFieldCamera.ReqViewMode(CameraActor.ViewMode.Fix);
         battleFieldCamera.SetFixCamera(_dicSplitCameraPos[FleetType.Friend], _dicSplitCameraRot[FleetType.Friend]);
         battleFieldCamera.cullingMask = battleCameras.GetDefaultLayers();
         battleFieldCamera             = BattleTaskManager.GetBattleCameras().fieldCameras[1];
         battleFieldCamera.ReqViewMode(CameraActor.ViewMode.Fix);
         battleFieldCamera.SetFixCamera(_dicSplitCameraPos[FleetType.Enemy], _dicSplitCameraRot[FleetType.Enemy]);
         battleFieldCamera.cullingMask = battleCameras.GetEnemyCamSplitLayers();
         BattleShips battleShips2      = BattleTaskManager.GetBattleShips();
         battleShips2.SetBollboardTarget(isFriend: true, battleCameras.fieldCameras[0].transform);
         battleShips2.SetBollboardTarget(isFriend: false, battleCameras.fieldCameras[1].transform);
         battleShips2.SetTorpedoSalvoWakeAngle(isSet: false);
         BattleCutInEffectCamera cutInEffectCamera = BattleTaskManager.GetBattleCameras().cutInEffectCamera;
         cutInEffectCamera.isCulling = false;
         UITexture component         = ((Component)cutInEffectCamera.transform.FindChild("TorpedoLine/OverlayLine")).GetComponent <UITexture>();
         if (component != null)
         {
             component.alpha = 0f;
         }
         BattleTaskManager.GetTorpedoHpGauges().SetDestroy();
     }, OnDecideWithdrawalButton);
     return(false);
 }
Пример #5
0
        private bool InitNightMessage(object data)
        {
            _prodNightRadarDeployment = ProdNightRadarDeployment.Instantiate(((Component)BattleTaskManager.GetPrefabFile().prefabProdNightRadarDeployment).GetComponent <ProdNightRadarDeployment>(), BattleTaskManager.GetBattleCameras().cutInCamera.transform);
            _prodNightRadarDeployment.Play().Subscribe(delegate
            {
                OnNightMessageFinished();
            });
            BattleField battleField = BattleTaskManager.GetBattleField();

            battleField.isEnemySeaLevelActive = false;
            ShipModel_Battle model = BattleTaskManager.GetBattleManager().Ships_f[0];

            KCV.Battle.Utils.ShipUtils.PlayStartNightCombatVoice(model);
            return(false);
        }
Пример #6
0
        private new void Start()
        {
            InitBattleData();
            _clsSettingModel   = new SettingModel();
            _iPhase            = (_iPhaseReq = BattlePhase.BattlePhase_BEF);
            _traStage          = base.transform.FindChild("Stage");
            _clsBattleShips    = new BattleShips();
            _clsBattleCameras  = new BattleCameras();
            _clsBattleHPGauges = new BattleHPGauges();
            _clsBattleField    = base.transform.GetComponentInChildren <BattleField>();
            UICircleHPGauge    circleHPGauge    = _clsBattlePrefabFile.circleHPGauge;
            UIBattleNavigation battleNavigation = _clsBattlePrefabFile.battleNavigation;

            battleNavigation.panel.depth = 100;
            _clsTorpedoHpGauges          = new TorpedoHpGauges();
            _clsBattleShips.Init(GetBattleManager());
            _clsBattleField.ReqTimeZone(GetStartTimeZone(GetBattleManager().WarType), GetSkyType());
            KCV.Utils.SoundUtils.SwitchBGM((BGMFileInfos)GetBattleManager().GetBgmId());
            ProdSortieTransitionToBattle psttb = (SortieBattleTaskManager.GetSortieBattlePrefabFile() != null) ? SortieBattleTaskManager.GetSortieBattlePrefabFile().prodSortieTransitionToBattle : ProdSortieTransitionToBattle.Instantiate(Resources.Load <ProdSortieTransitionToBattle>("Prefabs/SortieMap/SortieTransitionToBattle/ProdSortieTransitionToBattle"), _clsBattleCameras.cutInCamera.transform).QuickFadeInInit();

            Observable.FromCoroutine((UniRx.IObserver <float> observer) => InitBattle(observer)).Subscribe(delegate(float x)
            {
                if (x == 1f)
                {
                    _iPhase = (_iPhaseReq = BattlePhase.FleetAdvent);
                    Observable.Timer(TimeSpan.FromSeconds(0.30000001192092896)).Subscribe(delegate
                    {
                        _clsBattleField.AlterWaveDirection(FleetType.Friend);
                        psttb.Play(ProdSortieTransitionToBattle.AnimationName.ProdSortieTransitionToBattleFadeIn, delegate
                        {
                            if (SortieBattleTaskManager.GetSortieBattlePrefabFile() != null)
                            {
                                SortieBattleTaskManager.GetSortieBattlePrefabFile().DisposeProdSortieTransitionToBattle();
                            }
                            else
                            {
                                UnityEngine.Object.Destroy(psttb.gameObject);
                            }
                            if (SortieBattleTaskManager.GetTransitionCamera() != null)
                            {
                                SortieBattleTaskManager.GetTransitionCamera().enabled = false;
                            }
                            Mem.Del(ref psttb);
                        });
                    });
                }
            }).AddTo(base.gameObject);
        }
Пример #7
0
        private bool _initSupportTorpedoPhase2(object data)
        {
            BattleField   battleField   = BattleTaskManager.GetBattleField();
            BattleCameras battleCameras = BattleTaskManager.GetBattleCameras();

            battleCameras.friendFieldCamera.ReqViewMode(CameraActor.ViewMode.NotViewModeCtrl);
            Vector3 position = battleField.dicCameraAnchors[CameraAnchorType.OneRowAnchor][FleetType.Friend].position;

            battleCameras.friendFieldCamera.transform.position      = new Vector3(-38f, 8f, -74f);
            battleCameras.friendFieldCamera.transform.localRotation = Quaternion.Euler(new Vector3(9.5f, 137.5f, 0f));
            BattleTaskManager.GetBattleShips().SetBollboardTarget(isFriend: false, battleCameras.friendFieldCamera.transform);
            if (_prodSupportTorpedoP1 != null)
            {
                _prodSupportTorpedoP1.deleteTorpedoWake();
                _prodSupportTorpedoP1.OnSetDestroy();
            }
            _prodSupportTorpedoP1 = null;
            _prodSupportTorpedoP2.Play(_onSupportTorpedoPhase2Finished);
            return(false);
        }
Пример #8
0
        public virtual IObservable <bool> Play(Action onPlayBufferEffect, Action onCalcInitLineRotation, Action onPlayLineAnimation, Action onNextFocusShipAnimation, int nBufferCnt)
        {
            this._nBufferCnt      = Mathe.MinMax2(nBufferCnt, 0, 4);
            this._clsCameraBezier = new Bezier(Bezier.BezierType.Quadratic, this._vStartCameraPivot, this._listEndCameraPivot.get_Item(this._nBufferCnt), this._vMidCameraPivot, Vector3.get_zero());
            this._clsFleetBezier  = new Bezier(Bezier.BezierType.Quadratic, this._vStartFleetPivot, this._vEndFleetPivot, this._vMidFleetPivot, Vector3.get_zero());
            BattleField battleField = BattleTaskManager.GetBattleField();

            this._traFleetAnchorFriend = battleField.dicFleetAnchor.get_Item(FleetType.Friend);
            this._traFleetAnchorEnemy  = battleField.dicFleetAnchor.get_Item(FleetType.Enemy);
            this._traFleetAnchorEnemy.get_transform().set_localScale(Vector3.get_one() * 0.8f);
            BattleCameras battleCameras = BattleTaskManager.GetBattleCameras();

            battleCameras.SetVerticalSplitCameras(false);
            battleCameras.fieldDimCamera.maskAlpha = 0f;
            battleCameras.SwitchMainCamera(FleetType.Enemy);
            BattleFieldCamera battleFieldCamera = battleCameras.fieldCameras.get_Item(1);

            battleFieldCamera.ReqViewMode(CameraActor.ViewMode.FixChasing);
            battleFieldCamera.eyePosition = this._clsCameraBezier.Interpolate(0f);
            battleFieldCamera.pointOfGaze = Vector3.Lerp(this._clsFleetBezier.Interpolate(0f), this._listEnemyFleetPivot.get_Item(this._nBufferCnt), 0.5f);
            battleFieldCamera.get_transform().LookAt(battleFieldCamera.pointOfGaze);
            BattleShips battleShips = BattleTaskManager.GetBattleShips();

            battleShips.SetBollboardTarget(battleFieldCamera.get_transform());
            battleShips.SetLayer(Generics.Layers.ShipGirl);
            BattleCutInEffectCamera cutInEffectCamera = BattleTaskManager.GetBattleCameras().cutInEffectCamera;
            UITexture component = cutInEffectCamera.get_transform().FindChild("TorpedoLine/OverlayLine").GetComponent <UITexture>();

            if (component != null)
            {
                component.alpha = 0f;
            }
            this._actOnPlayBufferEffect       = onPlayBufferEffect;
            this._actOnNextFocusShipAnimation = onNextFocusShipAnimation;
            Observable.NextFrame(FrameCountType.Update).Subscribe(delegate(Unit x)
            {
                Dlg.Call(ref onCalcInitLineRotation);
                Dlg.Call(ref onPlayLineAnimation);
            });
            return(Observable.FromCoroutine <bool>((IObserver <bool> observer) => this.AnimationObserver(observer)));
        }
Пример #9
0
        public virtual UniRx.IObservable <bool> Play(Action onPlayBufferEffect, Action onCalcInitLineRotation, Action onPlayLineAnimation, Action onNextFocusShipAnimation, int nBufferCnt)
        {
            _nBufferCnt      = Mathe.MinMax2(nBufferCnt, 0, 4);
            _clsCameraBezier = new Bezier(Bezier.BezierType.Quadratic, _vStartCameraPivot, _listEndCameraPivot[_nBufferCnt], _vMidCameraPivot, Vector3.zero);
            _clsFleetBezier  = new Bezier(Bezier.BezierType.Quadratic, _vStartFleetPivot, _vEndFleetPivot, _vMidFleetPivot, Vector3.zero);
            BattleField battleField = BattleTaskManager.GetBattleField();

            _traFleetAnchorFriend = battleField.dicFleetAnchor[FleetType.Friend];
            _traFleetAnchorEnemy  = battleField.dicFleetAnchor[FleetType.Enemy];
            _traFleetAnchorEnemy.transform.localScale = Vector3.one * 0.8f;
            BattleCameras battleCameras = BattleTaskManager.GetBattleCameras();

            battleCameras.SetVerticalSplitCameras(isSplit: false);
            battleCameras.fieldDimCamera.maskAlpha = 0f;
            battleCameras.SwitchMainCamera(FleetType.Enemy);
            BattleFieldCamera battleFieldCamera = battleCameras.fieldCameras[1];

            battleFieldCamera.ReqViewMode(CameraActor.ViewMode.FixChasing);
            battleFieldCamera.eyePosition = _clsCameraBezier.Interpolate(0f);
            battleFieldCamera.pointOfGaze = Vector3.Lerp(_clsFleetBezier.Interpolate(0f), _listEnemyFleetPivot[_nBufferCnt], 0.5f);
            battleFieldCamera.transform.LookAt(battleFieldCamera.pointOfGaze);
            BattleShips battleShips = BattleTaskManager.GetBattleShips();

            battleShips.SetBollboardTarget(battleFieldCamera.transform);
            battleShips.SetLayer(Generics.Layers.ShipGirl);
            BattleCutInEffectCamera cutInEffectCamera = BattleTaskManager.GetBattleCameras().cutInEffectCamera;
            UITexture component = ((Component)cutInEffectCamera.transform.FindChild("TorpedoLine/OverlayLine")).GetComponent <UITexture>();

            if (component != null)
            {
                component.alpha = 0f;
            }
            _actOnPlayBufferEffect       = onPlayBufferEffect;
            _actOnNextFocusShipAnimation = onNextFocusShipAnimation;
            Observable.NextFrame().Subscribe(delegate
            {
                Dlg.Call(ref onCalcInitLineRotation);
                Dlg.Call(ref onPlayLineAnimation);
            });
            return(Observable.FromCoroutine((UniRx.IObserver <bool> observer) => AnimationObserver(observer)));
        }
Пример #10
0
        private void MakeRadar()
        {
            BattleField     field      = BattleTaskManager.GetBattleField();
            BattlePefabFile prefabFile = BattleTaskManager.GetPrefabFile();
            Transform       p          = prefabFile.prefabUIBufferFleetCircle;

            _listBufferFleetCircle = new List <UIBufferFleetCircle>();
            foreach (int value in Enum.GetValues(typeof(FleetType)))
            {
                if (value != 2)
                {
                    _listBufferFleetCircle.Add(UIBufferFleetCircle.Instantiate(((Component)p).GetComponent <UIBufferFleetCircle>(), field.dicFleetAnchor[(FleetType)value], (FleetType)value));
                    _listBufferFleetCircle[value].transform.positionY(0.001f);
                }
            }
            Mem.Del(ref p);
            Transform prefab = prefabFile.prefabUIBufferShipCircle;

            _dicBufferShipCircle = new Dictionary <int, List <UIBufferCircle> >();
            int cnt = 0;
            List <UIBufferCircle> friendBufferCircle = new List <UIBufferCircle>();

            dicFriendBattleShips.ForEach(delegate(KeyValuePair <int, UIBattleShip> x)
            {
                friendBufferCircle.Add(UIBufferCircle.Instantiate(((Component)prefab).GetComponent <UIBufferCircle>(), x.Value.transform, FleetType.Friend, field.dicFleetAnchor[FleetType.Enemy]));
                cnt++;
            });
            _dicBufferShipCircle.Add(0, friendBufferCircle);
            cnt = 0;
            List <UIBufferCircle> enemyBufferCircle = new List <UIBufferCircle>();

            _dicEnemyBattleShips.ForEach(delegate(KeyValuePair <int, UIBattleShip> x)
            {
                enemyBufferCircle.Add(UIBufferCircle.Instantiate(((Component)prefab).GetComponent <UIBufferCircle>(), x.Value.transform, FleetType.Enemy, field.dicFleetAnchor[FleetType.Friend]));
                cnt++;
            });
            _dicBufferShipCircle.Add(1, enemyBufferCircle);
            Mem.Del(ref prefab);
            _isMakeRadar = true;
        }
Пример #11
0
        private bool InitSearchNFlare(object data)
        {
            BattleCameras     battleCameras     = BattleTaskManager.GetBattleCameras();
            BattleFieldCamera battleFieldCamera = battleCameras.fieldCameras[0];

            battleFieldCamera.flareLayer.enabled = true;
            bool flag  = (_clsNightCombat.GetSearchLightShip(is_friend: true) != null) ? true : false;
            bool flag2 = (_clsNightCombat.GetFlareShip(is_friend: true) != null) ? true : false;

            if (flag || flag2)
            {
                if (_prodNightRadarDeployment != null)
                {
                    _prodNightRadarDeployment.RadarObjectConvergence();
                }
                Mem.DelComponentSafe(ref _prodNightRadarDeployment);
                ObserverActionQueue observerAction = BattleTaskManager.GetObserverAction();
                observerAction.Executions();
                BattleTaskManager.GetBattleShips().SetStandingPosition(StandingPositionType.OneRow);
                battleFieldCamera.ReqViewMode(CameraActor.ViewMode.Fix);
                battleFieldCamera.transform.position = _vCameraOriginPos;
                battleFieldCamera.transform.rotation = Quaternion.identity;
                ShipModel_BattleAll shipModel_BattleAll = (!flag) ? _clsNightCombat.GetFlareShip(is_friend: true) : _clsNightCombat.GetSearchLightShip(is_friend: true);
                if (shipModel_BattleAll != null)
                {
                    BattleField  battleField  = BattleTaskManager.GetBattleField();
                    UIBattleShip uIBattleShip = BattleTaskManager.GetBattleShips().dicFriendBattleShips[shipModel_BattleAll.Index];
                    Vector3      position     = uIBattleShip.transform.position;
                    float        x            = 0f - position.x;
                    battleField.dicFleetAnchor[FleetType.Friend].transform.AddPosX(x);
                    battleFieldCamera.transform.AddPosX(x);
                }
            }
            SearchLight_FlareBullet_PlayAnimation().Subscribe(delegate
            {
                OnSearchNFlareFinished();
            });
            return(false);
        }
Пример #12
0
        private bool InitSearchNFlare(object data)
        {
            BattleCameras     battleCameras     = BattleTaskManager.GetBattleCameras();
            BattleFieldCamera battleFieldCamera = battleCameras.fieldCameras.get_Item(0);

            battleFieldCamera.flareLayer.set_enabled(true);
            bool searchLightShip = this._clsNightCombat.GetSearchLightShip(true) != null;
            bool flareShip       = this._clsNightCombat.GetFlareShip(true) != null;

            if (searchLightShip || flareShip)
            {
                if (this._prodNightRadarDeployment != null)
                {
                    this._prodNightRadarDeployment.RadarObjectConvergence();
                }
                Mem.DelComponentSafe <ProdNightRadarDeployment>(ref this._prodNightRadarDeployment);
                ObserverActionQueue observerAction = BattleTaskManager.GetObserverAction();
                observerAction.Executions();
                BattleTaskManager.GetBattleShips().SetStandingPosition(StandingPositionType.OneRow);
                battleFieldCamera.ReqViewMode(CameraActor.ViewMode.Fix);
                battleFieldCamera.get_transform().set_position(this._vCameraOriginPos);
                battleFieldCamera.get_transform().set_rotation(Quaternion.get_identity());
                ShipModel_BattleAll shipModel_BattleAll = (!searchLightShip) ? this._clsNightCombat.GetFlareShip(true) : this._clsNightCombat.GetSearchLightShip(true);
                if (shipModel_BattleAll != null)
                {
                    BattleField  battleField  = BattleTaskManager.GetBattleField();
                    UIBattleShip uIBattleShip = BattleTaskManager.GetBattleShips().dicFriendBattleShips.get_Item(shipModel_BattleAll.Index);
                    float        x            = -uIBattleShip.get_transform().get_position().x;
                    battleField.dicFleetAnchor.get_Item(FleetType.Friend).get_transform().AddPosX(x);
                    battleFieldCamera.get_transform().AddPosX(x);
                }
            }
            this.SearchLight_FlareBullet_PlayAnimation().Subscribe(delegate(int _)
            {
                this.OnSearchNFlareFinished();
            });
            return(false);
        }