예제 #1
0
 // Token: 0x0600288B RID: 10379 RVA: 0x000F6B5C File Offset: 0x000F4F5C
 private void airdropInit()
 {
     LevelManager.lastAirdrop = Time.realtimeSinceStartup;
     LevelManager.airdrops    = new List <AirdropInfo>();
     if (Provider.isServer)
     {
         LevelManager.airdropNodes = new List <AirdropNode>();
         for (int i = 0; i < LevelNodes.nodes.Count; i++)
         {
             Node node = LevelNodes.nodes[i];
             if (node.type == ENodeType.AIRDROP)
             {
                 AirdropNode airdropNode = (AirdropNode)node;
                 if (airdropNode.id != 0)
                 {
                     LevelManager.airdropNodes.Add(airdropNode);
                 }
             }
         }
         LevelManager.load();
     }
 }
예제 #2
0
        // Token: 0x0600287B RID: 10363 RVA: 0x000F5A3C File Offset: 0x000F3E3C
        private void arenaAirdrop()
        {
            Vector3            arenaTargetCenter = LevelManager.arenaTargetCenter;
            float              arenaTargetRadius = LevelManager.arenaTargetRadius;
            float              num  = arenaTargetRadius * arenaTargetRadius;
            List <AirdropNode> list = new List <AirdropNode>();

            foreach (AirdropNode airdropNode in LevelManager.airdropNodes)
            {
                if ((airdropNode.point - arenaTargetCenter).sqrMagnitude < num)
                {
                    list.Add(airdropNode);
                }
            }
            if (list.Count == 0)
            {
                return;
            }
            AirdropNode airdropNode2 = list[UnityEngine.Random.Range(0, list.Count)];

            LevelManager.airdrop(airdropNode2.point, airdropNode2.id, Provider.modeConfigData.Events.Airdrop_Speed);
        }
예제 #3
0
 // Token: 0x0600288A RID: 10378 RVA: 0x000F6880 File Offset: 0x000F4C80
 private void airdropTick()
 {
     for (int i = LevelManager.airdrops.Count - 1; i >= 0; i--)
     {
         AirdropInfo airdropInfo = LevelManager.airdrops[i];
         airdropInfo.state += airdropInfo.direction * airdropInfo.speed * Time.deltaTime;
         airdropInfo.delay -= Time.deltaTime;
         if (airdropInfo.model != null)
         {
             airdropInfo.model.position = airdropInfo.state;
         }
         if (airdropInfo.dropped)
         {
             if (Mathf.Abs(airdropInfo.state.x) > (float)(Level.size / 2 + 2048) || Mathf.Abs(airdropInfo.state.z) > (float)(Level.size / 2 + 2048))
             {
                 if (airdropInfo.model != null)
                 {
                     UnityEngine.Object.Destroy(airdropInfo.model.gameObject);
                 }
                 LevelManager.airdrops.RemoveAt(i);
             }
         }
         else if (airdropInfo.delay <= 0f)
         {
             airdropInfo.dropped = true;
             Transform transform;
             if (Dedicator.isDedicated)
             {
                 transform = ((GameObject)UnityEngine.Object.Instantiate(Resources.Load("Level/Carepackage_Server"))).transform;
             }
             else
             {
                 transform = ((GameObject)UnityEngine.Object.Instantiate(Resources.Load("Level/Carepackage_Client"))).transform;
             }
             transform.name     = "Carepackage";
             transform.parent   = Level.effects;
             transform.position = airdropInfo.state;
             transform.rotation = Quaternion.identity;
             if (Provider.isServer)
             {
                 transform.GetComponent <Carepackage>().id = airdropInfo.id;
             }
             transform.GetComponent <ConstantForce>().force = new Vector3(0f, airdropInfo.force, 0f);
             if (Dedicator.isDedicated)
             {
                 LevelManager.airdrops.RemoveAt(i);
             }
         }
     }
     if (Provider.isServer && LevelManager.levelType == ELevelType.SURVIVAL && LevelManager.airdropNodes.Count > 0)
     {
         if (!LevelManager.hasAirdrop)
         {
             LevelManager.airdropFrequency = (uint)(UnityEngine.Random.Range(Provider.modeConfigData.Events.Airdrop_Frequency_Min, Provider.modeConfigData.Events.Airdrop_Frequency_Max) * LightingManager.cycle);
             LevelManager._hasAirdrop      = true;
             LevelManager.lastAirdrop      = Time.realtimeSinceStartup;
         }
         if (LevelManager.airdropFrequency > 0u)
         {
             if (Time.realtimeSinceStartup - LevelManager.lastAirdrop > 1f)
             {
                 LevelManager.airdropFrequency -= 1u;
                 LevelManager.lastAirdrop       = Time.realtimeSinceStartup;
             }
         }
         else
         {
             AirdropNode airdropNode = LevelManager.airdropNodes[UnityEngine.Random.Range(0, LevelManager.airdropNodes.Count)];
             LevelManager.airdrop(airdropNode.point, airdropNode.id, Provider.modeConfigData.Events.Airdrop_Speed);
             LevelManager._hasAirdrop = false;
         }
     }
 }