Example #1
0
 // HERO.netGrabbed
 public static bool IsGrabValid(int viewID, PhotonMessageInfo info)
 {
     if (IN_GAME_MAIN_CAMERA.Gametype != GameType.Singleplayer)
     {
         if (info != null)
         {
             PhotonView view = PhotonView.Find(viewID);
             if (view != null)
             {
                 GameObject go = PhotonView.Find(viewID).gameObject;
                 if (go != null)
                 {
                     TITAN titan = go.GetComponent <TITAN>();
                     if (titan != null && titan.photonView.ownerId == info.sender.Id)
                     {
                         return(true);
                     }
                     FEMALE_TITAN annie = go.GetComponent <FEMALE_TITAN>();
                     if (annie != null && annie.photonView.ownerId == info.sender.Id)
                     {
                         return(true);
                     }
                 }
             }
         }
         Mod.Logger.Error($"'HERO.netGrabbed' from #{(info == null ? "?" : info.sender.Id.ToString())}");
         if (info.sender != null && !FengGameManagerMKII.IgnoreList.Contains(info.sender.Id))
         {
             FengGameManagerMKII.IgnoreList.Add(info.sender.Id);
         }
         return(false);
     }
     return(true);
 }
Example #2
0
 // FEMALE_TITAN.netPlayAnimation
 public static bool IsAnimationPlayValid(FEMALE_TITAN ft, PhotonMessageInfo info)
 {
     if (IN_GAME_MAIN_CAMERA.Gametype != GameType.Singleplayer)
     {
         if (info == null || ft.photonView.ownerId != info.sender.Id)
         {
             Mod.Logger.Error($"'FEMALE_TITAN.netPlayAnimation' from #{(info == null ? "?" : info.sender.Id.ToString())}.");
             if (info.sender != null && !FengGameManagerMKII.IgnoreList.Contains(info.sender.Id))
             {
                 FengGameManagerMKII.IgnoreList.Add(info.sender.Id);
             }
             return(false);
         }
     }
     return(true);
 }
Example #3
0
        // FEMALE_TITAN.netCrossFade
        public static bool IsCrossFadeValid(FEMALE_TITAN annie, PhotonMessageInfo info)
        {
            if (IN_GAME_MAIN_CAMERA.Gametype != GameType.Multiplayer ||
                (info != null && annie.photonView.ownerId == info.sender.Id))
            {
                return(true);
            }

            Mod.Logger.Error($"'FEMALE_TITAN.netCrossFade' from #{(info == null ? "?" : info.sender.Id.ToString())}.");
            if (info.sender != null && !FengGameManagerMKII.IgnoreList.Contains(info.sender.Id))
            {
                FengGameManagerMKII.IgnoreList.Add(info.sender.Id);
            }

            return(false);
        }
