Ejemplo n.º 1
0
 private void CheckLevelUpPlayer()
 {
     dicLeveler = new Dictionary <int, int>();
     for (int i = 0; i < RoomManager.Instance.RU.Length; i++)
     {
         int level  = XpManager.Instance.GetLevel(RoomManager.Instance.RU[i].prevXp);
         int level2 = XpManager.Instance.GetLevel(RoomManager.Instance.RU[i].nextXp);
         if (level2 > level)
         {
             GameObject gameObject = BrickManManager.Instance.Get(RoomManager.Instance.RU[i].seq);
             if (null != gameObject)
             {
                 dicLeveler.Add(RoomManager.Instance.RU[i].seq, level2);
                 TPController component = gameObject.GetComponent <TPController>();
                 if (null != component)
                 {
                     component.Congratulation();
                 }
             }
             if (RoomManager.Instance.RU[i].seq == MyInfoManager.Instance.Seq)
             {
                 if (!BuildOption.Instance.IsInfernum && BuildOption.Instance.Props.useLevelupCompensation)
                 {
                     ((LevelUpDlg)DialogManager.Instance.Popup(DialogManager.DIALOG_INDEX.LEVELUP, exclusive: true))?.InitDialog(level, level2);
                 }
                 MyInfoManager.Instance.EnResultEvent(MyInfoManager.RESULT_EVENT.LEVEL_UP);
                 CSNetManager.Instance.Sock.SendCS_LEVELUP_EVENT_REQ();
             }
         }
     }
 }
Ejemplo n.º 2
0
 private void CheckBoxmen()
 {
     HitPart[] array = ExplosionUtil.CheckBoxmen(base.transform.position, radius, includeFriendly: false);
     for (int i = 0; i < array.Length; i++)
     {
         PlayerProperty[] allComponents = Recursively.GetAllComponents <PlayerProperty>(array[i].transform, includeInactive: false);
         if (allComponents.Length == 1)
         {
             int num = Mathf.FloorToInt(array[i].damageFactor * CalcPowFrom(array[i].transform.position));
             if (num > 0)
             {
                 num = GlobalVars.Instance.applyDurabilityDamage(durability, durabilityMax, num);
                 allComponents[0].Desc.accumDamaged += num;
             }
         }
     }
     GameObject[] array2 = BrickManManager.Instance.ToGameObjectArray();
     for (int j = 0; j < array2.Length; j++)
     {
         int          num2      = (int)weaponBy;
         TPController component = array2[j].GetComponent <TPController>();
         if (component != null && !MyInfoManager.Instance.IsBelow12() && component.IsChild)
         {
             num2 = (int)weaponByForChild;
         }
         PlayerProperty component2 = array2[j].GetComponent <PlayerProperty>();
         if (null != component2 && component2.Desc.accumDamaged > 0)
         {
             P2PManager.Instance.SendPEER_BOMBED(MyInfoManager.Instance.Seq, component2.Desc.Seq, component2.Desc.accumDamaged, rigidity, num2);
             component2.Desc.accumDamaged = 0;
         }
     }
 }
Ejemplo n.º 3
0
    public static SEND_PACKET_LEVEL checkHITMAN(GameObject hitman, GameObject thirdPlayer, Vector3 myPos)
    {
        if (hitman == null || thirdPlayer == null)
        {
            return(SEND_PACKET_LEVEL.NONE);
        }
        TPController component = thirdPlayer.GetComponent <TPController>();

        if ((bool)component)
        {
            myPos.y += 1.2f;
            float num  = Vector3.Distance(myPos, component.transform.position);
            bool  flag = false;
            if (num < inputMinDistance)
            {
                flag = true;
            }
            bool flag2 = false;
            if (num > inputMaxDistance)
            {
                flag2 = true;
            }
            if (flag)
            {
                return(SEND_PACKET_LEVEL.ALL);
            }
            if (flag2)
            {
                return(SEND_PACKET_LEVEL.NONE);
            }
            Camera[] componentsInChildren = thirdPlayer.GetComponentsInChildren <Camera>();
            if (componentsInChildren.Length > 0)
            {
                camera               = componentsInChildren[0];
                camera.fieldOfView   = 75f;
                camera.nearClipPlane = 0.3f;
                camera.farClipPlane  = 1000f;
            }
            camera.enabled = true;
            Vector3 position  = thirdPlayer.transform.position;
            float   x         = position.x;
            Vector3 position2 = thirdPlayer.transform.position;
            float   y         = position2.y + 1.2f;
            Vector3 position3 = thirdPlayer.transform.position;
            Vector3 position4 = new Vector3(x, y, position3.z);
            camera.transform.position = position4;
            camera.transform.rotation = thirdPlayer.transform.rotation;
            Plane[] planes = GeometryUtility.CalculateFrustumPlanes(camera);
            if (GeometryUtility.TestPlanesAABB(planes, hitman.collider.bounds))
            {
                camera.enabled = false;
                return(SEND_PACKET_LEVEL.ALL);
            }
            camera.enabled = false;
            return(SEND_PACKET_LEVEL.EXCEPT_EFFECT);
        }
        return(SEND_PACKET_LEVEL.ALL);
    }
