Exemplo n.º 1
0
 private void OnGUI()
 {
     if (!GlobalVars.Instance.hideOurForcesNickname && MyInfoManager.Instance.isGuiOn && !MyInfoManager.Instance.IsSpectator)
     {
         GUI.skin    = GUISkinFinder.Instance.GetGUISkin();
         GUI.depth   = (int)guiDepth;
         GUI.enabled = !DialogManager.Instance.IsModal;
         GameObject[] array = BrickManManager.Instance.ToGameObjectArray();
         for (int i = 0; i < array.Length; i++)
         {
             Vector3 position = array[i].transform.position;
             position.y += 2f;
             PlayerProperty component = array[i].GetComponent <PlayerProperty>();
             if (null != component && !component.IsHostile() && !component.Desc.IsHidePlayer)
             {
                 Vector3 vector = cam.WorldToViewportPoint(position);
                 if (vector.z > 0f && 0f < vector.x && vector.x < 1f && 0f < vector.y && vector.y < 1f)
                 {
                     Vector3 vector2 = cam.WorldToScreenPoint(position);
                     LabelUtil.TextOut(new Vector2(vector2.x, (float)Screen.height - vector2.y - 20f), component.Desc.Nickname, "Label", Color.green, Color.black, TextAnchor.LowerCenter);
                 }
             }
         }
         GUI.enabled = true;
     }
 }
Exemplo n.º 2
0
 private void OnGUI()
 {
     if (mine != null)
     {
         foreach (KeyValuePair <int, PTT> item in mine)
         {
             Draw(item.Value.weapon, item.Value.pos, item.Value.range);
         }
     }
     GameObject[] array = BrickManManager.Instance.ToGameObjectArray();
     for (int i = 0; i < array.Length; i++)
     {
         PlayerProperty component = array[i].GetComponent <PlayerProperty>();
         if (null != component && component.IsHostile())
         {
             GdgtGrenade[] componentsInChildren = array[i].GetComponentsInChildren <GdgtGrenade>(includeInactive: true);
             if (componentsInChildren != null && componentsInChildren.Length > 0)
             {
                 Weapon.BY        weaponBY = componentsInChildren[0].GetWeaponBY();
                 ProjectileWrap[] array2   = componentsInChildren[0].ToProjectileWrap();
                 if (weaponBY != 0 && weaponBY != Weapon.BY.BLACKHOLE && array2 != null)
                 {
                     for (int j = 0; j < array2.Length; j++)
                     {
                         Draw(weaponBY, array2[j].targetPos, array2[j].range);
                     }
                 }
             }
             GdgtFlashBang[] componentsInChildren2 = array[i].GetComponentsInChildren <GdgtFlashBang>(includeInactive: true);
             if (componentsInChildren2 != null && componentsInChildren2.Length > 0)
             {
                 Weapon.BY        weaponBY2 = componentsInChildren2[0].GetWeaponBY();
                 ProjectileWrap[] array3    = componentsInChildren2[0].ToProjectileWrap();
                 if (weaponBY2 != 0 && weaponBY2 != Weapon.BY.BLACKHOLE && array3 != null)
                 {
                     for (int k = 0; k < array3.Length; k++)
                     {
                         Draw(weaponBY2, array3[k].targetPos, array3[k].range);
                     }
                 }
             }
             GdgtXmasBomb[] componentsInChildren3 = array[i].GetComponentsInChildren <GdgtXmasBomb>(includeInactive: true);
             if (componentsInChildren3 != null && componentsInChildren3.Length > 0)
             {
                 Weapon.BY        weaponBY3 = componentsInChildren3[0].GetWeaponBY();
                 ProjectileWrap[] array4    = componentsInChildren3[0].ToProjectileWrap();
                 if (weaponBY3 != 0 && weaponBY3 != Weapon.BY.BLACKHOLE && array4 != null)
                 {
                     for (int l = 0; l < array4.Length; l++)
                     {
                         Draw(weaponBY3, array4[l].targetPos, array4[l].range);
                     }
                 }
             }
         }
     }
 }