Example #4
0
 public AnnieSkin(FEMALE_TITAN tit, string skin) : base(tit.gameObject, new string[] { skin })
 {
 }
 private void OnTriggerStay(Collider other)
 {
     if (this.active_me)
     {
         if (!this.currentHitsII.Contains(other.gameObject))
         {
             this.currentHitsII.Add(other.gameObject);
             currentCameraT.startShake(0.1f, 0.1f, 0.95f);
             if (other.gameObject.transform.root.gameObject.tag == "titan")
             {
                 if ((int)FengGameManagerMKII.settings[330] == 0)
                 {
                     currentCameraT.main_objectH.slashHit.Play();
                 }
                 if ((int)FengGameManagerMKII.settings[287] == 0)
                 {
                     GameObject obj2;
                     if (IN_GAME_MAIN_CAMERA.gametype != GAMETYPE.SINGLE)
                     {
                         obj2 = PhotonNetwork.Instantiate("hitMeat", BaseT.position, Quaternion.Euler(270f, 0f, 0f), 0);
                     }
                     else
                     {
                         obj2 = (GameObject)UnityEngine.Object.Instantiate(Cach.hitMeat != null ? Cach.hitMeat : Cach.hitMeat = (GameObject)Resources.Load("hitMeat"));
                     }
                     obj2.transform.position = BaseT.position;
                 }
                 BaseTR.GetComponent <HERO>().useBlade(0);
             }
         }
         if (other.gameObject.tag == "playerHitbox")
         {
             if (FengGameManagerMKII.lvlInfo.pvp)
             {
                 float b = 1f - (Vector3.Distance(other.gameObject.transform.position, BaseT.position) * 0.05f);
                 b = Mathf.Min(1f, b);
                 HitBox component = other.gameObject.GetComponent <HitBox>();
                 HERO   hero      = null;
                 if ((((component != null) && (component.transform.root != null)) && ((hero = component.transform.root.GetComponent <HERO>()).myTeam != this.myTeam)) && !hero.isInvincible())
                 {
                     if (IN_GAME_MAIN_CAMERA.gametype == GAMETYPE.SINGLE)
                     {
                         if (!hero.isGrabbed)
                         {
                             Vector3 vector = component.transform.root.transform.position - BaseT.position;
                             hero.die((Vector3)(((vector.normalized * b) * 1000f) + (Vector3.up * 50f)), false);
                         }
                     }
                     else if (((IN_GAME_MAIN_CAMERA.gametype == GAMETYPE.MULTIPLAYER) && !hero.HasDied()) && !hero.isGrabbed)
                     {
                         hero.markDie();
                         int      viewID     = BaseTR.gameObject.GetPhotonView().viewID;
                         string   plName     = PhotonView.Find(viewID).owner.name2;
                         object[] parameters = new object[5];
                         Vector3  vector2    = component.transform.root.position - BaseT.position;
                         parameters[0] = (Vector3)(((vector2.normalized * b) * 1000f) + (Vector3.up * 50f));
                         parameters[1] = false;
                         parameters[2] = viewID;
                         parameters[3] = plName;
                         parameters[4] = false;
                         hero.photonView.RPC("netDie", PhotonTargets.All, parameters);
                         AddStats(plName, 0);
                     }
                 }
             }
         }
         else if (other.gameObject.tag == "titanneck")
         {
             HitBox item = other.gameObject.GetComponent <HitBox>();
             if (((item != null) && this.checkIfBehind(item.transform.root.gameObject)) && !this.currentHits.Contains(item))
             {
                 item.hitPosition = (Vector3)((BaseT.position + item.transform.position) * 0.5f);
                 this.currentHits.Add(item);
                 if ((int)FengGameManagerMKII.settings[330] == 0)
                 {
                     this.meatDie.Play();
                 }
                 TITAN          titn = item.transform.root.GetComponent <TITAN>();
                 FEMALE_TITAN   ft   = null;
                 COLOSSAL_TITAN ct   = null;
                 if (IN_GAME_MAIN_CAMERA.gametype == GAMETYPE.SINGLE)
                 {
                     if ((titn != null) && !titn.hasDie)
                     {
                         Vector3 vector3 = this.currentCameraT.main_objectR.velocity - item.transform.root.rigidbody.velocity;
                         int     num2    = (int)((vector3.magnitude * 10f) * this.scoreMulti);
                         num2 = Mathf.Max(10, num2);
                         if ((int)FengGameManagerMKII.settings[320] == 1)
                         {
                             IN_GAME_MAIN_CAMERA.instance.startSnapShot(item.transform.position, num2, item.transform.root.gameObject, 0.02f);
                         }
                         AddStats(titn.name, num2, titn.myLevel);
                         titn.die();
                         this.napeMeat(this.currentCameraT.main_objectR.velocity, item.transform.root);
                         FengGameManagerMKII.instance.netShowDamage(num2);
                         FengGameManagerMKII.instance.playerKillInfoSingleUpdate(num2);
                     }
                 }
                 else if (!PhotonNetwork.isMasterClient)
                 {
                     if (titn != null)
                     {
                         if (!titn.hasDie)
                         {
                             Vector3 vector4 = this.currentCameraT.main_objectR.velocity - item.transform.root.rigidbody.velocity;
                             int     num3    = (int)((vector4.magnitude * 10f) * this.scoreMulti);
                             num3 = Mathf.Max(10, num3);
                             if ((int)FengGameManagerMKII.settings[320] == 1)
                             {
                                 IN_GAME_MAIN_CAMERA.instance.startSnapShot(item.transform.position, num3, item.transform.root.gameObject, 0.02f);
                                 titn.asClientLookTarget = false;
                             }
                             AddStats(titn.name, num3, titn.myLevel);
                             object[] objArray2 = new object[] { BaseTR.gameObject.GetPhotonView().viewID, num3 };
                             titn.photonView.RPC("titanGetHit", titn.photonView.owner, objArray2);
                         }
                     }
                     else if ((ft = item.transform.root.GetComponent <FEMALE_TITAN>()) != null)
                     {
                         BaseTR.GetComponent <HERO>().useBlade(0x7fffffff);
                         Vector3 vector5 = this.currentCameraT.main_objectR.velocity - item.transform.root.rigidbody.velocity;
                         int     num4    = (int)((vector5.magnitude * 10f) * this.scoreMulti);
                         num4 = Mathf.Max(10, num4);
                         if (!ft.hasDie)
                         {
                             AddStats(ft.name, num4, ft.size);
                             object[] objArray3 = new object[] { BaseTR.gameObject.GetPhotonView().viewID, num4 };
                             ft.photonView.RPC("titanGetHit", ft.photonView.owner, objArray3);
                         }
                     }
                     else if ((ct = item.transform.root.GetComponent <COLOSSAL_TITAN>()) != null)
                     {
                         BaseTR.GetComponent <HERO>().useBlade(0x7fffffff);
                         if (!ct.hasDie)
                         {
                             Vector3 vector6 = this.currentCameraT.main_objectR.velocity - item.transform.root.rigidbody.velocity;
                             int     num5    = (int)((vector6.magnitude * 10f) * this.scoreMulti);
                             num5 = Mathf.Max(10, num5);
                             AddStats(ct.name, num5, ct.size);
                             object[] objArray4 = new object[] { BaseTR.gameObject.GetPhotonView().viewID, num5 };
                             ct.photonView.RPC("titanGetHit", ct.photonView.owner, objArray4);
                         }
                     }
                 }
                 else if (titn != null)
                 {
                     if (!titn.hasDie)
                     {
                         Vector3 vector7 = this.currentCameraT.main_objectR.velocity - item.transform.root.rigidbody.velocity;
                         int     num6    = (int)((vector7.magnitude * 10f) * this.scoreMulti);
                         num6 = Mathf.Max(10, num6);
                         AddStats(titn.name, num6, titn.myLevel);
                         if ((int)FengGameManagerMKII.settings[320] == 1)
                         {
                             IN_GAME_MAIN_CAMERA.instance.startSnapShot(item.transform.position, num6, item.transform.root.gameObject, 0.02f);
                         }
                         titn.titanGetHit(BaseTR.gameObject.GetPhotonView().viewID, num6);
                     }
                 }
                 else if ((ft = item.transform.root.GetComponent <FEMALE_TITAN>()) != null)
                 {
                     BaseTR.GetComponent <HERO>().useBlade(0x7fffffff);
                     if (!ft.hasDie)
                     {
                         Vector3 vector8 = this.currentCameraT.main_objectR.velocity - item.transform.root.rigidbody.velocity;
                         int     num7    = (int)((vector8.magnitude * 10f) * this.scoreMulti);
                         num7 = Mathf.Max(10, num7);
                         AddStats(ft.name, num7, ft.size);
                         if ((int)FengGameManagerMKII.settings[320] == 1)
                         {
                             IN_GAME_MAIN_CAMERA.instance.startSnapShot(item.transform.position, num7, null, 0.02f);
                         }
                         ft.titanGetHit(BaseTR.gameObject.GetPhotonView().viewID, num7);
                     }
                 }
                 else if ((ct = item.transform.root.GetComponent <COLOSSAL_TITAN>()) != null)
                 {
                     BaseTR.GetComponent <HERO>().useBlade(0x7fffffff);
                     if (!ct.hasDie)
                     {
                         Vector3 vector9 = this.currentCameraT.main_objectR.velocity - item.transform.root.rigidbody.velocity;
                         int     num8    = (int)((vector9.magnitude * 10f) * this.scoreMulti);
                         num8 = Mathf.Max(10, num8);
                         AddStats(ct.name, num8, ct.size);
                         if ((int)FengGameManagerMKII.settings[320] == 1)
                         {
                             IN_GAME_MAIN_CAMERA.instance.startSnapShot(item.transform.position, num8, null, 0.02f);
                         }
                         ct.titanGetHit(BaseTR.gameObject.GetPhotonView().viewID, num8);
                     }
                 }
                 this.showCriticalHitFX();
             }
         }
         else if (other.gameObject.tag == "titaneye")
         {
             if (!this.currentHits.Contains(other.gameObject))
             {
                 this.currentHits.Add(other.gameObject);
                 GameObject   gameObject = other.gameObject.transform.root.gameObject;
                 TITAN        tit        = null;
                 FEMALE_TITAN ft         = gameObject.GetComponent <FEMALE_TITAN>();
                 if (ft != null)
                 {
                     if (IN_GAME_MAIN_CAMERA.gametype == GAMETYPE.SINGLE)
                     {
                         if (!ft.hasDie)
                         {
                             ft.hitEye();
                         }
                     }
                     else if (!PhotonNetwork.isMasterClient)
                     {
                         if (!ft.hasDie)
                         {
                             object[] objArray5 = new object[] { BaseTR.gameObject.GetPhotonView().viewID };
                             ft.photonView.RPC("hitEyeRPC", PhotonTargets.MasterClient, objArray5);
                         }
                     }
                     else if (!ft.hasDie)
                     {
                         ft.hitEyeRPC(BaseTR.gameObject.GetPhotonView().viewID);
                     }
                 }
                 else if ((tit = gameObject.GetComponent <TITAN>()).abnormalType != AbnormalType.TYPE_CRAWLER)
                 {
                     if (IN_GAME_MAIN_CAMERA.gametype == GAMETYPE.SINGLE)
                     {
                         if (!tit.hasDie)
                         {
                             tit.hitEye();
                         }
                     }
                     else if (!PhotonNetwork.isMasterClient)
                     {
                         if (!tit.hasDie)
                         {
                             object[] objArray6 = new object[] { BaseTR.gameObject.GetPhotonView().viewID };
                             tit.photonView.RPC("hitEyeRPC", PhotonTargets.MasterClient, objArray6);
                         }
                     }
                     else if (!tit.hasDie)
                     {
                         tit.hitEyeRPC(BaseTR.gameObject.GetPhotonView().viewID);
                     }
                     this.showCriticalHitFX();
                 }
             }
         }
         else if ((other.gameObject.tag == "titanankle") && !this.currentHits.Contains(other.gameObject))
         {
             this.currentHits.Add(other.gameObject);
             GameObject obj4     = other.gameObject.transform.root.gameObject;
             Vector3    vector10 = this.currentCameraT.main_objectR.velocity - obj4.rigidbody.velocity;
             int        num9     = (int)((vector10.magnitude * 10f) * this.scoreMulti);
             num9 = Mathf.Max(10, num9);
             TITAN        tit = obj4.GetComponent <TITAN>();
             FEMALE_TITAN ft  = null;
             if ((tit != null) && (tit.abnormalType != AbnormalType.TYPE_CRAWLER))
             {
                 if (IN_GAME_MAIN_CAMERA.gametype == GAMETYPE.SINGLE)
                 {
                     if (!tit.hasDie)
                     {
                         tit.hitAnkle();
                     }
                 }
                 else
                 {
                     if (!PhotonNetwork.isMasterClient)
                     {
                         if (!tit.hasDie)
                         {
                             object[] objArray7 = new object[] { BaseTR.gameObject.GetPhotonView().viewID };
                             tit.photonView.RPC("hitAnkleRPC", PhotonTargets.MasterClient, objArray7);
                         }
                     }
                     else if (!tit.hasDie)
                     {
                         tit.hitAnkle();
                     }
                     this.showCriticalHitFX();
                 }
             }
             else if ((ft = obj4.GetComponent <FEMALE_TITAN>()) != null)
             {
                 if (IN_GAME_MAIN_CAMERA.gametype == GAMETYPE.SINGLE)
                 {
                     if (other.gameObject.name == "ankleR")
                     {
                         if (!ft.hasDie)
                         {
                             ft.hitAnkleR(num9);
                         }
                     }
                     else if (!ft.hasDie)
                     {
                         ft.hitAnkleL(num9);
                     }
                 }
                 else if (other.gameObject.name == "ankleR")
                 {
                     if (!PhotonNetwork.isMasterClient)
                     {
                         if (!ft.hasDie)
                         {
                             object[] objArray8 = new object[] { BaseTR.gameObject.GetPhotonView().viewID, num9 };
                             ft.photonView.RPC("hitAnkleRRPC", PhotonTargets.MasterClient, objArray8);
                         }
                     }
                     else if (!ft.hasDie)
                     {
                         ft.hitAnkleRRPC(BaseTR.gameObject.GetPhotonView().viewID, num9);
                     }
                 }
                 else if (!PhotonNetwork.isMasterClient)
                 {
                     if (!ft.hasDie)
                     {
                         object[] objArray9 = new object[] { BaseTR.gameObject.GetPhotonView().viewID, num9 };
                         ft.photonView.RPC("hitAnkleLRPC", PhotonTargets.MasterClient, objArray9);
                     }
                 }
                 else if (!ft.hasDie)
                 {
                     ft.hitAnkleLRPC(BaseTR.gameObject.GetPhotonView().viewID, num9);
                 }
                 this.showCriticalHitFX();
             }
         }
     }
 }
 private void OnTriggerStay(Collider other)
 {
     if (((IN_GAME_MAIN_CAMERA.gametype != GAMETYPE.MULTIPLAYER) || baseG.GetPhotonView().isMine) && this.active_me)
     {
         GameObject otherG = other.gameObject;
         if (otherG.tag == "playerHitbox")
         {
             if (FengGameManagerMKII.lvlInfo.pvp)
             {
                 float b = 1f - (Vector3.Distance(otherG.transform.position, baseT.position) * 0.05f);
                 b = Mathf.Min(1f, b);
                 HitBox component = otherG.GetComponent <HitBox>();
                 HERO   hero      = component.transform.root.GetComponent <HERO>();
                 if ((((component != null) && (component.transform.root != null)) && (hero.myTeam != this.myTeam)) && !hero.isInvincible())
                 {
                     if (IN_GAME_MAIN_CAMERA.gametype == GAMETYPE.SINGLE)
                     {
                         if (!hero.isGrabbed)
                         {
                             Vector3 vector = component.transform.root.transform.position - baseT.position;
                             hero.die((Vector3)(((vector.normalized * b) * 1000f) + (Vector3.up * 50f)), false);
                         }
                     }
                     else if (((IN_GAME_MAIN_CAMERA.gametype == GAMETYPE.MULTIPLAYER) && !hero.HasDied()) && !hero.isGrabbed)
                     {
                         hero.markDie();
                         object[] parameters = new object[5];
                         Vector3  vector2    = component.transform.root.position - baseT.position;
                         parameters[0] = (Vector3)(((vector2.normalized * b) * 1000f) + (Vector3.up * 50f));
                         parameters[1] = false;
                         parameters[2] = this.viewID;
                         parameters[3] = this.ownerName;
                         parameters[4] = false;
                         AddStats(ownerName, 0);
                         hero.photonView.RPC("netDie", PhotonTargets.All, parameters);
                     }
                 }
             }
         }
         else if (otherG.tag == "erenHitbox")
         {
             if ((this.dmg > 0) && !otherG.transform.root.gameObject.GetComponent <TITAN_EREN>().isHit)
             {
                 otherG.transform.root.gameObject.GetComponent <TITAN_EREN>().hitByTitan();
             }
         }
         else if (otherG.tag == "titanneck")
         {
             HitBox item = otherG.GetComponent <HitBox>();
             if (((item != null) && this.checkIfBehind(item.transform.root.gameObject)) && !this.currentHits.Contains(item))
             {
                 item.hitPosition = (Vector3)((baseT.position + item.transform.position) * 0.5f);
                 this.currentHits.Add(item);
                 TITAN          tit = item.transform.root.GetComponent <TITAN>();
                 FEMALE_TITAN   ft  = null;
                 COLOSSAL_TITAN ct  = null;
                 if (IN_GAME_MAIN_CAMERA.gametype == GAMETYPE.SINGLE)
                 {
                     if ((tit != null) && !tit.hasDie)
                     {
                         Vector3 vector3 = currentCameraT.main_object.rigidbody.velocity - item.transform.root.rigidbody.velocity;
                         int     num2    = (int)((vector3.magnitude * 10f) * this.scoreMulti);
                         num2 = Mathf.Max(10, num2);
                         FengGameManagerMKII.instance.netShowDamage(num2);
                         if (num2 > (tit.myLevel * 100f))
                         {
                             AddStats(tit.name, num2, tit.myLevel);
                             tit.die();
                             if ((int)FengGameManagerMKII.settings[320] == 1)
                             {
                                 IN_GAME_MAIN_CAMERA.instance.startSnapShot(item.transform.position, num2, item.transform.root.gameObject, 0.02f);
                             }
                             FengGameManagerMKII.instance.playerKillInfoSingleUpdate(num2);
                         }
                     }
                 }
                 else if (!PhotonNetwork.isMasterClient)
                 {
                     if (tit != null)
                     {
                         if (!tit.hasDie)
                         {
                             Vector3 vector4 = currentCameraT.main_object.rigidbody.velocity - item.transform.root.rigidbody.velocity;
                             int     num3    = (int)((vector4.magnitude * 10f) * this.scoreMulti);
                             num3 = Mathf.Max(10, num3);
                             if (num3 > (tit.myLevel * 100f))
                             {
                                 AddStats(tit.name, num3, tit.myLevel);
                                 if ((int)FengGameManagerMKII.settings[320] == 1)
                                 {
                                     IN_GAME_MAIN_CAMERA.instance.startSnapShot(item.transform.position, num3, item.transform.root.gameObject, 0.02f);
                                     tit.asClientLookTarget = false;
                                 }
                                 object[] objArray2 = new object[] { baseG.GetPhotonView().viewID, num3 };
                                 tit.photonView.RPC("titanGetHit", tit.photonView.owner, objArray2);
                             }
                         }
                     }
                     else if ((ft = item.transform.root.GetComponent <FEMALE_TITAN>()) != null)
                     {
                         Vector3 vector5 = currentCameraT.main_object.rigidbody.velocity - item.transform.root.rigidbody.velocity;
                         int     num4    = (int)((vector5.magnitude * 10f) * this.scoreMulti);
                         num4 = Mathf.Max(10, num4);
                         if (!ft.hasDie)
                         {
                             AddStats(ft.name, num4, ft.size);
                             object[] objArray3 = new object[] { baseG.GetPhotonView().viewID, num4 };
                             ft.photonView.RPC("titanGetHit", ft.photonView.owner, objArray3);
                         }
                     }
                     else if (((ct = item.transform.root.GetComponent <COLOSSAL_TITAN>()) != null) && !ct.hasDie)
                     {
                         Vector3 vector6 = currentCameraT.main_object.rigidbody.velocity - item.transform.root.rigidbody.velocity;
                         int     num5    = (int)((vector6.magnitude * 10f) * this.scoreMulti);
                         num5 = Mathf.Max(10, num5);
                         AddStats(ct.name, num5, ct.size);
                         object[] objArray4 = new object[] { baseG.GetPhotonView().viewID, num5 };
                         ct.photonView.RPC("titanGetHit", ct.photonView.owner, objArray4);
                     }
                 }
                 else if (tit != null)
                 {
                     if (!tit.hasDie)
                     {
                         Vector3 vector7 = currentCameraT.main_object.rigidbody.velocity - item.transform.root.rigidbody.velocity;
                         int     num6    = (int)((vector7.magnitude * 10f) * this.scoreMulti);
                         num6 = Mathf.Max(10, num6);
                         if (num6 > (tit.myLevel * 100f))
                         {
                             AddStats(tit.name, num6, tit.myLevel);
                             if ((int)FengGameManagerMKII.settings[320] == 1)
                             {
                                 IN_GAME_MAIN_CAMERA.instance.startSnapShot(item.transform.position, num6, item.transform.root.gameObject, 0.02f);
                             }
                             tit.titanGetHit(baseG.GetPhotonView().viewID, num6);
                         }
                     }
                 }
                 else if ((ft = item.transform.root.GetComponent <FEMALE_TITAN>()) != null)
                 {
                     if (!ft.hasDie)
                     {
                         Vector3 vector8 = currentCameraT.main_object.rigidbody.velocity - item.transform.root.rigidbody.velocity;
                         int     num7    = (int)((vector8.magnitude * 10f) * this.scoreMulti);
                         num7 = Mathf.Max(10, num7);
                         AddStats(ft.name, num7, ft.size);
                         if ((int)FengGameManagerMKII.settings[320] == 1)
                         {
                             IN_GAME_MAIN_CAMERA.instance.startSnapShot(item.transform.position, num7, null, 0.02f);
                         }
                         ft.titanGetHit(baseG.GetPhotonView().viewID, num7);
                     }
                 }
                 else if (((ct = item.transform.root.GetComponent <COLOSSAL_TITAN>()) != null) && !ct.hasDie)
                 {
                     Vector3 vector9 = currentCameraT.main_object.rigidbody.velocity - item.transform.root.rigidbody.velocity;
                     int     num8    = (int)((vector9.magnitude * 10f) * this.scoreMulti);
                     num8 = Mathf.Max(10, num8);
                     AddStats(ct.name, num8, ct.size);
                     if ((int)FengGameManagerMKII.settings[320] == 1)
                     {
                         IN_GAME_MAIN_CAMERA.instance.startSnapShot(item.transform.position, num8, null, 0.02f);
                     }
                     ct.titanGetHit(baseG.GetPhotonView().viewID, num8);
                 }
                 this.showCriticalHitFX(otherG.transform.position);
             }
         }
         else if (otherG.tag == "titaneye")
         {
             if (!this.currentHits.Contains(otherG))
             {
                 this.currentHits.Add(otherG);
                 GameObject   gameObject = otherG.transform.root.gameObject;
                 FEMALE_TITAN ft         = gameObject.GetComponent <FEMALE_TITAN>();
                 TITAN        tit        = null;
                 if (ft != null)
                 {
                     if (IN_GAME_MAIN_CAMERA.gametype == GAMETYPE.SINGLE)
                     {
                         if (!ft.hasDie)
                         {
                             ft.hitEye();
                         }
                     }
                     else if (!PhotonNetwork.isMasterClient)
                     {
                         if (!ft.hasDie)
                         {
                             object[] objArray5 = new object[] { baseG.GetPhotonView().viewID };
                             ft.photonView.RPC("hitEyeRPC", PhotonTargets.MasterClient, objArray5);
                         }
                     }
                     else if (!ft.hasDie)
                     {
                         ft.hitEyeRPC(baseG.GetPhotonView().viewID);
                     }
                 }
                 else if ((tit = gameObject.GetComponent <TITAN>()).abnormalType != AbnormalType.TYPE_CRAWLER)
                 {
                     if (IN_GAME_MAIN_CAMERA.gametype == GAMETYPE.SINGLE)
                     {
                         if (!tit.hasDie)
                         {
                             tit.hitEye();
                         }
                     }
                     else if (!PhotonNetwork.isMasterClient)
                     {
                         if (!tit.hasDie)
                         {
                             object[] objArray6 = new object[] { baseG.GetPhotonView().viewID };
                             tit.photonView.RPC("hitEyeRPC", PhotonTargets.MasterClient, objArray6);
                         }
                     }
                     else if (!tit.hasDie)
                     {
                         tit.hitEyeRPC(baseG.GetPhotonView().viewID);
                     }
                     this.showCriticalHitFX(otherG.transform.position);
                 }
             }
         }
         else if ((otherG.tag == "titanankle") && !this.currentHits.Contains(otherG))
         {
             this.currentHits.Add(otherG);
             GameObject obj3     = otherG.transform.root.gameObject;
             Vector3    vector10 = currentCameraT.main_object.rigidbody.velocity - obj3.rigidbody.velocity;
             int        num9     = (int)((vector10.magnitude * 10f) * this.scoreMulti);
             num9 = Mathf.Max(10, num9);
             TITAN        tit = obj3.GetComponent <TITAN>();
             FEMALE_TITAN ft  = null;
             if ((tit != null) && (tit.abnormalType != AbnormalType.TYPE_CRAWLER))
             {
                 if (IN_GAME_MAIN_CAMERA.gametype == GAMETYPE.SINGLE)
                 {
                     if (!tit.hasDie)
                     {
                         tit.hitAnkle();
                     }
                 }
                 else
                 {
                     if (!PhotonNetwork.isMasterClient)
                     {
                         if (!tit.hasDie)
                         {
                             object[] objArray7 = new object[] { baseG.GetPhotonView().viewID };
                             tit.photonView.RPC("hitAnkleRPC", PhotonTargets.MasterClient, objArray7);
                         }
                     }
                     else if (!tit.hasDie)
                     {
                         tit.hitAnkle();
                     }
                     this.showCriticalHitFX(otherG.transform.position);
                 }
             }
             else if ((ft = obj3.GetComponent <FEMALE_TITAN>()) != null)
             {
                 if (IN_GAME_MAIN_CAMERA.gametype == GAMETYPE.SINGLE)
                 {
                     if (otherG.name == "ankleR")
                     {
                         if (!ft.hasDie)
                         {
                             ft.hitAnkleR(num9);
                         }
                     }
                     else if (!ft.hasDie)
                     {
                         ft.hitAnkleL(num9);
                     }
                 }
                 else if (otherG.name == "ankleR")
                 {
                     if (!PhotonNetwork.isMasterClient)
                     {
                         if (!ft.hasDie)
                         {
                             object[] objArray8 = new object[] { baseG.GetPhotonView().viewID, num9 };
                             ft.photonView.RPC("hitAnkleRRPC", PhotonTargets.MasterClient, objArray8);
                         }
                     }
                     else if (!ft.hasDie)
                     {
                         ft.hitAnkleRRPC(baseG.GetPhotonView().viewID, num9);
                     }
                 }
                 else if (!PhotonNetwork.isMasterClient)
                 {
                     if (!ft.hasDie)
                     {
                         object[] objArray9 = new object[] { baseG.GetPhotonView().viewID, num9 };
                         ft.photonView.RPC("hitAnkleLRPC", PhotonTargets.MasterClient, objArray9);
                     }
                 }
                 else if (!ft.hasDie)
                 {
                     ft.hitAnkleLRPC(baseG.GetPhotonView().viewID, num9);
                 }
                 this.showCriticalHitFX(otherG.transform.position);
             }
         }
     }
 }
    private void OnTriggerStay(Collider other)
    {
        if (this.active_me)
        {
            GameObject otherG = other.gameObject;
            Transform  otherT = other.transform;
            if (!this.currentHitsII.Contains(otherG))
            {
                this.currentHitsII.Add(otherG);
                mainCamera.startShake(0.1f, 0.1f, 0.95f);
                if (otherT.root.gameObject.CompareTag("titan"))
                {
                    this.hero.slashHit.Play();
                    if (IN_GAME_MAIN_CAMERA.gametype != GAMETYPE.SINGLE)
                    {
                        PhotonNetwork.Instantiate("hitMeat", this.baseT.position, Quaternion.Euler(270f, 0f, 0f), 0, null);
                    }
                    else
                    {
                        ((GameObject)UnityEngine.Object.Instantiate(CLEARSKIES.CacheResources.Load("hitMeat"))).transform.position = baseT.position;
                    }
                    this.hero.useBlade(0);
                }
            }
            string tag;
            if ((tag = otherG.tag) != null)
            {
                HitBox     component = otherG.GetComponent <HitBox>();
                Transform  componentT, componentTroot;
                GameObject componentGO;
                MONO       monosingletone;
                switch (tag)
                {
                case "playerHitbox":
                    if (LevelInfo.getInfo(FengGameManagerMKII.level).pvp)
                    {
                        float b = 1f - (Vector3.Distance(otherT.position, this.baseT.position) * 0.05f);
                        b = Mathf.Min(1f, b);
                        if ((componentTroot = (componentT = component.transform).root) != null)
                        {
                            HERO Hero = componentTroot.GetComponent <HERO>();
                            if (Hero != null && Hero.myTeam != this.myTeam && !Hero.isInvincible() && !Hero.isGrabbed)
                            {
                                if (IN_GAME_MAIN_CAMERA.gametype == GAMETYPE.SINGLE)
                                {
                                    Hero.die((componentTroot.position - this.baseT.position).normalized * b * 1000f + Vector3.up * 50f, false);
                                    return;
                                }
                                if (!Hero.HasDied())
                                {
                                    Hero.markDie();
                                    object[] parameters = new object[]
                                    {
                                        (componentTroot.position - baseT.position).normalized * b * 1000f + Vector3.up * 50f,
                                        false,
                                        basePV.viewID,
                                        basePV.owner.customProperties[PhotonPlayerProperty.name],
                                        false
                                    };
                                    Hero.photonView.RPC("netDie", PhotonTargets.All, parameters);
                                }
                            }
                        }
                    }
                    break;

                case "titanneck":
                    if ((componentGO = (componentTroot = (componentT = component.transform).root).gameObject) != null)
                    {
                        if (this.checkIfBehind(componentGO) && !this.currentHits.Contains(component))
                        {
                            component.hitPosition = (Vector3)((this.baseT.position + componentT.position) * 0.5f);
                            this.currentHits.Add(component);
                            this.meatDie.Play();
                            monosingletone = componentTroot.GetComponent <MONO>();
                            SPECIES specie = monosingletone.species;
                            switch (specie)
                            {
                            case SPECIES.Titan:
                                TITAN titan = monosingletone as TITAN;
                                if (titan != null && !titan.hasDie)
                                {
                                    int num2 = this.Damage(componentTroot);
                                    if (IN_GAME_MAIN_CAMERA.gametype == GAMETYPE.SINGLE)
                                    {
                                        if (PlayerPrefs.HasKey("EnableSS") && (PlayerPrefs.GetInt("EnableSS") == 1))
                                        {
                                            mainCamera.startSnapShot2(componentT.position, num2, componentGO, 0.02f);
                                        }
                                        titan.die();
                                        this.napeMeat(this.hero.rigidbody.velocity, componentTroot);
                                        FengGameManagerMKII.instance.netShowDamage(num2);
                                        FengGameManagerMKII.instance.playerKillInfoSingleUpdate(num2);
                                    }
                                    else
                                    {
                                        if (!PhotonNetwork.isMasterClient)
                                        {
                                            if (PlayerPrefs.HasKey("EnableSS") && (PlayerPrefs.GetInt("EnableSS") == 1))
                                            {
                                                mainCamera.startSnapShot2(componentT.position, num2, componentGO, 0.02f);
                                                titan.asClientLookTarget = false;
                                            }
                                            object[] objArray2 = new object[] { basePV.viewID, num2 };
                                            titan.photonView.RPC("titanGetHit", titan.photonView.owner, objArray2);
                                        }
                                        else
                                        {
                                            if (PlayerPrefs.HasKey("EnableSS") && (PlayerPrefs.GetInt("EnableSS") == 1))
                                            {
                                                mainCamera.startSnapShot2(componentT.position, num2, componentGO, 0.02f);
                                            }
                                            titan.titanGetHit(this.basePV.viewID, num2);
                                        }
                                    }
                                }
                                break;

                            case SPECIES.Hero | SPECIES.Titan:
                                break;

                            case SPECIES.FemaleTitan:
                                FEMALE_TITAN female_titan = monosingletone as FEMALE_TITAN;
                                this.hero.useBlade(0x7fffffff);
                                if (female_titan != null && !female_titan.hasDie)
                                {
                                    int num2 = this.Damage(componentTroot);
                                    if (!PhotonNetwork.isMasterClient)
                                    {
                                        object[] objArray3 = new object[] { this.basePV.viewID, num2 };
                                        female_titan.photonView.RPC("titanGetHit", female_titan.photonView.owner, objArray3);
                                    }
                                    else
                                    {
                                        if (PlayerPrefs.HasKey("EnableSS") && (PlayerPrefs.GetInt("EnableSS") == 1))
                                        {
                                            mainCamera.startSnapShot2(componentT.position, num2, null, 0.02f);
                                        }
                                        female_titan.titanGetHit(this.basePV.viewID, num2);
                                    }
                                }
                                break;

                            default:
                                if (monosingletone.species == SPECIES.ColossalTitan)
                                {
                                    COLOSSAL_TITAN colossal_titan = monosingletone as COLOSSAL_TITAN;
                                    this.hero.useBlade(0x7fffffff);
                                    if (!colossal_titan.hasDie)
                                    {
                                        int num2 = this.Damage(componentTroot);
                                        if (!PhotonNetwork.isMasterClient)
                                        {
                                            object[] objArray4 = new object[] { this.basePV.viewID, num2 };
                                            colossal_titan.photonView.RPC("titanGetHit", colossal_titan.photonView.owner, objArray4);
                                        }
                                        else

                                        if (PlayerPrefs.HasKey("EnableSS") && (PlayerPrefs.GetInt("EnableSS") == 1))
                                        {
                                            mainCamera.startSnapShot2(componentT.position, num2, null, 0.02f);
                                        }
                                        colossal_titan.titanGetHit(this.basePV.viewID, num2);
                                    }
                                }
                                break;
                            }
                            this.showCriticalHitFX();
                        }
                    }
                    break;

                case "titaneye":
                    if (!this.currentHits.Contains(otherG))
                    {
                        this.currentHits.Add(otherG);
                        componentT = otherG.transform;
                        if (componentT != null)
                        {
                            monosingletone = componentT.root.GetComponent <MONO>();
                            if (monosingletone != null)
                            {
                                switch (monosingletone.species)
                                {
                                case SPECIES.Titan:
                                    TITAN titan = monosingletone as TITAN;
                                    if (titan.abnormalType != AbnormalType.TYPE_CRAWLER && !titan.hasDie)
                                    {
                                        if (IN_GAME_MAIN_CAMERA.gametype == GAMETYPE.SINGLE)
                                        {
                                            titan.hitEye();
                                        }
                                        else if (!PhotonNetwork.isMasterClient)
                                        {
                                            object[] objArray6 = new object[] { this.basePV.viewID };
                                            titan.photonView.RPC("hitEyeRPC", PhotonTargets.MasterClient, objArray6);
                                        }
                                        else
                                        {
                                            titan.hitEyeRPC(this.baseT.root.gameObject.GetPhotonView().viewID);
                                        }
                                        this.showCriticalHitFX();
                                    }
                                    break;

                                case SPECIES.FemaleTitan:
                                    FEMALE_TITAN female_titan = monosingletone as FEMALE_TITAN;
                                    if (!female_titan.hasDie)
                                    {
                                        if (IN_GAME_MAIN_CAMERA.gametype == GAMETYPE.SINGLE)
                                        {
                                            female_titan.hitEye();
                                        }
                                        else if (!PhotonNetwork.isMasterClient)
                                        {
                                            object[] objArray5 = new object[] { this.basePV.viewID };
                                            female_titan.photonView.RPC("hitEyeRPC", PhotonTargets.MasterClient, objArray5);
                                        }
                                        else
                                        {
                                            female_titan.hitEyeRPC(this.basePV.viewID);
                                        }
                                        this.showCriticalHitFX();
                                    }
                                    break;
                                }
                            }
                        }
                    }
                    break;

                case "titanankle":
                    if (!this.currentHits.Contains(otherG))
                    {
                        this.currentHits.Add(otherG);
                        componentT = otherG.transform;
                        if (componentT != null)
                        {
                            monosingletone = componentT.root.GetComponent <MONO>();
                            switch (monosingletone.species)
                            {
                            case SPECIES.Titan:
                                TITAN titan = monosingletone as TITAN;
                                if (titan.abnormalType != AbnormalType.TYPE_CRAWLER && !titan.hasDie)
                                {
                                    if (IN_GAME_MAIN_CAMERA.gametype == GAMETYPE.SINGLE)
                                    {
                                        titan.hitAnkle();
                                    }
                                    else if (!PhotonNetwork.isMasterClient)
                                    {
                                        object[] objArray6 = new object[] { this.basePV.viewID };
                                        titan.GetComponent <TITAN>().photonView.RPC("hitAnkleRPC", PhotonTargets.MasterClient, objArray6);
                                    }
                                    else
                                    {
                                        titan.hitAnkle();
                                    }
                                    this.showCriticalHitFX();
                                }
                                break;

                            case SPECIES.FemaleTitan:
                                FEMALE_TITAN female_titan = monosingletone as FEMALE_TITAN;
                                if (!female_titan.hasDie)
                                {
                                    int num2 = this.Damage(female_titan);
                                    if (otherG.name == "ankleR")
                                    {
                                        if (IN_GAME_MAIN_CAMERA.gametype == GAMETYPE.SINGLE)
                                        {
                                            female_titan.hitAnkleR(num2);
                                            FengGameManagerMKII.instance.netShowDamage(num2);
                                        }
                                        else if (!PhotonNetwork.isMasterClient)
                                        {
                                            object[] objArray5 = new object[] { this.basePV.viewID };
                                            female_titan.photonView.RPC("hitAnkleRRPC", PhotonTargets.MasterClient, objArray5);
                                        }
                                        else
                                        {
                                            female_titan.hitAnkleRRPC(this.basePV.viewID, num2);
                                        }
                                    }
                                    else if (IN_GAME_MAIN_CAMERA.gametype == GAMETYPE.SINGLE)
                                    {
                                        female_titan.hitAnkleL(num2);
                                        FengGameManagerMKII.instance.netShowDamage(num2);
                                    }
                                    else if (!PhotonNetwork.isMasterClient)
                                    {
                                        object[] objArray5 = new object[] { this.basePV.viewID };
                                        female_titan.photonView.RPC("hitAnkleLRPC", PhotonTargets.MasterClient, objArray5);
                                    }
                                    else
                                    {
                                        female_titan.hitAnkleLRPC(this.basePV.viewID, num2);
                                    }
                                    this.showCriticalHitFX();
                                }
                                break;
                            }
                        }
                    }
                    break;

                default:
                    return;
                }
            }
        }
    }