Ejemplo n.º 4
0
	// Use this when the object is created
	private void Awake ()
	{
		transportando = false;

		//Inicializamos el componente CharacterController
		//Inicializamos la variable instancia
		characterController = GetComponent<CharacterController>(); 
		instance = this;
		SetState(State.Normal);

		//creamos o buscamos una camara
		TPCamera.UseExistingOrCreateMainCamera();
	}
Ejemplo n.º 5
0
    // Use this when the object is created
    private void Awake()
    {
        transportando = false;

        //Inicializamos el componente CharacterController
        //Inicializamos la variable instancia
        characterController = GetComponent <CharacterController>();
        instance            = this;
        SetState(State.Normal);

        //creamos o buscamos una camara
        TPCamera.UseExistingOrCreateMainCamera();
    }
 public void ClearAllInvisibility()
 {
     foreach (KeyValuePair <int, BrickManDesc> item in dicDescriptor)
     {
         BrickManDesc value      = item.Value;
         GameObject   gameObject = Instance.Get(item.Key);
         if (gameObject != null && value != null)
         {
             TPController component = gameObject.GetComponent <TPController>();
             if (null != component && !component.IsLocallyControlled)
             {
                 value.IsInvisibilityOn = false;
             }
         }
     }
 }
    public void Remove(int seq)
    {
        GameObject gameObject = Get(seq);

        if (gameObject != null)
        {
            LetMeKnowABrickManIsBeingRemoved(gameObject);
            Camera[] componentsInChildren = gameObject.GetComponentsInChildren <Camera>();
            if (componentsInChildren != null)
            {
                for (int i = 0; i < componentsInChildren.Length; i++)
                {
                    if (null != componentsInChildren[i])
                    {
                        componentsInChildren[i].enabled = false;
                        if (null != componentsInChildren[i].targetTexture)
                        {
                            freeOverlayQ.Enqueue(componentsInChildren[i].targetTexture);
                        }
                    }
                }
            }
            TPController component = gameObject.GetComponent <TPController>();
            if (component != null)
            {
                component.destroyCongratulation();
            }
            PlayerProperty componentInChildren = gameObject.GetComponentInChildren <PlayerProperty>();
            if (null != componentInChildren)
            {
                freeInvisiblePositionQ.Enqueue(componentInChildren.InvisiblePosition);
            }
            InvincibleArmor component2 = gameObject.GetComponent <InvincibleArmor>();
            if (null != component2)
            {
                component2.Destroy();
            }
            Object.Destroy(gameObject);
            dicBrickMan.Remove(seq);
        }
        if (dicDescriptor.ContainsKey(seq))
        {
            dicDescriptor.Remove(seq);
        }
    }
Ejemplo n.º 8
0
 private void EmotionalAct()
 {
     for (int i = 0; i < RoomManager.Instance.RU.Length; i++)
     {
         GameObject gameObject = BrickManManager.Instance.Get(RoomManager.Instance.RU[i].seq);
         if (null != gameObject)
         {
             TPController component = gameObject.GetComponent <TPController>();
             if (null != component)
             {
                 string empty = string.Empty;
                 float  num   = (float)i / (float)RoomManager.Instance.RU.Length;
                 empty = ((num < 0.2f) ? grade1st[UnityEngine.Random.Range(0, grade1st.Length)] : ((!(num < 0.6f)) ? grade3rd[UnityEngine.Random.Range(0, grade3rd.Length)] : grade2nd[UnityEngine.Random.Range(0, grade2nd.Length)]));
                 component.EmotionalAct(empty);
             }
         }
     }
 }
Ejemplo n.º 9
0
    public static SEND_PACKET_LEVEL checkSendMove(GameObject player, Vector3 myPos, Bounds bounds)
    {
        if (null == player)
        {
            return(SEND_PACKET_LEVEL.NONE);
        }
        TPController component = player.GetComponent <TPController>();

        if ((bool)component)
        {
            if (IsMyCamIn(player.collider.bounds))
            {
                return(SEND_PACKET_LEVEL.ALL);
            }
            Vector3  position             = component.transform.position;
            float    x                    = position.x;
            Vector3  position2            = component.transform.position;
            float    y                    = position2.y + 1.2f;
            Vector3  position3            = component.transform.position;
            Vector3  position4            = new Vector3(x, y, position3.z);
            Camera[] componentsInChildren = player.GetComponentsInChildren <Camera>();
            if (componentsInChildren.Length > 0)
            {
                camera               = componentsInChildren[0];
                camera.fieldOfView   = 60f;
                camera.nearClipPlane = 0.3f;
                camera.farClipPlane  = 1000f;
            }
            camera.transform.position = position4;
            camera.transform.rotation = component.transform.rotation;
            Plane[] planes = GeometryUtility.CalculateFrustumPlanes(camera);
            if (GeometryUtility.TestPlanesAABB(planes, bounds))
            {
                camera.enabled = false;
                return(SEND_PACKET_LEVEL.ALL);
            }
            camera.enabled = false;
            return(SEND_PACKET_LEVEL.NONE);
        }
        return(SEND_PACKET_LEVEL.ALL);
    }
Ejemplo n.º 10
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;
         }
     }
 }