Exemplo n.º 3
0
 public void collideTest()
 {
     activeBeam();
     if (isBeamTest)
     {
         int layerMask = (1 << LayerMask.NameToLayer("BoxMan")) | (1 << LayerMask.NameToLayer("Mon"));
         realExplosion = false;
         if (Physics.Raycast(BeamRay, out RaycastHit hitInfo, rayRange, layerMask))
         {
             GameObject gameObject = hitInfo.transform.gameObject;
             if (gameObject.layer == LayerMask.NameToLayer("BoxMan"))
             {
                 PlayerProperty[] allComponents  = Recursively.GetAllComponents <PlayerProperty>(gameObject.transform, includeInactive: false);
                 PlayerProperty   playerProperty = null;
                 if (allComponents.Length != 1)
                 {
                     Debug.LogError("PlayerProperty should be unique for a box man, but it has multiple PlayerProperty components or non ");
                 }
                 if (allComponents.Length > 0)
                 {
                     playerProperty = allComponents[0];
                 }
                 if (playerProperty != null && !playerProperty.IsHostile())
                 {
                     return;
                 }
             }
             CheckBoxmen(vBomb);
             CheckMonster(vBomb);
             if (realExplosion)
             {
                 CheckDestructibles(vBomb);
                 if (!BuildOption.Instance.Props.useUskMuzzleEff || !applyUsk)
                 {
                     if (explosion != null)
                     {
                         Object.Instantiate((Object)explosion, vBomb, Quaternion.Euler(0f, 0f, 0f));
                     }
                 }
                 else if (GlobalVars.Instance.explosionUsk != null)
                 {
                     Object.Instantiate((Object)GlobalVars.Instance.explosionUsk, vBomb, Quaternion.Euler(0f, 0f, 0f));
                 }
                 detonating = false;
                 isBeamTest = false;
                 throwing   = false;
                 Object.DestroyImmediate(beamObj);
                 Object.DestroyImmediate(bombObj);
                 CSNetManager.Instance.Sock.SendCS_GADGET_ACTION_REQ(MyInfoManager.Instance.SenseBombSeq, -1);
             }
         }
     }
 }
 private void OnGUI()
 {
     if (!GlobalVars.Instance.hideEnemyForcesNickname && MyInfoManager.Instance.isGuiOn && !MyInfoManager.Instance.IsSpectator)
     {
         GUISkin skin = GUI.skin;
         GUI.skin    = GUISkinFinder.Instance.GetGUISkin();
         GUI.depth   = (int)guiDepth;
         GUI.enabled = !DialogManager.Instance.IsModal;
         GameObject[] array = BrickManManager.Instance.ToGameObjectArray();
         for (int i = 0; i < array.Length; i++)
         {
             Vector3 position = array[i].transform.position;
             position.y += 2f;
             Vector3 position2 = array[i].transform.position;
             position2.y += 1f;
             PlayerProperty component = array[i].GetComponent <PlayerProperty>();
             if (null != component && component.IsHostile() && !component.Desc.IsHidePlayer)
             {
                 bool flag = false;
                 if (enemy != null && enemy.Seq == component.Desc.Seq)
                 {
                     flag = true;
                 }
                 if (!flag && IsVisible(position2, component.Desc.Seq))
                 {
                     flag = true;
                 }
                 if (flag)
                 {
                     Vector3 vector = cam.WorldToViewportPoint(position);
                     if (vector.z > 0f && 0f < vector.x && vector.x < 1f && 0f < vector.y && vector.y < 1f)
                     {
                         Vector3 sp = cam.WorldToScreenPoint(position);
                         LabelUtil.TextOut(sp, component.Desc.Nickname, "Label", Color.red, Color.black, TextAnchor.LowerCenter);
                     }
                 }
             }
         }
         GUI.enabled = true;
         GUI.skin    = skin;
     }
 }