Example #8
0
 public void RemoveFT(FEMALE_TITAN titan)
 {
     titan = null;
 }
Example #9
0
 public void AddFT(FEMALE_TITAN titan)
 {
     annie = titan;
 }
Example #10
0
    private void OnTriggerStay(Collider other)
    {
        if (IN_GAME_MAIN_CAMERA.GameType == GameType.Multiplayer && !Extensions.GetPhotonView(transform.root.gameObject).isMine || !active_me)
        {
            return;
        }


        if (other.gameObject.CompareTag("playerHitbox"))
        {
            if (ModuleManager.Enabled(nameof(ModulePVPEverywhere)) || LevelInfoManager.Get(GameManager.Level).IsPvP)
            {
                float b = 1f - Vector3.Distance(other.gameObject.transform.position, transform.position) * 0.05f;
                b = Mathf.Min(1f, b);
                HitBox component = other.gameObject.GetComponent <HitBox>();
                if (component != null &&
                    component.transform.root != null)
                {
                    var hero = component.transform.root.GetComponent <HERO>();
                    if (!Extensions.GetPhotonView(component.transform.root.gameObject).isMine&& (hero.myTeam != this.myTeam || ModuleManager.Enabled(nameof(ModulePVPEverywhere))) &&
                        !hero.isInvincible() && !hero.HasDied() && !hero.IsGrabbed)
                    {
                        hero.markDie();
                        Vector3 distance = component.transform.root.position - transform.position;
                        component.transform.root.GetComponent <HERO>().photonView.RPC(Rpc.Die, PhotonTargets.All,
                                                                                      distance.normalized * b * 1000f + Vector3.up * 50f, // force : Vector3
                                                                                      false,                                              // isBite : bool
                                                                                      this.viewID,                                        // viewID : int
                                                                                      this.ownerName,                                     // titanName : string
                                                                                      false);                                             // killByTitan : bool
                    }
                }
            }
        }
        else if (other.gameObject.CompareTag("erenHitbox"))
        {
            if (dmg > 0 && !other.gameObject.transform.root.gameObject.GetComponent <TITAN_EREN>().isHit)
            {
                other.gameObject.transform.root.gameObject.GetComponent <TITAN_EREN>().hitByTitan();
            }
        }
        else if (other.gameObject.CompareTag("titanneck"))
        {
            HitBox item = other.gameObject.GetComponent <HitBox>();
            if (item != null && CheckIfBehind(item.transform.root.gameObject) && !this.currentHits.Contains(item))
            {
                item.hitPosition = (transform.position + item.transform.position) * 0.5f;
                this.currentHits.Add(item);

                TITAN          titan         = item.transform.root.GetComponent <TITAN>();
                FEMALE_TITAN   femaleTitan   = item.transform.root.GetComponent <FEMALE_TITAN>();
                COLOSSAL_TITAN colossalTitan = item.transform.root.GetComponent <COLOSSAL_TITAN>();

                Vector3 velocity = IN_GAME_MAIN_CAMERA.instance.main_object.rigidbody.velocity - item.transform.root.rigidbody.velocity;
                int     damage   = Mathf.Max(10, (int)(velocity.magnitude * 10f * this.scoreMulti));
                switch (IN_GAME_MAIN_CAMERA.GameType)
                {
                // TITAN
                // Single
                case GameType.Singleplayer when titan != null && !titan.hasDie:

                    GameManager.instance.NetShowDamage(damage, null);
                    if (damage > titan.myLevel * 100f)
                    {
                        titan.die();
                        IN_GAME_MAIN_CAMERA.instance.TakeScreenshot(item.transform.position, damage, item.transform.root.gameObject, 0.02f);
                        GameManager.instance.PlayerKillInfoSingleplayerUpdate(damage);
                    }
                    break;

                // Multi as MC
                case GameType.Multiplayer when PhotonNetwork.isMasterClient && titan != null && !titan.hasDie:
                    if (damage > titan.myLevel * 100f)
                    {
                        IN_GAME_MAIN_CAMERA.instance.TakeScreenshot(item.transform.position, damage, item.transform.root.gameObject, 0.02f);

                        titan.TitanGetHit(Extensions.GetPhotonView(transform.root.gameObject).viewID, damage);
                    }
                    break;

                // Multi as user
                case GameType.Multiplayer when titan != null && !titan.hasDie:
                    if (damage > titan.myLevel * 100f)
                    {
                        if (ModuleManager.Enabled(nameof(ModuleSnapshot)))
                        {
                            IN_GAME_MAIN_CAMERA.instance.TakeScreenshot(item.transform.position, damage, item.transform.root.gameObject, 0.02f);
                            titan.asClientLookTarget = false;
                        }
                        object[] objArray2 = new object[] { Extensions.GetPhotonView(transform.root.gameObject).viewID, damage };
                        titan.photonView.RPC(Rpc.TitanGetHit, titan.photonView.owner, objArray2);
                    }
                    break;

                // FEMALE TITAN
                // Multi as MC
                case GameType.Multiplayer when PhotonNetwork.isMasterClient && femaleTitan != null && !femaleTitan.hasDie:
                    IN_GAME_MAIN_CAMERA.instance.TakeScreenshot(item.transform.position, damage, null, 0.02f);

                    femaleTitan.TitanGetHit(Extensions.GetPhotonView(transform.root.gameObject).viewID, damage);
                    break;

                // Multi as user
                case GameType.Multiplayer when femaleTitan != null && !femaleTitan.hasDie:
                    femaleTitan.photonView.RPC(Rpc.TitanGetHit, femaleTitan.photonView.owner,
                                               Extensions.GetPhotonView(transform.root.gameObject).viewID, damage);
                    break;

                // COLOSSAL TITAN
                // Multi as MC
                case GameType.Multiplayer when PhotonNetwork.isMasterClient && colossalTitan != null && !colossalTitan.hasDie:
                    IN_GAME_MAIN_CAMERA.instance.TakeScreenshot(item.transform.position, damage, null, 0.02f);

                    colossalTitan.TitanGetHit(Extensions.GetPhotonView(transform.root.gameObject).viewID, damage);
                    break;

                // Multi as user
                case GameType.Multiplayer when colossalTitan != null && !colossalTitan.hasDie:
                    colossalTitan.photonView.RPC(Rpc.TitanGetHit, colossalTitan.photonView.owner,
                                                 Extensions.GetPhotonView(transform.root.gameObject).viewID, damage);
                    break;
                }

                this.ShowCriticalHitFX(other.gameObject.transform.position);
            }
        }
        else if (other.gameObject.CompareTag("titaneye"))
        {
            if (!this.currentHits.Contains(other.gameObject))
            {
                this.currentHits.Add(other.gameObject);

                GameObject eye = other.gameObject.transform.root.gameObject;

                var femaleTitan = eye.GetComponent <FEMALE_TITAN>();
                if (femaleTitan != null && !femaleTitan.hasDie)
                {
                    if (IN_GAME_MAIN_CAMERA.GameType == GameType.Singleplayer)
                    {
                        femaleTitan.hitEye();
                    }
                    else if (!PhotonNetwork.isMasterClient)
                    {
                        femaleTitan.photonView.RPC(Rpc.HitEye, PhotonTargets.MasterClient, Extensions.GetPhotonView(transform.root.gameObject).viewID);
                    }
                    else
                    {
                        femaleTitan.HitEyeRPC(Extensions.GetPhotonView(transform.root.gameObject).viewID);
                    }
                    return;
                }

                var titan = eye.GetComponent <TITAN>();
                if (titan != null && titan.abnormalType != AbnormalType.Crawler && !titan.hasDie)
                {
                    if (IN_GAME_MAIN_CAMERA.GameType == GameType.Singleplayer)
                    {
                        titan.HitEye();
                    }
                    else if (!PhotonNetwork.isMasterClient)
                    {
                        titan.photonView.RPC(Rpc.HitEye, PhotonTargets.MasterClient, Extensions.GetPhotonView(transform.root.gameObject).viewID);
                    }
                    else if (!titan.hasDie)
                    {
                        titan.HitEyeRPC(Extensions.GetPhotonView(transform.root.gameObject).viewID);
                    }

                    this.ShowCriticalHitFX(other.gameObject.transform.position);
                }
            }
        }
        else if (other.gameObject.CompareTag("titanankle") && !this.currentHits.Contains(other.gameObject))
        {
            currentHits.Add(other.gameObject);
            GameObject obj      = other.gameObject.transform.root.gameObject;
            Vector3    velocity = IN_GAME_MAIN_CAMERA.instance.main_object.rigidbody.velocity - obj.rigidbody.velocity;
            int        damage   = Mathf.Max(10, (int)(velocity.magnitude * 10f * this.scoreMulti));

            var titan       = obj.GetComponent <TITAN>();
            var femaleTitan = obj.GetComponent <FEMALE_TITAN>();

            if (titan != null && titan.abnormalType != AbnormalType.Crawler && !titan.hasDie)
            {
                if (IN_GAME_MAIN_CAMERA.GameType == GameType.Singleplayer)
                {
                    titan.hitAnkle();
                }
                else if (!PhotonNetwork.isMasterClient)
                {
                    titan.photonView.RPC(Rpc.HitEye, PhotonTargets.MasterClient, Extensions.GetPhotonView(transform.root.gameObject).viewID);
                }
                else
                {
                    titan.hitAnkle();
                }

                ShowCriticalHitFX(other.gameObject.transform.position);
            }
            else if (femaleTitan != null && !femaleTitan.hasDie)
            {
                switch (IN_GAME_MAIN_CAMERA.GameType)
                {
                case GameType.Singleplayer:
                    if (other.gameObject.name == "ankleR")
                    {
                        femaleTitan.hitAnkleR(damage);
                    }
                    else
                    {
                        femaleTitan.hitAnkleL(damage);
                    }
                    break;

                case GameType.Multiplayer:
                    if (PhotonNetwork.isMasterClient)
                    {
                        if (other.gameObject.name == "ankleR")
                        {
                            femaleTitan.HitAnkleRRPC(Extensions.GetPhotonView(transform.root.gameObject).viewID, damage);
                        }
                        else
                        {
                            femaleTitan.HitAnkleLRPC(Extensions.GetPhotonView(transform.root.gameObject).viewID, damage);
                        }
                    }
                    else
                    {
                        if (other.gameObject.name == "ankleR")
                        {
                            femaleTitan.photonView.RPC(Rpc.HitRightAnkle, PhotonTargets.MasterClient, Extensions.GetPhotonView(transform.root.gameObject).viewID, damage);
                        }
                        else
                        {
                            femaleTitan.photonView.RPC(Rpc.HitLeftAnkle, PhotonTargets.MasterClient, Extensions.GetPhotonView(transform.root.gameObject).viewID, damage);
                        }
                    }

                    break;
                }

                this.ShowCriticalHitFX(other.gameObject.transform.position);
            }
        }
    }