Ejemplo n.º 11
0
    public static SEND_PACKET_LEVEL check3rdPersonSendOrNoSend(GameObject player, Vector3 shootpos, Vector3 hitpoint, Vector3 shootdir, Vector3 hitnormal, int brickSeq, float range, bool possibleCan)
    {
        if (null == player)
        {
            return(SEND_PACKET_LEVEL.NONE);
        }
        int           layerMask     = (1 << LayerMask.NameToLayer("Chunk")) | (1 << LayerMask.NameToLayer("Brick"));
        GameObject    gameObject    = null;
        BrickProperty brickProperty = null;
        Ray           ray           = default(Ray);
        bool          flag          = true;
        bool          flag2         = true;
        float         num           = 0f;
        Plane         plane         = default(Plane);

        shootpos.y += 1.2f;
        TPController component = player.GetComponent <TPController>();

        if ((bool)component)
        {
            float num2  = Vector3.Distance(shootpos, component.transform.position);
            bool  flag3 = false;
            if (num2 < inputMinDistance)
            {
                flag3 = true;
            }
            bool flag4 = false;
            if (num2 > inputMaxDistance)
            {
                flag4 = true;
            }
            Vector3 position  = component.transform.position;
            Vector3 position2 = component.transform.position;
            position2.y += 10f;
            Vector3 c = component.transform.position + component.lookAt() * 30f;
            plane.Set3Points(position, position2, c);
            flag = true;
            Vector3 rhs = shootpos - component.transform.position;
            rhs.Normalize();
            num = Vector3.Dot(component.lookAt(), rhs);
            if (num < 0.2f)
            {
                flag = false;
            }
            flag2 = true;
            rhs   = hitpoint - component.transform.position;
            rhs.Normalize();
            num = Vector3.Dot(component.lookAt(), rhs);
            if (num <= 0.2f)
            {
                flag2 = false;
            }
            if (flag3)
            {
                return(SEND_PACKET_LEVEL.ALL);
            }
            if (flag4)
            {
                return(SEND_PACKET_LEVEL.NONE);
            }
            Vector3 position3 = component.transform.position;
            position3.y  += 1.2f;
            ray.origin    = position3;
            ray.direction = Vector3.Normalize(hitpoint - ray.origin);
            bool flag5 = false;
            if (Physics.Raycast(ray, out RaycastHit hitInfo, range, layerMask))
            {
                GameObject gameObject2 = hitInfo.transform.gameObject;
                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 && brickSeq != brickProperty.Seq)
                {
                    flag5 = true;
                }
            }
            ray.direction = Vector3.Normalize(shootpos - ray.origin);
            bool flag6 = false;
            if (Physics.Raycast(ray, out hitInfo, num2 + 1f, layerMask))
            {
                float num3 = Vector3.Distance(hitInfo.point, component.transform.position);
                if (num2 > num3)
                {
                    flag6 = true;
                }
            }
            if (!flag && !flag2)
            {
                return(SEND_PACKET_LEVEL.NONE);
            }
            if (!flag5 && !flag6)
            {
                return(SEND_PACKET_LEVEL.ALL);
            }
            if (flag5 || !flag2)
            {
                if (!flag6)
                {
                    return(SEND_PACKET_LEVEL.EXCEPT_EFFECT);
                }
                if (num2 < 20f)
                {
                    return(SEND_PACKET_LEVEL.ONLY_SOUND);
                }
                return(SEND_PACKET_LEVEL.NONE);
            }
            if (!possibleCan && flag5 && flag6)
            {
                float distanceToPoint  = plane.GetDistanceToPoint(shootpos);
                float distanceToPoint2 = plane.GetDistanceToPoint(hitpoint);
                if (distanceToPoint < distanceToPoint2)
                {
                    return(SEND_PACKET_LEVEL.NONE);
                }
                if (distanceToPoint * distanceToPoint2 < 0f)
                {
                    Vector3 intersection = Vector3.zero;
                    if (LinePlaneIntersection(out intersection, shootpos, shootdir, plane.normal, position3))
                    {
                        ray.direction = component.lookAt();
                        if (Physics.Raycast(ray, out hitInfo, 30f, layerMask))
                        {
                            return(SEND_PACKET_LEVEL.EXCEPT_EFFECT);
                        }
                    }
                }
            }
            return(SEND_PACKET_LEVEL.ALL);
        }
        return(SEND_PACKET_LEVEL.ALL);
    }
