Esempio n. 1
0
 public void askAirdropState(CSteamID steamID)
 {
     for (int i = 0; i < LevelManager.airdrops.Count; i++)
     {
         AirdropInfo airdropInfo = LevelManager.airdrops[i];
         base.channel.send("tellAirdropState", steamID, ESteamPacket.UPDATE_RELIABLE_BUFFER, new object[]
         {
             airdropInfo.state,
             airdropInfo.direction,
             airdropInfo.delay
         });
     }
 }
Esempio n. 2
0
        private void airdropSpawn(ushort id, Vector3 state, Vector3 direction, float delay)
        {
            AirdropInfo airdropInfo = new AirdropInfo();

            airdropInfo.id        = id;
            airdropInfo.state     = state;
            airdropInfo.direction = direction;
            airdropInfo.delay     = delay;
            airdropInfo.dropped   = false;
            if (!Dedicator.isDedicated)
            {
                Transform transform = ((GameObject)Object.Instantiate(Resources.Load("Level/Dropship"))).transform;
                transform.name     = "Dropship";
                transform.parent   = Level.effects;
                transform.position = state;
                transform.rotation = Quaternion.LookRotation(direction) * Quaternion.Euler(-90f, 180f, 0f);
                airdropInfo.model  = transform;
            }
            LevelManager.airdrops.Add(airdropInfo);
        }
Esempio n. 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;
         }
     }
 }