Example #11
0
    private void OnTriggerStay(Collider other)
    {
        if ((IN_GAME_MAIN_CAMERA.Gametype == GameType.Multiplayer && !base.transform.root.gameObject.GetPhotonView().isMine) || !active_me)
        {
            return;
        }

        switch (other.gameObject.tag)
        {
        case "playerHitbox":     // Another player
        {
            if (!FengGameManagerMKII.Level.PVP)
            {
                return;
            }

            HitBox hitbox = other.gameObject.GetComponent <HitBox>();
            if (hitbox == null || hitbox.transform.root == null)
            {
                return;
            }

            HERO hero = hitbox.transform.root.GetComponent <HERO>();
            if (hero != null && hero.myTeam != myTeam && !hero.IsInvincible())
            {
                float damage = 1f - Vector3.Distance(other.gameObject.transform.position, base.transform.position) * 0.05f;
                damage = Mathf.Min(1f, damage);

                if (IN_GAME_MAIN_CAMERA.Gametype == GameType.Singleplayer)
                {
                    if (!hero.isGrabbed)
                    {
                        hero.Die((hitbox.transform.root.transform.position - base.transform.position).normalized * damage * 1000f + Vector3.up * 50f, isBite: false);
                    }
                }
                else if (IN_GAME_MAIN_CAMERA.Gametype == GameType.Multiplayer && !hero.HasDied() && !hero.isGrabbed)
                {
                    hero.MarkDead();
                    hero.photonView.RPC("netDie", PhotonTargets.All, (hitbox.transform.root.position - base.transform.position).normalized * damage * 1000f + Vector3.up * 50f, false, viewID, ownerName, false);
                }
            }
            break;
        }

        case "erenHitbox":     // Eren, idk where his hitbox is LOL
        {
            if (dmg > 0 && !other.gameObject.transform.root.gameObject.GetComponent <TITAN_EREN>().isHit)
            {
                other.gameObject.transform.root.gameObject.GetComponent <TITAN_EREN>().HitByTitan();
            }
            break;
        }

        case "titanneck":     // Normal/Female/Colossal Titan nape
        {
            HitBox hitbox = other.gameObject.GetComponent <HitBox>();
            if (hitbox == null || !CheckIfBehind(hitbox.transform.root.gameObject) || currentHits.Contains(hitbox))
            {
                return;
            }
            hitbox.hitPosition = (base.transform.position + hitbox.transform.position) * 0.5f;
            currentHits.Add(hitbox);

            // Custom hit sound
            hitSound.Play();

            int damage = (int)((currentCamera.GetComponent <IN_GAME_MAIN_CAMERA>().main_object.rigidbody.velocity - hitbox.transform.root.rigidbody.velocity).magnitude * 10f * scoreMulti);
            damage = Mathf.Max(10, damage);

            // Local minimum damage
            if (damage < Guardian.Mod.Properties.LocalMinDamage.Value)
            {
                GameObject.Find("MultiplayerManager").GetComponent <FengGameManagerMKII>().ShowDamage(damage);
                return;
            }

            TITAN titan = hitbox.transform.root.GetComponent <TITAN>();
            if (IN_GAME_MAIN_CAMERA.Gametype == GameType.Singleplayer)
            {
                if (titan != null && !titan.hasDie)
                {
                    FengGameManagerMKII fgmkii = GameObject.Find("MultiplayerManager").GetComponent <FengGameManagerMKII>();
                    fgmkii.netShowDamage(damage);

                    if ((float)damage > titan.myLevel * 100f)
                    {
                        titan.Die();
                        if (PlayerPrefs.GetInt("EnableSS", 0) == 1)
                        {
                            currentCamera.GetComponent <IN_GAME_MAIN_CAMERA>().StartSnapshot2(hitbox.transform.position, damage, hitbox.transform.root.gameObject, 0.02f);
                        }
                        fgmkii.UpdatePlayerKillInfo(damage);
                    }
                }

                return;
            }

            if (titan != null)
            {
                if (!titan.hasDie)
                {
                    if ((float)damage > titan.myLevel * 100f)
                    {
                        if (PlayerPrefs.GetInt("EnableSS", 0) == 1)
                        {
                            currentCamera.GetComponent <IN_GAME_MAIN_CAMERA>().StartSnapshot2(hitbox.transform.position, damage, hitbox.transform.root.gameObject, 0.02f);
                        }
                        titan.photonView.RPC("titanGetHit", titan.photonView.owner, base.transform.root.gameObject.GetPhotonView().viewID, damage);
                    }
                }
            }
            else if ((bool)hitbox.transform.root.GetComponent <FEMALE_TITAN>())
            {
                FEMALE_TITAN ft = hitbox.transform.root.GetComponent <FEMALE_TITAN>();
                if (!ft.hasDie)
                {
                    ft.photonView.RPC("titanGetHit", ft.photonView.owner, base.transform.root.gameObject.GetPhotonView().viewID, damage);
                }
            }
            else if ((bool)hitbox.transform.root.GetComponent <COLOSSAL_TITAN>() && !hitbox.transform.root.GetComponent <COLOSSAL_TITAN>().hasDie)
            {
                hitbox.transform.root.GetComponent <COLOSSAL_TITAN>().photonView.RPC("titanGetHit", hitbox.transform.root.GetComponent <COLOSSAL_TITAN>().photonView.owner, base.transform.root.gameObject.GetPhotonView().viewID, damage);
            }

            ShowCriticalHitFX(other.gameObject.transform.position);
            break;
        }

        case "titaneye":     // Titan/Female Titan eyes
            if (currentHits.Contains(other.gameObject))
            {
                return;
            }
            currentHits.Add(other.gameObject);
            GameObject gameObject = other.gameObject.transform.root.gameObject;
            if ((bool)gameObject.GetComponent <FEMALE_TITAN>())
            {
                if (IN_GAME_MAIN_CAMERA.Gametype == GameType.Singleplayer)
                {
                    if (!gameObject.GetComponent <FEMALE_TITAN>().hasDie)
                    {
                        gameObject.GetComponent <FEMALE_TITAN>().hitEye();
                    }

                    return;
                }

                if (!gameObject.GetComponent <FEMALE_TITAN>().hasDie)
                {
                    gameObject.GetComponent <FEMALE_TITAN>().photonView.RPC("hitEyeRPC", PhotonTargets.MasterClient, base.transform.root.gameObject.GetPhotonView().viewID);
                }
            }
            else if (gameObject.GetComponent <TITAN>().abnormalType != TitanClass.Crawler)
            {
                if (IN_GAME_MAIN_CAMERA.Gametype == GameType.Singleplayer)
                {
                    if (!gameObject.GetComponent <TITAN>().hasDie)
                    {
                        gameObject.GetComponent <TITAN>().HitEye();
                    }

                    return;
                }

                if (!gameObject.GetComponent <TITAN>().hasDie)
                {
                    gameObject.GetComponent <TITAN>().photonView.RPC("hitEyeRPC", PhotonTargets.MasterClient, base.transform.root.gameObject.GetPhotonView().viewID);
                }
            }

            ShowCriticalHitFX(other.gameObject.transform.position);
            break;

        case "titanankle":     // Normal/Female Titan ankles
        {
            if (currentHits.Contains(other.gameObject))
            {
                return;
            }
            currentHits.Add(other.gameObject);

            GameObject gameObject2 = other.gameObject.transform.root.gameObject;

            TITAN titan = gameObject2.GetComponent <TITAN>();
            if (titan != null && titan.abnormalType != TitanClass.Crawler)
            {
                if (IN_GAME_MAIN_CAMERA.Gametype == GameType.Singleplayer)
                {
                    if (!titan.hasDie)
                    {
                        titan.HitAnkle();
                    }

                    return;
                }

                if (!titan.hasDie)
                {
                    titan.photonView.RPC("hitAnkleRPC", PhotonTargets.MasterClient, base.transform.root.gameObject.GetPhotonView().viewID);
                }
            }
            else if (gameObject2.GetComponent <FEMALE_TITAN>())
            {
                int damage = (int)((currentCamera.GetComponent <IN_GAME_MAIN_CAMERA>().main_object.rigidbody.velocity - gameObject2.rigidbody.velocity).magnitude * 10f * scoreMulti);
                damage = Mathf.Max(10, damage);

                // Local minimum damage
                if (damage < Guardian.Mod.Properties.LocalMinDamage.Value)
                {
                    GameObject.Find("MultiplayerManager").GetComponent <FengGameManagerMKII>().ShowDamage(damage);
                    return;
                }

                if (IN_GAME_MAIN_CAMERA.Gametype == GameType.Singleplayer)
                {
                    if (other.gameObject.name == "ankleR")
                    {
                        if ((bool)gameObject2.GetComponent <FEMALE_TITAN>() && !gameObject2.GetComponent <FEMALE_TITAN>().hasDie)
                        {
                            gameObject2.GetComponent <FEMALE_TITAN>().hitAnkleR(damage);
                        }
                    }
                    else if ((bool)gameObject2.GetComponent <FEMALE_TITAN>() && !gameObject2.GetComponent <FEMALE_TITAN>().hasDie)
                    {
                        gameObject2.GetComponent <FEMALE_TITAN>().hitAnkleL(damage);
                    }

                    return;
                }

                if (other.gameObject.name == "ankleR")
                {
                    if (!gameObject2.GetComponent <FEMALE_TITAN>().hasDie)
                    {
                        gameObject2.GetComponent <FEMALE_TITAN>().photonView.RPC("hitAnkleRRPC", PhotonTargets.MasterClient, base.transform.root.gameObject.GetPhotonView().viewID, damage);
                    }
                }
                else if (!gameObject2.GetComponent <FEMALE_TITAN>().hasDie)
                {
                    gameObject2.GetComponent <FEMALE_TITAN>().photonView.RPC("hitAnkleLRPC", PhotonTargets.MasterClient, base.transform.root.gameObject.GetPhotonView().viewID, damage);
                }
            }

            ShowCriticalHitFX(other.gameObject.transform.position);
            break;
        }
        }
    }