Ejemplo n.º 12
0
    public static SEND_PACKET_LEVEL checkSendDir(GameObject player, Vector3 myPos, Bounds bounds)
    {
        if (null == player)
        {
            return(SEND_PACKET_LEVEL.NONE);
        }
        GameObject    gameObject    = null;
        BrickProperty brickProperty = null;
        TPController  component     = player.GetComponent <TPController>();

        if ((bool)component)
        {
            Vector3  vector               = new Vector3(myPos.x, myPos.y + 1.2f, myPos.z);
            Vector3  position             = component.transform.position;
            float    x                    = position.x;
            Vector3  position2            = component.transform.position;
            float    y                    = position2.y + 1.2f;
            Vector3  position3            = component.transform.position;
            Vector3  vector2              = new Vector3(x, y, position3.z);
            float    num                  = Vector3.Distance(myPos, component.transform.position);
            Camera[] componentsInChildren = player.GetComponentsInChildren <Camera>();
            if (componentsInChildren.Length > 0)
            {
                camera               = componentsInChildren[0];
                camera.fieldOfView   = 75f;
                camera.nearClipPlane = 0.3f;
                camera.farClipPlane  = 1000f;
            }
            camera.transform.position = vector2;
            camera.transform.rotation = component.transform.rotation;
            Plane[] planes = GeometryUtility.CalculateFrustumPlanes(camera);
            if (GeometryUtility.TestPlanesAABB(planes, bounds))
            {
                int layerMask = (1 << LayerMask.NameToLayer("Chunk")) | (1 << LayerMask.NameToLayer("Brick"));
                Ray ray       = default(Ray);
                ray.origin    = vector2;
                ray.direction = Vector3.Normalize(vector - ray.origin);
                if (Physics.Raycast(ray, out RaycastHit hitInfo, 1000f, layerMask))
                {
                    float num2 = Vector3.Distance(hitInfo.point, vector2);
                    if (num > num2)
                    {
                        GameObject gameObject2 = hitInfo.transform.gameObject;
                        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 && IsTransparent(brickProperty.Index) && IsFaceToMeSameBrick(vector, vector2, num, brickProperty.Seq))
                        {
                            camera.enabled = false;
                            return(SEND_PACKET_LEVEL.ALL);
                        }
                        camera.enabled = false;
                        return(SEND_PACKET_LEVEL.NONE);
                    }
                }
                camera.enabled = false;
                return(SEND_PACKET_LEVEL.ALL);
            }
            camera.enabled = false;
            return(SEND_PACKET_LEVEL.NONE);
        }
        return(SEND_PACKET_LEVEL.ALL);
    }
Ejemplo n.º 13
0
    public GameObject AddBrickMan(BrickManDesc desc)
    {
        Vector3 position = new Vector3(0f, 11000f, 0f);

        if (freeInvisiblePositionQ.Count <= 0)
        {
            Debug.LogError("No more free Invisible Position ");
        }
        else
        {
            position = freeInvisiblePositionQ.Dequeue();
        }
        GameObject gameObject = Object.Instantiate((Object)brickMan, position, Quaternion.Euler(0f, 0f, 0f)) as GameObject;

        if (null == gameObject)
        {
            Debug.LogError("Fail to instantiate a brick man ");
            return(null);
        }
        PlayerProperty component = gameObject.GetComponent <PlayerProperty>();

        if (null == component)
        {
            Object.DestroyImmediate(gameObject);
            Debug.LogError("New brickman doesnt have PlayerProperty ");
            return(null);
        }
        component.Desc = desc;
        component.InvisiblePosition = position;
        TPController component2 = gameObject.GetComponent <TPController>();

        if (null == component2)
        {
            Object.DestroyImmediate(gameObject);
            Debug.LogError("New brickman doesnt have ThirdPersonController");
            return(null);
        }
        Camera camera = null;

        Camera[] componentsInChildren = gameObject.GetComponentsInChildren <Camera>();
        if (componentsInChildren != null)
        {
            string value = "Near";
            if (Application.loadedLevelName == "Result4Defense")
            {
                value = "Far";
            }
            int num = 0;
            while (camera == null && num < componentsInChildren.Length)
            {
                if (componentsInChildren[num].name.Contains(value))
                {
                    camera = componentsInChildren[num];
                }
                num++;
            }
        }
        if (null == camera)
        {
            Object.DestroyImmediate(gameObject);
            Debug.LogError(" New brickman doesnt have Overlay camera ");
            return(null);
        }
        if (freeOverlayQ.Count <= 0)
        {
            Debug.LogError("No more freeOverlay ");
        }
        camera.enabled       = true;
        camera.targetTexture = freeOverlayQ.Dequeue();
        Weapon.isInitialize  = true;
        LookCoordinator component3 = gameObject.GetComponent <LookCoordinator>();

        if (null == component3)
        {
            Object.DestroyImmediate(gameObject);
            Debug.LogError("New brickman doesnt have LookCoordinator");
            return(null);
        }
        component3.Init(mirror: false);
        for (int i = 0; i < desc.Equipment.Length; i++)
        {
            TItem tItem = TItemManager.Instance.Get <TItem>(desc.Equipment[i]);
            if (tItem != null)
            {
                string itemCode = desc.Equipment[i];
                if (tItem.type == TItem.TYPE.WEAPON)
                {
                    TWeapon tWeapon = (TWeapon)tItem;
                    int     num2    = 0;
                    while (desc.WpnChg != null && num2 < desc.WpnChg.Length)
                    {
                        TItem tItem2 = TItemManager.Instance.Get <TItem>(desc.WpnChg[num2]);
                        if (tItem2 != null && tItem2.type == TItem.TYPE.WEAPON)
                        {
                            TWeapon tWeapon2 = (TWeapon)tItem2;
                            if (tWeapon.slot == tWeapon2.slot)
                            {
                                itemCode = desc.WpnChg[num2];
                            }
                        }
                        num2++;
                    }
                    int num3 = 0;
                    while (desc.DrpItm != null && num3 < desc.DrpItm.Length)
                    {
                        TItem tItem3 = TItemManager.Instance.Get <TItem>(desc.DrpItm[num3]);
                        if (tItem3 != null && tItem3.type == TItem.TYPE.WEAPON)
                        {
                            TWeapon tWeapon3 = (TWeapon)tItem3;
                            if (tWeapon.slot == tWeapon3.slot)
                            {
                                itemCode = desc.DrpItm[num3];
                            }
                        }
                        num3++;
                    }
                }
                component3.Equip(itemCode);
            }
        }
        component3.ChangeWeapon(RoomManager.Instance.DefaultWeaponType);
        dicBrickMan.Add(desc.Seq, gameObject);
        Weapon.isInitialize = false;
        return(gameObject);
    }
    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);
                }
            }
        }
    }
 public void SetShooter(int player)
 {
     if (shooter == MyInfoManager.Instance.Seq)
     {
         shooter         = -1;
         localController = null;
         Recursively.ChangeLayer(base.transform, LayerMask.NameToLayer("FpsBrick"), LayerMask.NameToLayer("Brick"));
     }
     else if (shooter >= 0)
     {
         GameObject gameObject = BrickManManager.Instance.Get(shooter);
         if (null != gameObject)
         {
             gameObject.BroadcastMessage("OnLeaveCannon");
             gameObject.transform.parent = null;
         }
         SaveAxleAngle();
     }
     shooter = player;
     if (shooter == MyInfoManager.Instance.Seq)
     {
         GameObject gameObject2 = GameObject.Find("Me");
         if (null != gameObject2)
         {
             localController = gameObject2.GetComponent <LocalController>();
         }
         if (null == gameObject2 || null == localController || localController.IsDead)
         {
             localController = null;
             shooter         = -1;
         }
         else
         {
             Recursively.ChangeLayer(base.transform, LayerMask.NameToLayer("Brick"), LayerMask.NameToLayer("FpsBrick"));
             gameObject2.BroadcastMessage("OnGetCannon", this);
             cyclic       = false;
             heat         = 0f;
             overHeatTime = 0f;
             overHeated   = false;
             SaveAxleAngle();
             lastNotified = 0f;
         }
     }
     else if (shooter >= 0)
     {
         TPController tPController = null;
         GameObject   gameObject3  = BrickManManager.Instance.Get(shooter);
         if (null != gameObject3)
         {
             tPController = gameObject3.GetComponent <TPController>();
         }
         if (null == gameObject3 || null == tPController || tPController.IsDead)
         {
             shooter = -1;
         }
         else
         {
             gameObject3.BroadcastMessage("OnGetCannon", this);
             gameObject3.transform.parent   = tpsLink.transform;
             gameObject3.transform.position = tpsLink.transform.position;
             gameObject3.transform.rotation = tpsLink.transform.rotation;
         }
     }
 }