Exemplo n.º 5
0
 private void CheckSlash()
 {
     if (isValidRange)
     {
         int layerMask = (1 << LayerMask.NameToLayer("Chunk")) | (1 << LayerMask.NameToLayer("Brick")) | (1 << LayerMask.NameToLayer("BoxMan")) | (1 << LayerMask.NameToLayer("Mon")) | (1 << LayerMask.NameToLayer("InvincibleArmor")) | (1 << LayerMask.NameToLayer("Bomb")) | (1 << LayerMask.NameToLayer("InstalledBomb"));
         Ray ray       = cam.ScreenPointToRay(new Vector3((float)(Screen.width / 2), (float)(Screen.height / 2), 0f));
         if (Physics.Raycast(ray, out RaycastHit hitInfo, GetComponent <Weapon>().range, layerMask))
         {
             GameObject gameObject  = null;
             GameObject gameObject2 = hitInfo.transform.gameObject;
             if (gameObject2.layer == LayerMask.NameToLayer("Chunk") || gameObject2.layer == LayerMask.NameToLayer("Brick"))
             {
                 BrickProperty brickProperty = null;
                 GameObject    gameObject3   = null;
                 if (gameObject2.layer == LayerMask.NameToLayer("Brick"))
                 {
                     BrickProperty[] allComponents = Recursively.GetAllComponents <BrickProperty>(gameObject2.transform, includeInactive: false);
                     if (allComponents.Length > 0)
                     {
                         brickProperty = allComponents[0];
                     }
                 }
                 else
                 {
                     gameObject = BrickManager.Instance.GetBrickObjectByPos(Brick.ToBrickCoord(hitInfo.normal, hitInfo.point));
                     if (null != gameObject)
                     {
                         brickProperty = gameObject.GetComponent <BrickProperty>();
                     }
                 }
                 if (null != brickProperty)
                 {
                     P2PManager.Instance.SendPEER_HIT_BRICK(brickProperty.Seq, brickProperty.Index, hitInfo.point, hitInfo.normal, isBullet: false);
                     gameObject3 = BrickManager.Instance.GetBulletImpact(brickProperty.Index);
                     Brick brick = BrickManager.Instance.GetBrick(brickProperty.Index);
                     if (brick != null && brick.destructible)
                     {
                         brickProperty.Hit((int)CalcAtkPow());
                         if (brickProperty.HitPoint <= 0)
                         {
                             if (!Application.loadedLevelName.Contains("Tutor"))
                             {
                                 CSNetManager.Instance.Sock.SendCS_DESTROY_BRICK_REQ(brickProperty.Seq);
                             }
                             gameObject3 = null;
                             if (brickProperty.Index == 115 || brickProperty.Index == 193)
                             {
                                 CheckMyself(gameObject.transform.position, GlobalVars.Instance.BoomRadius);
                                 CheckBoxmen(gameObject.transform.position, GlobalVars.Instance.BoomRadius);
                                 CheckMonster(gameObject.transform.position, GlobalVars.Instance.BoomRadius);
                                 CheckDestructibles(gameObject.transform.position, GlobalVars.Instance.BoomRadius);
                             }
                         }
                         else
                         {
                             P2PManager.Instance.SendPEER_BRICK_HITPOINT(brickProperty.Seq, brickProperty.HitPoint);
                         }
                     }
                 }
                 if (null != gameObject3)
                 {
                     Object.Instantiate((Object)gameObject3, hitInfo.point, Quaternion.FromToRotation(Vector3.up, hitInfo.normal));
                 }
             }
             else if (gameObject2.layer == LayerMask.NameToLayer("BoxMan"))
             {
                 PlayerProperty[] allComponents2 = Recursively.GetAllComponents <PlayerProperty>(gameObject2.transform, includeInactive: false);
                 TPController[]   allComponents3 = Recursively.GetAllComponents <TPController>(gameObject2.transform, includeInactive: false);
                 if (allComponents2.Length != 1)
                 {
                     Debug.LogError("PlayerProperty should be unique for a box man, but it has multiple PlayerProperty components or non ");
                 }
                 if (allComponents3.Length != 1)
                 {
                     Debug.LogError("TPController should be unique for a box man, but it has multiple TPController components or non ");
                 }
                 PlayerProperty playerProperty = null;
                 TPController   tPController   = null;
                 if (allComponents2.Length > 0)
                 {
                     playerProperty = allComponents2[0];
                 }
                 if (allComponents3.Length > 0)
                 {
                     tPController = allComponents3[0];
                 }
                 if (playerProperty != null && tPController != null)
                 {
                     int     num       = 0;
                     HitPart component = gameObject2.GetComponent <HitPart>();
                     if (component != null)
                     {
                         if (component.GetHitImpact() != null)
                         {
                             Object.Instantiate((Object)component.GetHitImpact(), hitInfo.point, Quaternion.Euler(0f, 0f, 0f));
                         }
                         num = (int)(CalcAtkPow() * component.damageFactor);
                         if (!playerProperty.IsHostile())
                         {
                             num = 0;
                         }
                         WeaponFunction component2 = GetComponent <WeaponFunction>();
                         if (null == component2)
                         {
                             Debug.LogError("wpnFunc == nulll");
                         }
                         TWeapon tWeapon = (TWeapon)GetComponent <Weapon>().tItem;
                         if (tWeapon == null)
                         {
                             Debug.LogError("wpn == null");
                         }
                         Item item = MyInfoManager.Instance.GetItemBySequence(component2.ItemSeq);
                         if (item == null)
                         {
                             item = MyInfoManager.Instance.GetUsingEquipByCode(tWeapon.code);
                         }
                         num = GlobalVars.Instance.applyDurabilityDamage(item?.Durability ?? (-1), tWeapon.durabilityMax, num);
                         P2PManager.Instance.SendPEER_HIT_BRICKMAN(MyInfoManager.Instance.Seq, playerProperty.Desc.Seq, (int)component.part, hitInfo.point, hitInfo.normal, lucky: false, 0, ray.direction);
                         P2PManager.Instance.SendPEER_PIERCE(MyInfoManager.Instance.Seq, playerProperty.Desc.Seq, num, Rigidity, (int)weaponBy);
                     }
                     tPController.GetHit(num, playerProperty.Desc.Seq);
                 }
             }
             else if (gameObject2.layer == LayerMask.NameToLayer("Mon"))
             {
                 MonProperty[] allComponents4 = Recursively.GetAllComponents <MonProperty>(gameObject2.transform, includeInactive: false);
                 MonProperty   monProperty    = null;
                 if (allComponents4.Length > 0)
                 {
                     monProperty = allComponents4[0];
                 }
                 if (monProperty != null)
                 {
                     HitPart component3 = gameObject2.GetComponent <HitPart>();
                     if (component3 != null)
                     {
                         if ((MyInfoManager.Instance.Slot < 4 && monProperty.Desc.bRedTeam) || (MyInfoManager.Instance.Slot >= 4 && !monProperty.Desc.bRedTeam))
                         {
                             return;
                         }
                         if (component3.GetHitImpact() != null)
                         {
                             Object.Instantiate((Object)component3.GetHitImpact(), hitInfo.point, Quaternion.Euler(0f, 0f, 0f));
                         }
                         if (monProperty.Desc.Xp <= 0)
                         {
                             return;
                         }
                         int num2 = (int)(CalcAtkPow() * component3.damageFactor);
                         if (monProperty.Desc.bHalfDamage)
                         {
                             num2 /= 2;
                         }
                         MonManager.Instance.Hit(monProperty.Desc.Seq, num2, 0f, (int)weaponBy, Vector3.zero, Vector3.zero, -1);
                     }
                 }
             }
             else if (gameObject2.layer == LayerMask.NameToLayer("InvincibleArmor") || gameObject2.layer == LayerMask.NameToLayer("Bomb") || gameObject2.layer == LayerMask.NameToLayer("InstalledBomb"))
             {
                 GameObject impact = VfxOptimizer.Instance.GetImpact(gameObject2.layer);
                 if (null != impact)
                 {
                     Object.Instantiate((Object)impact, hitInfo.point, Quaternion.FromToRotation(Vector3.up, hitInfo.normal));
                     P2PManager.Instance.SendPEER_HIT_IMPACT(gameObject2.layer, hitInfo.point, hitInfo.normal);
                 }
             }
             isValidRange = false;
         }
     }
 }
    private void Shoot()
    {
        Vector2 vector    = accuracy.CalcDeflection();
        int     layerMask = (1 << LayerMask.NameToLayer("Chunk")) | (1 << LayerMask.NameToLayer("Brick")) | (1 << LayerMask.NameToLayer("BoxMan")) | (1 << LayerMask.NameToLayer("Mon")) | (1 << LayerMask.NameToLayer("InvincibleArmor")) | (1 << LayerMask.NameToLayer("Bomb")) | (1 << LayerMask.NameToLayer("InstalledBomb"));
        Ray     ray       = cam.ScreenPointToRay(new Vector3(vector.x, vector.y, 0f));

        if (!Application.loadedLevelName.Contains("Tutor"))
        {
            P2PManager.Instance.SendPEER_CANNON_FIRE(BrickSeq, shooter, ray.origin, ray.direction);
        }
        if (Physics.Raycast(ray, out RaycastHit hitInfo, Range, layerMask))
        {
            GameObject gameObject = hitInfo.transform.gameObject;
            if (gameObject.layer == LayerMask.NameToLayer("Brick") || gameObject.layer == LayerMask.NameToLayer("Chunk"))
            {
                GameObject    gameObject2   = null;
                BrickProperty brickProperty = null;
                GameObject    original      = null;
                Texture2D     mark          = null;
                if (gameObject.layer == LayerMask.NameToLayer("Brick"))
                {
                    BrickProperty[] allComponents = Recursively.GetAllComponents <BrickProperty>(gameObject.transform, includeInactive: false);
                    if (allComponents.Length > 0)
                    {
                        brickProperty = allComponents[0];
                    }
                }
                else
                {
                    gameObject2 = BrickManager.Instance.GetBrickObjectByPos(Brick.ToBrickCoord(hitInfo.normal, hitInfo.point));
                    if (null != gameObject2)
                    {
                        brickProperty = gameObject2.GetComponent <BrickProperty>();
                    }
                }
                if (null != brickProperty)
                {
                    P2PManager.Instance.SendPEER_HIT_BRICK(brickProperty.Seq, brickProperty.Index, hitInfo.point, hitInfo.normal, isBullet: true);
                    mark     = BrickManager.Instance.GetBulletMark(brickProperty.Index);
                    original = BrickManager.Instance.GetBulletImpact(brickProperty.Index);
                    Brick brick = BrickManager.Instance.GetBrick(brickProperty.Index);
                    if (brick != null && brick.destructible)
                    {
                        brickProperty.Hit((int)AtkPow);
                        if (brickProperty.HitPoint <= 0)
                        {
                            CSNetManager.Instance.Sock.SendCS_DESTROY_BRICK_REQ(brickProperty.Seq);
                            mark     = null;
                            original = null;
                            if (brickProperty.Index == 115 || brickProperty.Index == 193)
                            {
                                ExplosionUtil.CheckMyself(gameObject2.transform.position, GlobalVars.Instance.BoomDamage, GlobalVars.Instance.BoomRadius, -3);
                                ExplosionUtil.CheckBoxmen(gameObject2.transform.position, GlobalVars.Instance.BoomDamage, GlobalVars.Instance.BoomRadius, -3, Rigidity);
                                ExplosionUtil.CheckMonster(gameObject2.transform.position, GlobalVars.Instance.BoomDamage, GlobalVars.Instance.BoomRadius);
                                ExplosionUtil.CheckDestructibles(gameObject2.transform.position, GlobalVars.Instance.BoomDamage, GlobalVars.Instance.BoomRadius);
                            }
                        }
                        else
                        {
                            P2PManager.Instance.SendPEER_BRICK_HITPOINT(brickProperty.Seq, brickProperty.HitPoint);
                        }
                    }
                }
                if (null != gameObject2 && null != mark)
                {
                    GameObject gameObject3 = Object.Instantiate((Object)BrickManager.Instance.bulletMark, hitInfo.point, Quaternion.FromToRotation(Vector3.forward, -hitInfo.normal)) as GameObject;
                    BulletMark component   = gameObject3.GetComponent <BulletMark>();
                    component.GenerateDecal(mark, gameObject, gameObject2);
                }
                if (null != original)
                {
                    Object.Instantiate((Object)original, hitInfo.point, Quaternion.FromToRotation(Vector3.up, hitInfo.normal));
                }
            }
            else if (gameObject.layer == LayerMask.NameToLayer("BoxMan"))
            {
                PlayerProperty[] allComponents2 = Recursively.GetAllComponents <PlayerProperty>(gameObject.transform, includeInactive: false);
                TPController[]   allComponents3 = Recursively.GetAllComponents <TPController>(gameObject.transform, includeInactive: false);
                if (allComponents2.Length != 1)
                {
                    Debug.LogError("PlayerProperty should be unique for a box man, but it has multiple PlayerProperty components or non ");
                }
                if (allComponents3.Length != 1)
                {
                    Debug.LogError("TPController should be unique for a box man, but it has multiple TPController components or non ");
                }
                PlayerProperty playerProperty = null;
                TPController   tPController   = null;
                if (allComponents2.Length > 0)
                {
                    playerProperty = allComponents2[0];
                }
                if (allComponents3.Length > 0)
                {
                    tPController = allComponents3[0];
                }
                if (playerProperty != null && tPController != null)
                {
                    int     num        = 0;
                    HitPart component2 = gameObject.GetComponent <HitPart>();
                    if (component2 != null)
                    {
                        bool flag = false;
                        if (component2.part == HitPart.TYPE.HEAD)
                        {
                            int layerMask2 = 1 << LayerMask.NameToLayer("Brain");
                            if (Physics.Raycast(ray, out RaycastHit hitInfo2, Range, layerMask2))
                            {
                                if (playerProperty.Desc.IsLucky())
                                {
                                    flag = true;
                                }
                                else
                                {
                                    component2 = hitInfo2.transform.gameObject.GetComponent <HitPart>();
                                }
                            }
                        }
                        if (component2.GetHitImpact() != null)
                        {
                            GameObject original2 = component2.GetHitImpact();
                            if (flag && null != component2.luckyImpact)
                            {
                                original2 = component2.luckyImpact;
                            }
                            Object.Instantiate((Object)original2, hitInfo.point, Quaternion.Euler(0f, 0f, 0f));
                        }
                        num = (int)(AtkPow * component2.damageFactor);
                        if (!playerProperty.IsHostile())
                        {
                            num = 0;
                        }
                        P2PManager.Instance.SendPEER_HIT_BRICKMAN(MyInfoManager.Instance.Seq, playerProperty.Desc.Seq, (int)component2.part, hitInfo.point, hitInfo.normal, flag, 0, ray.direction);
                        P2PManager.Instance.SendPEER_SHOOT(MyInfoManager.Instance.Seq, playerProperty.Desc.Seq, num, Rigidity, (int)weaponBy, (int)component2.part, flag, rateOfFire);
                    }
                    tPController.GetHit(num, playerProperty.Desc.Seq);
                }
            }
            else if (gameObject.layer == LayerMask.NameToLayer("Mon"))
            {
                MonProperty[] allComponents4 = Recursively.GetAllComponents <MonProperty>(gameObject.transform, includeInactive: false);
                MonProperty   monProperty    = null;
                if (allComponents4.Length > 0)
                {
                    monProperty = allComponents4[0];
                }
                if (monProperty != null)
                {
                    HitPart component3 = gameObject.GetComponent <HitPart>();
                    if (component3 != null && (MyInfoManager.Instance.Slot >= 4 || !monProperty.Desc.bRedTeam) && (MyInfoManager.Instance.Slot < 4 || monProperty.Desc.bRedTeam))
                    {
                        if (component3.GetHitImpact() != null)
                        {
                            Object.Instantiate((Object)component3.GetHitImpact(), hitInfo.point, Quaternion.Euler(0f, 0f, 0f));
                        }
                        if (monProperty.Desc.Xp > 0)
                        {
                            int num2 = (int)(AtkPow * component3.damageFactor);
                            num2 += DefenseManager.Instance.AddAtkPower;
                            if (monProperty.Desc.bHalfDamage)
                            {
                                num2 /= 2;
                            }
                            MonManager.Instance.Hit(monProperty.Desc.Seq, num2, 0f, (int)weaponBy, hitInfo.point, hitInfo.normal, -1);
                        }
                    }
                }
            }
            else if (gameObject.layer == LayerMask.NameToLayer("InvincibleArmor") || gameObject.layer == LayerMask.NameToLayer("Bomb") || gameObject.layer == LayerMask.NameToLayer("InstalledBomb"))
            {
                GameObject impact = VfxOptimizer.Instance.GetImpact(gameObject.layer);
                if (null != impact)
                {
                    Object.Instantiate((Object)impact, hitInfo.point, Quaternion.FromToRotation(Vector3.up, hitInfo.normal));
                    P2PManager.Instance.SendPEER_HIT_IMPACT(gameObject.layer, hitInfo.point, hitInfo.normal);
                }
            }
        }
    }
