Esempio n. 1
0
 private void OnPicked(int seq)
 {
     statusDelta = 0f;
     if (MyInfoManager.Instance.Seq == RoomManager.Instance.Master)
     {
         localController.checkResetFlag = false;
     }
     if (seq == MyInfoManager.Instance.Seq)
     {
         if (localController != null)
         {
             localController.IDidSomething();
         }
         GetComponent <AudioSource>().PlayOneShot(sndFlagGet);
         PlaySoundDelay("Flag_allyget_4", 1.2f);
         statusMessage = string.Format(StringMgr.Instance.Get("PLAYER_GET_FLAG"), MyInfoManager.Instance.Nickname);
     }
     else
     {
         GameObject gameObject = BrickManManager.Instance.Get(seq);
         if (gameObject != null)
         {
             Transform[] componentsInChildren = gameObject.GetComponentsInChildren <Transform>();
             for (int i = 0; i < componentsInChildren.Length; i++)
             {
                 if (componentsInChildren[i].name.Contains("Bip01 Neck"))
                 {
                     UnityEngine.Object.Instantiate((UnityEngine.Object)effGetFlag, componentsInChildren[i].position, Quaternion.Euler(0f, 0f, 0f));
                 }
             }
             if (IsOurTeam(seq))
             {
                 PlaySoundDelay("Flag_allyget_4", 1.2f);
             }
             else
             {
                 PlaySoundDelay("Flag_enemyget_4", 1.2f);
             }
             BrickManDesc desc = BrickManManager.Instance.GetDesc(seq);
             statusMessage = string.Format(StringMgr.Instance.Get("PLAYER_GET_FLAG"), desc.Nickname);
         }
     }
 }
Esempio n. 2
0
 public override void Throw()
 {
     if ((bool)detonating)
     {
         UseAmmo();
         GameObject gameObject = GameObject.Find("Me");
         if (gameObject != null)
         {
             LocalController component = gameObject.GetComponent <LocalController>();
             if (component != null)
             {
                 component.IDidSomething();
             }
         }
         VoiceManager.Instance.Play("BKG400_throw_5");
         Ray        ray         = cam.ScreenPointToRay(new Vector3((float)(Screen.width / 2), (float)(Screen.height / 2), 0f));
         Vector3    vector      = ray.origin + Vector3.up * 0.5f;
         Vector3    eulerAngles = base.transform.rotation.eulerAngles;
         GameObject gameObject2 = Object.Instantiate((Object)GetComponent <Weapon>().BulletOrBody, vector, base.transform.rotation) as GameObject;
         if (null != gameObject2)
         {
             Rigidbody component2 = gameObject2.GetComponent <Rigidbody>();
             if (null != component2)
             {
                 component2.AddForce(ray.direction * throwForce, ForceMode.Impulse);
             }
             PrjGrenade component3 = gameObject2.GetComponent <PrjGrenade>();
             if (null != component3)
             {
                 WeaponFunction component4 = GetComponent <WeaponFunction>();
                 if (component4 == null)
                 {
                     Debug.LogError("wpnfunc == null");
                 }
                 TWeapon tWeapon = (TWeapon)GetComponent <Weapon>().tItem;
                 if (tWeapon == null)
                 {
                     Debug.LogError("wpn == null");
                 }
                 Item item = MyInfoManager.Instance.GetItemBySequence(component4.ItemSeq);
                 if (item == null)
                 {
                     item = MyInfoManager.Instance.GetUsingEquipByCode(tWeapon.code);
                 }
                 component3.Index            = base.CurAmmo;
                 component3.AtkPow           = CalcAtkPow();
                 component3.Rigidity         = Rigidity;
                 component3.WeaponBy         = weaponBy;
                 component3.WeaponByForChild = weaponByForChild;
                 component3.Radius           = Radius;
                 component3.Durability       = (item?.Durability ?? (-1));
                 component3.DurabilityMax    = tWeapon.durabilityMax;
                 component3.ApplyUsk         = applyUsk;
                 component3.DetonatorTime    = detonatorTime;
                 component3.ExplosionTime    = explosionTime;
             }
             P2PManager.Instance.SendPEER_PROJECTILE(MyInfoManager.Instance.Seq, base.CurAmmo, vector, eulerAngles);
         }
         detonating = false;
         ShowGrenade(body: false, clip: false);
         if (base.CurAmmo <= 0)
         {
             P2PManager.Instance.SendPEER_ENABLE_HANDBOMB(MyInfoManager.Instance.Seq, enable: false);
         }
     }
 }
Esempio n. 3
0
 private void Update()
 {
     if (BrickManager.Instance.IsLoaded)
     {
         NoCheat.Instance.KillCheater(NoCheat.WATCH_DOG.SPECIAL_AMMO, base.CurAmmo);
         ammoTime += Time.deltaTime;
         if (ammoTime > 1f)
         {
             ammoTime = 0f;
             if (!MyInfoManager.Instance.IsSpectator)
             {
                 P2PManager.Instance.SendPEER_ENABLE_HANDBOMB(MyInfoManager.Instance.Seq, base.CurAmmo > 0);
             }
         }
         VerifyCamera();
         VerifyLocalController();
         UpdateCrossEffect();
         if (CanThrow())
         {
             if (!(bool)detonating && custom_inputs.Instance.GetButtonDown("K_FIRE1"))
             {
                 GameObject gameObject = GameObject.Find("Me");
                 if (gameObject != null)
                 {
                     LocalController component = gameObject.GetComponent <LocalController>();
                     if (component != null)
                     {
                         component.IDidSomething();
                     }
                 }
                 RemoveSafetyClip();
             }
             if ((bool)detonating && custom_inputs.Instance.GetButtonUp("K_FIRE1"))
             {
                 localCtrl.DoThrowAnimation(throwAnimation);
                 P2PManager.Instance.SendPEER_THROW();
             }
         }
         if ((bool)detonating)
         {
             detonatorTime += Time.deltaTime;
             if (detonatorTime > explosionTime)
             {
                 UseAmmo();
                 if (!BuildOption.Instance.IsNetmarbleOrDev)
                 {
                     if (!BuildOption.Instance.Props.useUskMuzzleEff || !base.ApplyUsk)
                     {
                         if (explosion != null)
                         {
                             Object.Instantiate((Object)explosion, base.transform.position, Quaternion.Euler(0f, 0f, 0f));
                         }
                     }
                     else if (GlobalVars.Instance.explosionUsk != null)
                     {
                         Object.Instantiate((Object)GlobalVars.Instance.explosionUsk, base.transform.position, Quaternion.Euler(0f, 0f, 0f));
                     }
                 }
                 else if (explosion != null)
                 {
                     Object.Instantiate((Object)explosion, base.transform.position, Quaternion.Euler(0f, 0f, 0f));
                 }
                 P2PManager.Instance.SendPEER_PROJECTILE_KABOOM(MyInfoManager.Instance.Seq, -1);
                 if (localCtrl.IsUserDamaged())
                 {
                     localCtrl.GetHit(MyInfoManager.Instance.Seq, 1000, 1f, -10, -1, autoHealPossible: true, checkZombie: false);
                 }
                 else
                 {
                     localCtrl.GetHit(MyInfoManager.Instance.Seq, 1000, 1f, (int)weaponBy, -1, autoHealPossible: true, checkZombie: false);
                 }
                 CheckBoxmen();
                 CheckMonster();
                 CheckDestructibles();
                 Restart();
             }
         }
     }
 }