Ejemplo n.º 16
0
 void Awake()
 {
     CharacterController = GetComponent("CharacterController") as CharacterController;
     Instance            = this;
     TPCamera.SpawnCamera();
 }
 private void OnGUI()
 {
     if (MyInfoManager.Instance.isGuiOn && on)
     {
         VerifyLocalController();
         GUI.skin    = GUISkinFinder.Instance.GetGUISkin();
         GUI.depth   = (int)guiDepth;
         GUI.enabled = !DialogManager.Instance.IsModal;
         GUI.BeginGroup(new Rect(((float)Screen.width - crdFrame.x) / 2f, ((float)Screen.height - crdFrame.y) / 2f, crdFrame.x, crdFrame.y));
         GUI.Box(new Rect(0f, 0f, crdFrame.x, crdFrame.y), string.Empty, "BoxResult");
         Room room = RoomManager.Instance.GetRoom(RoomManager.Instance.CurrentRoom);
         if (room != null)
         {
             LabelUtil.TextOut(crdRoomTitle, room.GetString(), "MiniLabel", Color.white, GlobalVars.txtEmptyColor, TextAnchor.UpperLeft);
         }
         GUI.Box(crdBoxGreen, string.Empty, "BoxGreen02");
         GUI.Box(crdFirstLow, string.Empty, "BoxResultText");
         TextureUtil.DrawTexture(crdIndIcon, indIcon, ScaleMode.StretchToFill);
         LabelUtil.TextOut(new Vector2(markX, resultY), StringMgr.Instance.Get("MARK"), "MiniLabel", Color.white, GlobalVars.txtEmptyColor, TextAnchor.MiddleCenter);
         LabelUtil.TextOut(new Vector2(badgeX, resultY), StringMgr.Instance.Get("BADGE"), "MiniLabel", Color.white, GlobalVars.txtEmptyColor, TextAnchor.MiddleCenter);
         LabelUtil.TextOut(new Vector2(nickX, resultY), StringMgr.Instance.Get("CHARACTER"), "MiniLabel", Color.white, GlobalVars.txtEmptyColor, TextAnchor.MiddleCenter);
         LabelUtil.TextOut(new Vector2(zombieX, resultY), StringMgr.Instance.Get("ZOMBIE") + "/" + StringMgr.Instance.Get("BRICKMAN"), "MiniLabel", Color.white, GlobalVars.txtEmptyColor, TextAnchor.MiddleCenter);
         LabelUtil.TextOut(new Vector2(scoreX, resultY), StringMgr.Instance.Get("SCORE"), "MiniLabel", Color.white, GlobalVars.txtEmptyColor, TextAnchor.MiddleCenter);
         LabelUtil.TextOut(new Vector2(pingX, resultY), StringMgr.Instance.Get("PING"), "MiniLabel", Color.white, GlobalVars.txtEmptyColor, TextAnchor.MiddleCenter);
         float num = yy;
         GUI.Box(crdSituation, string.Empty, "BoxResult01");
         bool flag = false;
         List <KeyValuePair <int, BrickManDesc> > list = BrickManManager.Instance.ToSortedList();
         for (int i = 0; i < list.Count; i++)
         {
             BrickManDesc value = list[i].Value;
             if (value != null && value.Slot < 16)
             {
                 GameObject gameObject = BrickManManager.Instance.Get(value.Seq);
                 if (!(null == gameObject))
                 {
                     TPController component = gameObject.GetComponent <TPController>();
                     if (!(null == component))
                     {
                         if (!flag && (MyInfoManager.Instance.Score > value.Score || (MyInfoManager.Instance.Score == value.Score && MyInfoManager.Instance.Kill > value.Kill)))
                         {
                             flag = true;
                             float num2 = num;
                             num = GridOut(MyInfoManager.Instance.ClanMark, MyInfoManager.Instance.Xp, MyInfoManager.Instance.Rank, MyInfoManager.Instance.Nickname, ZombieVsHumanManager.Instance.IsZombie(MyInfoManager.Instance.Seq), MyInfoManager.Instance.ControlMode == MyInfoManager.CONTROL_MODE.PLAYING_SPECTATOR, MyInfoManager.Instance.Score, MyInfoManager.Instance.PingTime, MyInfoManager.Instance.Status, localController.IsDead, num, MyInfoManager.Instance.Seq == RoomManager.Instance.Master);
                             GUI.Box(new Rect(myRowX, num2 - myRowSize.y / 2f + 2f, myRowSize.x, myRowSize.y), string.Empty, "BoxMyInfo");
                         }
                         Peer peer = P2PManager.Instance.Get(value.Seq);
                         num = GridOut(value.ClanMark, value.Xp, value.Rank, value.Nickname, ZombieVsHumanManager.Instance.IsZombie(value.Seq), value.IsHidePlayer, value.Score, peer?.PingTime ?? float.PositiveInfinity, value.Status, component.IsDead, num, value.Seq == RoomManager.Instance.Master);
                     }
                 }
             }
         }
         if (!flag)
         {
             GridOut(MyInfoManager.Instance.ClanMark, MyInfoManager.Instance.Xp, MyInfoManager.Instance.Rank, MyInfoManager.Instance.Nickname, ZombieVsHumanManager.Instance.IsZombie(MyInfoManager.Instance.Seq), MyInfoManager.Instance.ControlMode == MyInfoManager.CONTROL_MODE.PLAYING_SPECTATOR, MyInfoManager.Instance.Score, MyInfoManager.Instance.PingTime, MyInfoManager.Instance.Status, localController.IsDead, num, MyInfoManager.Instance.Seq == RoomManager.Instance.Master);
             GUI.Box(new Rect(myRowX, num - myRowSize.y / 2f + 2f, myRowSize.x, myRowSize.y), string.Empty, "BoxMyInfo");
         }
         GUI.EndGroup();
         GUI.enabled = true;
     }
 }
