private bool _createTorpedoWakeOnes(bool isFriend)
        {
            FleetType key = (!isFriend) ? FleetType.Enemy : FleetType.Friend;
            Dictionary <int, UIBattleShip> dictionary  = (!isFriend) ? BattleTaskManager.GetBattleShips().dicEnemyBattleShips : BattleTaskManager.GetBattleShips().dicFriendBattleShips;
            Dictionary <int, UIBattleShip> dictionary2 = (!isFriend) ? BattleTaskManager.GetBattleShips().dicFriendBattleShips : BattleTaskManager.GetBattleShips().dicEnemyBattleShips;

            if (_dicIsAttack[key])
            {
                for (int i = 0; i < dictionary.Count; i++)
                {
                    ShipModel_Battle shipModel = dictionary[i].shipModel;
                    ShipModel_Battle attackTo  = _clsTorpedo.GetAttackTo(shipModel);
                    if (shipModel != null && attackTo != null)
                    {
                        Vector3 position = dictionary[i].transform.position;
                        Vector3 vector;
                        if (isFriend)
                        {
                            Vector3 position2 = dictionary2[attackTo.Index].transform.position;
                            vector = new Vector3(position2.x, position.y, position.z - 1f);
                        }
                        else
                        {
                            Vector3 position3 = dictionary2[attackTo.Index].transform.position;
                            vector = new Vector3(position3.x, position.y, position.z + 1f);
                        }
                        Vector3            injection    = vector;
                        RaigekiDamageModel attackDamage = _clsTorpedo.GetAttackDamage(attackTo.Index, (!isFriend) ? true : false);
                        int     key2      = (!attackDamage.GetProtectEffect(shipModel.TmpId)) ? attackTo.Index : 0;
                        float   num       = (!isFriend) ? (-20f) : 20f;
                        float   num2      = (attackDamage.GetHitState(shipModel.TmpId) != 0) ? 0f : (-3f);
                        Vector3 position4 = dictionary2[key2].transform.position;
                        _onesTorpedoWake = _instantiateTorpedo(target: new Vector3(position4.x + num2, position4.y, position4.z + num), injection: injection, index: i, _time: 2.65f, isDet: false, isMiss: false, isD: true);
                        _setCameraPosition(injection.x);
                        _straightTarget = position4;
                        Vector3 pointOfGaze = dictionary2[key2].pointOfGaze;
                        _straightTargetGazeY = pointOfGaze.y;
                        break;
                    }
                }
            }
            return((_onesTorpedoWake != null) ? true : false);
        }
Beispiel #2
0
        public void SetHpGauge()
        {
            BattleCutInEffectCamera cutInEffectCamera = BattleTaskManager.GetBattleCameras().cutInEffectCamera;

            if (BattleTaskManager.GetTorpedoHpGauges().UiPanel == null)
            {
                UIPanel uIPanel = Resources.Load <UIPanel>("Prefabs/Battle/UI/UICircleHpPanel");
                BattleTaskManager.GetTorpedoHpGauges().InstancePanel(uIPanel.gameObject, cutInEffectCamera.transform.gameObject);
            }
            else
            {
                BattleTaskManager.GetTorpedoHpGauges().UiPanel.alpha = 0f;
            }
            _dicIsCriticall = new Dictionary <FleetType, bool[]>();
            _dicIsMiss      = new Dictionary <FleetType, bool[]>();
            if (BattleTaskManager.GetTorpedoHpGauges().FHpGauge == null)
            {
                BattleTaskManager.GetTorpedoHpGauges().FHpGauge = new BattleHPGauges();
            }
            int[]  array  = new int[_fBattleship.Count];
            bool[] array2 = new bool[_fBattleship.Count];
            bool[] array3 = new bool[_fBattleship.Count];
            List <ShipModel_Defender> defenders = _clsRaigeki.GetDefenders(is_friend: true, all: true);

            for (int i = 0; i < _fBattleship.Count; i++)
            {
                BattleTaskManager.GetTorpedoHpGauges().FHpGauge.AddInstantiatesSafe(BattleTaskManager.GetTorpedoHpGauges().UiPanel.gameObject, isFriend: true, isLight: false, isT: true, isNumber: false, i);
                array[i]  = defenders[i].HpBefore;
                array2[i] = false;
                array3[i] = false;
            }
            _dicIsCriticall.Add(FleetType.Friend, array3);
            _dicIsMiss.Add(FleetType.Friend, array3);
            if (BattleTaskManager.GetTorpedoHpGauges().EHpGauge == null)
            {
                BattleTaskManager.GetTorpedoHpGauges().EHpGauge = new BattleHPGauges();
            }
            int[]  array4 = new int[_eBattleship.Count];
            bool[] array5 = new bool[_eBattleship.Count];
            bool[] array6 = new bool[_eBattleship.Count];
            List <ShipModel_Defender> defenders2 = _clsRaigeki.GetDefenders(is_friend: false, all: true);
            int count = _fBattleship.Count;

            for (int j = 0; j < _eBattleship.Count; j++)
            {
                BattleTaskManager.GetTorpedoHpGauges().EHpGauge.AddInstantiatesSafe(BattleTaskManager.GetTorpedoHpGauges().UiPanel.gameObject, isFriend: false, isLight: false, isT: true, isNumber: false, j);
                array4[j] = defenders2[j].HpBefore;
                array5[j] = false;
                array6[j] = false;
            }
            _dicIsCriticall.Add(FleetType.Enemy, array6);
            _dicIsMiss.Add(FleetType.Enemy, array6);
            for (int k = 0; k < _fBattleship.Count; k++)
            {
                int             damage = _clsRaigeki.GetAttackDamage(defenders[k].TmpId)?.GetDamage() ?? (-1);
                BattleHitStatus status = BattleHitStatus.Normal;
                if (_dicIsMiss[FleetType.Friend][k])
                {
                    status = BattleHitStatus.Miss;
                }
                if (_dicIsCriticall[FleetType.Friend][k])
                {
                    status = BattleHitStatus.Clitical;
                }
                BattleTaskManager.GetTorpedoHpGauges().FHpGauge.SetHp(k, defenders[k].MaxHp, array[k], defenders[k].HpAfter, damage, status, isFriend: false);
            }
            for (int l = 0; l < _eBattleship.Count; l++)
            {
                int             damage2 = _clsRaigeki.GetAttackDamage(defenders2[l].TmpId)?.GetDamage() ?? (-1);
                BattleHitStatus status2 = BattleHitStatus.Normal;
                if (_dicIsMiss[FleetType.Enemy][l])
                {
                    status2 = BattleHitStatus.Miss;
                }
                if (_dicIsCriticall[FleetType.Enemy][l])
                {
                    status2 = BattleHitStatus.Clitical;
                }
                BattleTaskManager.GetTorpedoHpGauges().EHpGauge.SetHp(l, defenders2[l].MaxHp, array4[l], defenders2[l].HpAfter, damage2, status2, isFriend: false);
            }
        }