Exemplo n.º 7
0
 private void Update()
 {
     deltaTime += Time.deltaTime;
     if (deltaTime > lifeTime)
     {
         Object.Destroy(base.transform.gameObject);
     }
     else if (deltaTime > smokeeTime)
     {
         ParticleEmitter[] componentsInChildren = GetComponentsInChildren <ParticleEmitter>();
         for (int i = 0; i < componentsInChildren.Length; i++)
         {
             componentsInChildren[i].maxEmission = 0f;
             componentsInChildren[i].minEmission = 0f;
         }
     }
     if (bOwn && ApplyDotDamage)
     {
         deltaTimeDot += Time.deltaTime;
         if (deltaTimeDot >= 1f)
         {
             deltaTimeDot = 0f;
             float             num = -9999f;
             ParticleEmitter[] componentsInChildren2 = base.gameObject.GetComponentsInChildren <ParticleEmitter>();
             for (int j = 0; j < componentsInChildren2.Length; j++)
             {
                 if (num < componentsInChildren2[j].maxSize)
                 {
                     num = componentsInChildren2[j].maxSize;
                 }
             }
             float num2 = 9999f;
             componentsInChildren2 = base.gameObject.GetComponentsInChildren <ParticleEmitter>();
             for (int k = 0; k < componentsInChildren2.Length; k++)
             {
                 if (num2 > componentsInChildren2[k].minSize)
                 {
                     num2 = componentsInChildren2[k].minSize;
                 }
             }
             if (num > 0f)
             {
                 float      num3       = (num + num2) * 0.25f;
                 GameObject gameObject = GameObject.Find("Me");
                 if (null != gameObject)
                 {
                     float num4 = Vector3.Distance(base.transform.position, gameObject.transform.position);
                     if (num4 < num3)
                     {
                         LocalController component = gameObject.GetComponent <LocalController>();
                         if (component != null)
                         {
                             component.GetHit(MyInfoManager.Instance.Seq, dotDamage, 0f, (int)weaponBy, -1, autoHealPossible: true, checkZombie: false);
                         }
                     }
                 }
                 GameObject[] array = BrickManManager.Instance.ToGameObjectArray();
                 for (int l = 0; l < array.Length; l++)
                 {
                     PlayerProperty component2 = array[l].GetComponent <PlayerProperty>();
                     if (component2 != null && component2.IsHostile())
                     {
                         float num5 = Vector3.Distance(base.transform.position, array[l].transform.position);
                         if (num5 < num3)
                         {
                             P2PManager.Instance.SendPEER_BOMBED(MyInfoManager.Instance.Seq, component2.Desc.Seq, dotDamage, 0f, (int)weaponBy);
                         }
                     }
                 }
             }
         }
     }
 }