Ejemplo n.º 18
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;
     }
 }
Ejemplo n.º 19
0
    private void EmotionalAct()
    {
        int          num          = 0;
        TPController tPController = null;

        for (int i = 0; i < RoomManager.Instance.RU.Length; i++)
        {
            if (!RoomManager.Instance.RU[i].red)
            {
                GameObject gameObject = BrickManManager.Instance.Get(RoomManager.Instance.RU[i].seq);
                if (null != gameObject)
                {
                    TPController component = gameObject.GetComponent <TPController>();
                    if (null != component)
                    {
                        string ani = win[UnityEngine.Random.Range(0, win.Length)];
                        if (cvtEndCode == -1)
                        {
                            ani          = lose[UnityEngine.Random.Range(0, lose.Length)];
                            tPController = component;
                        }
                        else if (num == 0)
                        {
                            ani = winner[UnityEngine.Random.Range(0, winner.Length)];
                        }
                        num++;
                        component.EmotionalAct(ani);
                    }
                }
            }
        }
        num = 0;
        for (int j = 0; j < RoomManager.Instance.RU.Length; j++)
        {
            if (RoomManager.Instance.RU[j].red)
            {
                GameObject gameObject2 = BrickManManager.Instance.Get(RoomManager.Instance.RU[j].seq);
                if (null != gameObject2)
                {
                    TPController component2 = gameObject2.GetComponent <TPController>();
                    if (null != component2)
                    {
                        string ani2 = win[UnityEngine.Random.Range(0, win.Length)];
                        if (cvtEndCode == 1)
                        {
                            ani2         = lose[UnityEngine.Random.Range(0, lose.Length)];
                            tPController = component2;
                        }
                        else if (num == 0)
                        {
                            ani2 = winner[UnityEngine.Random.Range(0, winner.Length)];
                        }
                        num++;
                        component2.EmotionalAct(ani2);
                    }
                }
            }
        }
        if (null != tPController)
        {
            tPController.EmotionalAct(loser[UnityEngine.Random.Range(0, loser.Length)]);
        }
    }
 private void OnGUI()
 {
     if (MyInfoManager.Instance.isGuiOn && on)
     {
         VerifyLocalController();
         GUI.skin    = GUISkinFinder.Instance.GetGUISkin();
         GUI.depth   = (int)guiDepth;
         GUI.enabled = !DialogManager.Instance.IsModal;
         GUI.BeginGroup(new Rect(((float)Screen.width - crdFrame.x) / 2f, ((float)Screen.height - crdFrame.y) / 2f, crdFrame.x, crdFrame.y));
         GUI.Box(new Rect(0f, 0f, crdFrame.x, crdFrame.y), string.Empty, "BoxResult");
         Room room = RoomManager.Instance.GetRoom(RoomManager.Instance.CurrentRoom);
         if (room != null)
         {
             LabelUtil.TextOut(crdRoomTitle, room.GetString(), "MiniLabel", Color.white, GlobalVars.txtEmptyColor, TextAnchor.UpperLeft);
         }
         GUI.Box(crdRedTeamTitle, string.Empty, "BoxRed02");
         GUI.Box(crdRedFirstLow, string.Empty, "BoxResultText");
         TextureUtil.DrawTexture(crdRedTeamIcon, redTeam, ScaleMode.StretchToFill);
         LabelUtil.TextOut(new Vector2(markX, redResultY), StringMgr.Instance.Get("MARK"), "MiniLabel", Color.white, GlobalVars.txtEmptyColor, TextAnchor.MiddleCenter);
         LabelUtil.TextOut(new Vector2(badgeX, redResultY), StringMgr.Instance.Get("BADGE"), "MiniLabel", Color.white, GlobalVars.txtEmptyColor, TextAnchor.MiddleCenter);
         LabelUtil.TextOut(new Vector2(nickX, redResultY), StringMgr.Instance.Get("CHARACTER"), "MiniLabel", Color.white, GlobalVars.txtEmptyColor, TextAnchor.MiddleCenter);
         LabelUtil.TextOut(new Vector2(killX, redResultY), StringMgr.Instance.Get("KILL") + "/" + StringMgr.Instance.Get("ASSIST") + "/" + StringMgr.Instance.Get("DEATH"), "MiniLabel", Color.white, GlobalVars.txtEmptyColor, TextAnchor.MiddleCenter);
         LabelUtil.TextOut(new Vector2(scoreX, redResultY), StringMgr.Instance.Get("SCORE"), "MiniLabel", Color.white, GlobalVars.txtEmptyColor, TextAnchor.MiddleCenter);
         LabelUtil.TextOut(new Vector2(pingX, redResultY), StringMgr.Instance.Get("PING"), "MiniLabel", Color.white, GlobalVars.txtEmptyColor, TextAnchor.MiddleCenter);
         float num = redY;
         GUI.Box(crdRedTeamSituation, string.Empty, "BoxResult01");
         bool flag = false;
         List <KeyValuePair <int, BrickManDesc> > list = BrickManManager.Instance.ToSortedList();
         for (int i = 0; i < list.Count; i++)
         {
             BrickManDesc value = list[i].Value;
             if (value != null && value.Slot < 8)
             {
                 GameObject gameObject = BrickManManager.Instance.Get(value.Seq);
                 if (!(null == gameObject))
                 {
                     TPController component = gameObject.GetComponent <TPController>();
                     if (!(null == component))
                     {
                         if (MyInfoManager.Instance.Slot < 8 && !flag && (MyInfoManager.Instance.Score > value.Score || (MyInfoManager.Instance.Score == value.Score && MyInfoManager.Instance.Kill > value.Kill)))
                         {
                             flag = true;
                             float num2 = num;
                             num = GridOut(MyInfoManager.Instance.ClanMark, MyInfoManager.Instance.Xp, MyInfoManager.Instance.Rank, MyInfoManager.Instance.Nickname, MyInfoManager.Instance.Kill, MyInfoManager.Instance.Death, MyInfoManager.Instance.Assist, MyInfoManager.Instance.Score, MyInfoManager.Instance.PingTime, MyInfoManager.Instance.Status, localController.IsDead, num, MyInfoManager.Instance.Seq == RoomManager.Instance.Master);
                             GUI.Box(new Rect(myRowX, num2 - myRowSize.y / 2f + 2f, myRowSize.x, myRowSize.y), string.Empty, "BoxMyInfo");
                         }
                         Peer peer = P2PManager.Instance.Get(value.Seq);
                         num = GridOut(value.ClanMark, value.Xp, value.Rank, value.Nickname, value.Kill, value.Death, value.Assist, value.Score, peer?.PingTime ?? float.PositiveInfinity, value.Status, component.IsDead, num, value.Seq == RoomManager.Instance.Master);
                     }
                 }
             }
         }
         if (MyInfoManager.Instance.Slot < 8 && !flag)
         {
             GridOut(MyInfoManager.Instance.ClanMark, MyInfoManager.Instance.Xp, MyInfoManager.Instance.Rank, MyInfoManager.Instance.Nickname, MyInfoManager.Instance.Kill, MyInfoManager.Instance.Death, MyInfoManager.Instance.Assist, MyInfoManager.Instance.Score, MyInfoManager.Instance.PingTime, MyInfoManager.Instance.Status, localController.IsDead, num, MyInfoManager.Instance.Seq == RoomManager.Instance.Master);
             GUI.Box(new Rect(myRowX, num - myRowSize.y / 2f + 2f, myRowSize.x, myRowSize.y), string.Empty, "BoxMyInfo");
         }
         GUI.Box(crdBlueTeamTitle, string.Empty, "BoxBlue02");
         GUI.Box(crdBlueFirstLow, string.Empty, "BoxResultText");
         TextureUtil.DrawTexture(crdBlueTeamIcon, blueTeam, ScaleMode.StretchToFill);
         LabelUtil.TextOut(new Vector2(markX, blueResultY), StringMgr.Instance.Get("MARK"), "MiniLabel", Color.white, GlobalVars.txtEmptyColor, TextAnchor.MiddleCenter);
         LabelUtil.TextOut(new Vector2(badgeX, blueResultY), StringMgr.Instance.Get("BADGE"), "MiniLabel", Color.white, GlobalVars.txtEmptyColor, TextAnchor.MiddleCenter);
         LabelUtil.TextOut(new Vector2(nickX, blueResultY), StringMgr.Instance.Get("CHARACTER"), "MiniLabel", Color.white, GlobalVars.txtEmptyColor, TextAnchor.MiddleCenter);
         LabelUtil.TextOut(new Vector2(killX, blueResultY), StringMgr.Instance.Get("KILL") + "/" + StringMgr.Instance.Get("ASSIST") + "/" + StringMgr.Instance.Get("DEATH"), "MiniLabel", Color.white, GlobalVars.txtEmptyColor, TextAnchor.MiddleCenter);
         LabelUtil.TextOut(new Vector2(scoreX, blueResultY), StringMgr.Instance.Get("SCORE"), "MiniLabel", Color.white, GlobalVars.txtEmptyColor, TextAnchor.MiddleCenter);
         LabelUtil.TextOut(new Vector2(pingX, blueResultY), StringMgr.Instance.Get("PING"), "MiniLabel", Color.white, GlobalVars.txtEmptyColor, TextAnchor.MiddleCenter);
         num = blueY;
         GUI.Box(crdBlueTeamSituation, string.Empty, "BoxResult01");
         for (int j = 0; j < list.Count; j++)
         {
             BrickManDesc value2 = list[j].Value;
             if (value2 != null && value2.Slot >= 8)
             {
                 GameObject gameObject2 = BrickManManager.Instance.Get(value2.Seq);
                 if (!(null == gameObject2))
                 {
                     TPController component2 = gameObject2.GetComponent <TPController>();
                     if (!(null == component2))
                     {
                         if (MyInfoManager.Instance.Slot >= 8 && !flag && (MyInfoManager.Instance.Score > value2.Score || (MyInfoManager.Instance.Score == value2.Score && MyInfoManager.Instance.Kill > value2.Kill)))
                         {
                             flag = true;
                             float num3 = num;
                             num = GridOut(MyInfoManager.Instance.ClanMark, MyInfoManager.Instance.Xp, MyInfoManager.Instance.Rank, MyInfoManager.Instance.Nickname, MyInfoManager.Instance.Kill, MyInfoManager.Instance.Death, MyInfoManager.Instance.Assist, MyInfoManager.Instance.Score, MyInfoManager.Instance.PingTime, MyInfoManager.Instance.Status, localController.IsDead, num, MyInfoManager.Instance.Seq == RoomManager.Instance.Master);
                             GUI.Box(new Rect(myRowX, num3 - myRowSize.y / 2f + 2f, myRowSize.x, myRowSize.y), string.Empty, "BoxMyInfo");
                         }
                         Peer peer2 = P2PManager.Instance.Get(value2.Seq);
                         num = GridOut(value2.ClanMark, value2.Xp, value2.Rank, value2.Nickname, value2.Kill, value2.Death, value2.Assist, value2.Score, peer2?.PingTime ?? float.PositiveInfinity, value2.Status, component2.IsDead, num, value2.Seq == RoomManager.Instance.Master);
                     }
                 }
             }
         }
         if (MyInfoManager.Instance.Slot >= 8 && !flag)
         {
             GridOut(MyInfoManager.Instance.ClanMark, MyInfoManager.Instance.Xp, MyInfoManager.Instance.Rank, MyInfoManager.Instance.Nickname, MyInfoManager.Instance.Kill, MyInfoManager.Instance.Death, MyInfoManager.Instance.Assist, MyInfoManager.Instance.Score, MyInfoManager.Instance.PingTime, MyInfoManager.Instance.Status, localController.IsDead, num, MyInfoManager.Instance.Seq == RoomManager.Instance.Master);
             GUI.Box(new Rect(myRowX, num - myRowSize.y / 2f + 2f, myRowSize.x, myRowSize.y), string.Empty, "BoxMyInfo");
         }
         if (MyInfoManager.Instance.IsRedTeam())
         {
             redTeamMyTeam.Draw();
         }
         else
         {
             blueTeamMyTeam.Draw();
         }
         GUI.EndGroup();
         GUI.enabled = true;
     }
 }