Example #1
0
 protected override void Update()
 {
     if (Time.time > m_nextCheckTime)
     {
         float num = m_damageIntervall;
         if (null == m_server)
         {
             m_server = Object.FindObjectOfType <LidServer>();
         }
         if (null != m_server)
         {
             Vector3      position      = base.transform.position;
             ServerPlayer nearestPlayer = m_server.GetNearestPlayer(position);
             if (nearestPlayer != null && nearestPlayer.m_pid != m_ownerPid && !m_server.PartyContainsPid(nearestPlayer.m_partyId, m_ownerPid))
             {
                 float sqrMagnitude = (nearestPlayer.GetPosition() - position).sqrMagnitude;
                 if (m_attackRadius * m_attackRadius > sqrMagnitude)
                 {
                     nearestPlayer.ChangeHealthBy(0f - m_damage);
                 }
                 num += ((!(sqrMagnitude > 2500f)) ? 0f : 4f);
             }
         }
         else
         {
             Object.Destroy(base.gameObject);
         }
         m_nextCheckTime = Time.time + num;
     }
     base.Update();
 }
Example #2
0
 private void Update()
 {
     if (null != m_aggressor && m_changeHealth != 0f && m_serverPlayer != null)
     {
         if (m_aggressor.gameObject.layer != 13 || !m_serverPlayer.IsSaint())
         {
             m_serverPlayer.ChangeHealthBy(m_changeHealth);
         }
         m_aggressor    = null;
         m_changeHealth = 0f;
     }
     if (m_testMode)
     {
         float axis  = Input.GetAxis("Horizontal");
         float axis2 = Input.GetAxis("Vertical");
         AssignInput(axis2, axis, false, false);
     }
     Move(Time.deltaTime);
 }
Example #3
0
 private void KillAndResetPassengers()
 {
     for (int i = 0; i < 4; i++)
     {
         if (this.m_data.passengerIds[i] != -1)
         {
             if (null != this.m_server)
             {
                 ServerPlayer playerByOnlineid = this.m_server.GetPlayerByOnlineid(this.m_data.passengerIds[i]);
                 if (playerByOnlineid != null)
                 {
                     playerByOnlineid.ChangeHealthBy(-10000f);
                 }
             }
             if (i == 0)
             {
                 this.m_vehicle.AssignInput(0f, 0f, false);
             }
             this.m_data.passengerIds[i] = -1;
         }
     }
 }