Exemplo n.º 8
0
 private void OnGUI()
 {
     if (MyInfoManager.Instance.isGuiOn && isVisible)
     {
         GUI.skin    = GUISkinFinder.Instance.GetGUISkin();
         GUI.depth   = (int)guiDepth;
         GUI.enabled = !DialogManager.Instance.IsModal;
         GUI.BeginGroup(new Rect(0f, 0f, (float)bkgnd.width, (float)bkgnd.height));
         TextureUtil.DrawTexture(new Rect(0f, 0f, (float)bkgnd.width, (float)bkgnd.height), bkgnd);
         if (null != cameraController)
         {
             Vector2 center      = new Vector2((float)(bkgnd.width / 2), (float)(bkgnd.height / 2));
             Vector3 position    = cameraController.transform.position;
             Vector3 toDirection = cameraController.transform.TransformDirection(Vector3.forward);
             toDirection.y = 0f;
             toDirection   = toDirection.normalized;
             Quaternion   rotation = Quaternion.FromToRotation(Vector3.forward, toDirection);
             GameObject[] array    = BrickManManager.Instance.ToGameObjectArray();
             for (int i = 0; i < array.Length; i++)
             {
                 TPController   component  = array[i].GetComponent <TPController>();
                 PlayerProperty component2 = array[i].GetComponent <PlayerProperty>();
                 if (null != component2 && null != component && !component2.IsHostile() && component2.Desc.Status == 4 && !component2.Desc.IsHidePlayer)
                 {
                     Vector3 vector  = Quaternion.Inverse(rotation) * (component2.transform.position - position);
                     Vector2 a       = new Vector2(vector.x, vector.z);
                     Vector2 vector2 = hudRadius / radarRadius * a;
                     vector2.y = -1f * vector2.y;
                     if (Vector2.Distance(vector2, Vector2.zero) > hudRadius)
                     {
                         vector2 = hudRadius * vector2.normalized;
                     }
                     if (dicRadioSenders.ContainsKey(component2.Desc.Seq))
                     {
                         float signalStrength = dicRadioSenders[component2.Desc.Seq].GetSignalStrength();
                         if (signalStrength > 0f)
                         {
                             DrawSignal(center, vector2, signalStrength);
                         }
                     }
                     DrawPin(component.IsDead, center, vector2);
                 }
             }
             Trigger[] enabledScriptables = BrickManager.Instance.GetEnabledScriptables();
             for (int j = 0; j < enabledScriptables.Length; j++)
             {
                 Vector3 vector3 = Quaternion.Inverse(rotation) * (enabledScriptables[j].transform.position - position);
                 Vector2 a2      = new Vector2(vector3.x, vector3.z);
                 Vector2 vector4 = hudRadius / radarRadius * a2;
                 vector4.y = -1f * vector4.y;
                 if (Vector2.Distance(vector4, Vector2.zero) > hudRadius)
                 {
                     vector4 = hudRadius * vector4.normalized;
                 }
                 DrawPin(isDead: false, center, vector4);
             }
             if (RoomManager.Instance.CurrentRoomType == Room.ROOM_TYPE.CAPTURE_THE_FLAG && BrickManager.Instance.userMap != null)
             {
                 SpawnerDesc spawner = BrickManager.Instance.userMap.GetSpawner(Brick.SPAWNER_TYPE.RED_FLAG_SPAWNER, 0);
                 if (spawner != null)
                 {
                     Vector3 vector5 = Quaternion.Inverse(rotation) * (spawner.position - position);
                     Vector2 a3      = new Vector2(vector5.x, vector5.z);
                     Vector2 vector6 = hudRadius / radarRadius * a3;
                     vector6.y = -1f * vector6.y;
                     if (Vector2.Distance(vector6, Vector2.zero) > hudRadius)
                     {
                         vector6 = hudRadius * vector6.normalized;
                     }
                     DrawFlagR(isDead: false, center, vector6);
                 }
                 spawner = BrickManager.Instance.userMap.GetSpawner(Brick.SPAWNER_TYPE.BLUE_FLAG_SPAWNER, 0);
                 if (spawner != null)
                 {
                     Vector3 vector7 = Quaternion.Inverse(rotation) * (spawner.position - position);
                     Vector2 a4      = new Vector2(vector7.x, vector7.z);
                     Vector2 vector8 = hudRadius / radarRadius * a4;
                     vector8.y = -1f * vector8.y;
                     if (Vector2.Distance(vector8, Vector2.zero) > hudRadius)
                     {
                         vector8 = hudRadius * vector8.normalized;
                     }
                     DrawFlagB(isDead: false, center, vector8);
                 }
                 if (BrickManManager.Instance.haveFlagSeq < 0)
                 {
                     Vector3 vector9  = Quaternion.Inverse(rotation) * (BrickManManager.Instance.vFlag - position);
                     Vector2 a5       = new Vector2(vector9.x, vector9.z);
                     Vector2 vector10 = hudRadius / radarRadius * a5;
                     vector10.y = -1f * vector10.y;
                     if (Vector2.Distance(vector10, Vector2.zero) > hudRadius)
                     {
                         vector10 = hudRadius * vector10.normalized;
                     }
                     DrawFlag(isDead: false, center, vector10);
                 }
             }
             if (RoomManager.Instance.CurrentRoomType == Room.ROOM_TYPE.EXPLOSION)
             {
                 for (int k = 0; k < 2; k++)
                 {
                     if (BrickManager.Instance.userMap != null)
                     {
                         SpawnerDesc spawner2 = BrickManager.Instance.userMap.GetSpawner(Brick.SPAWNER_TYPE.BOMB_SPAWNER, k);
                         if (spawner2 != null)
                         {
                             Vector3 vector11 = Quaternion.Inverse(rotation) * (spawner2.position - position);
                             Vector2 a6       = new Vector2(vector11.x, vector11.z);
                             Vector2 vector12 = hudRadius / radarRadius * a6;
                             vector12.y = -1f * vector12.y;
                             if (Vector2.Distance(vector12, Vector2.zero) > hudRadius)
                             {
                                 vector12 = hudRadius * vector12.normalized;
                             }
                             DrawBomb(blastTarget[k], center, vector12);
                         }
                     }
                 }
             }
             if (heartBeatTime < heartBeatMax && showHeartBeat)
             {
                 GameObject[] array2 = BrickManManager.Instance.ToGameObjectArray();
                 for (int l = 0; l < array2.Length; l++)
                 {
                     TPController   component3 = array2[l].GetComponent <TPController>();
                     PlayerProperty component4 = array2[l].GetComponent <PlayerProperty>();
                     if (null != component4 && null != component3 && component4.IsHostile() && !component3.IsDead && component4.Desc.Status == 4 && !component4.Desc.IsHidePlayer)
                     {
                         Vector3 vector13 = Quaternion.Inverse(rotation) * (component4.transform.position - position);
                         Vector2 a7       = new Vector2(vector13.x, vector13.z);
                         Vector2 vector14 = hudRadius / radarRadius * a7;
                         vector14.y = -1f * vector14.y;
                         if (Vector2.Distance(vector14, Vector2.zero) > hudRadius)
                         {
                             vector14 = hudRadius * vector14.normalized;
                         }
                         DrawEnemy(center, vector14);
                     }
                 }
             }
         }
         DrawConcentric();
         GUI.EndGroup();
         GUI.enabled = true;
     }
 }