public static void Airdrop()
        {
            int     loc     = Random.RandomRange(1, 13);
            string  arg     = string.Empty;
            string  string_ = string.Empty;
            string  str     = string.Empty;
            Vector3 val     = default(Vector3);

            val = new Vector3(0f, 0f, 0f);
            switch (loc)
            {
            case 1:
                arg     = "Airdrop will fall to the Summerside Peninsula";
                string_ = "Airdop was fallen on Summerside Peninsula!";
                val     = new Vector3(790f, 24f, -450f);
                str     = "Take airdrop on Summerside Peninsula";
                break;

            case 2:
                arg     = "Airdrop will fall to the Burywood";
                string_ = "Airdrop was fallen on Burywood!";
                val     = new Vector3(50f, 23f, 700f);
                str     = "Take airdrop on BuryWood";
                break;

            case 3:
                arg     = "Airdrop will fall to the Courtin Island";
                string_ = "Airdrop was fallen on Courtin Island!";
                val     = new Vector3(890f, 22f, 500f);
                str     = "Take airdrop on Courtin Island";
                break;

            case 4:
                arg     = "Airdrop will fall to the Belfast Airport";
                string_ = "Airdrop was fallen on Belfast Airport!";
                val     = new Vector3(600f, 25f, 468f);
                str     = "Take airdrop on Belfast Airport";
                break;

            case 5:
                arg     = "Airdrop will fall to the Holman Island";
                string_ = "Airdrop was fallen on Holman Island!";
                val     = new Vector3(-770f, 29f, -760f);
                str     = "Take airdrop on Holman Island";
                break;

            case 6:
                arg     = "Airdrop will fall to the O'Leary Military Base";
                string_ = "Airdrop was fallen on O'Leary Military Base!";
                val     = new Vector3(-440f, 26f, 607f);
                str     = "Take airdrop on Military Base";
                break;

            case 7:
                arg     = "Airdrop will fall to the Alberton";
                string_ = "Airdrop was fallen on Alberton!";
                val     = new Vector3(-580f, 19f, 87f);
                str     = "Take airdrop on Alberton";
                break;

            case 8:
                arg     = "Airdrop will fall to the Charlottetown";
                string_ = "Airdrop was fallen on Charlottetown!";
                val     = new Vector3(22f, 18f, -432f);
                str     = "Take airdrop on Charlottetown";
                break;

            case 9:
                arg     = "Airdrop will fall to the Montague";
                string_ = "Airdrop was fallen on Montague!";
                val     = new Vector3(250f, 30f, -100f);
                str     = "Take airdrop on Montague";
                break;

            case 10:
                arg     = "Airdrop will fall to the Oultons Isle";
                string_ = "Airdrop was fallen on Oultons Isle!";
                val     = new Vector3(200f, 28f, -825f);
                str     = "Take airdrop on Oultons Isle";
                break;

            case 11:
                arg     = "Airdrop will fall to the St. Peter's Island";
                string_ = "Airdrop was fallen on St. Peter's Island!";
                val     = new Vector3(-245.4355f, 27.7f, 47.64797f);
                str     = "Take airdrop on St. Peter's Island";
                break;

            case 12:
                arg     = "Airdrop will fall to the Fernwood Farm";
                string_ = "Airdrop was fallen on Fernwood Farm!";
                val     = new Vector3(-244.4423f, 25.5f, -376.0898f);
                str     = "Take airdrop on Fernwood Farm";
                break;

            case 13:
                arg     = "Airdrop will fall to the Wiltshire Farm";
                string_ = "Airdrop was fallen on Wiltshire Farm!";
                val     = new Vector3(-451.6884f, 27.3f, -563.936f);
                str     = "Take airdrop on Wiltishire Farm";
                break;
            }
            for (int i = 5; i >= 1; i--)
            {
                NetworkChat.sendAlert($"{arg} after {i} min");
                Thread.Sleep(60000);
            }
            NetworkChat.sendAlert(string_);
            for (int i = 0; i < itemAmountForDrop; i++)
            {
                int   int_ = items[Random.Range(0, items.Length)];
                float num3 = Random.Range(0, 5);
                float num4 = Random.Range(0, 5);
                SpawnItems.spawnItem(int_, 1, new Vector3(val.x + num3, val.y, val.z + num4));
            }
            NetworkSounds.askSoundMax("Sounds/spooky/spooky_3", val, 500f, 1f, 700f, 3500f);
            for (int num5 = 1000; num5 > 0; num5--)
            {
                if (announceWhilePlayerTook)
                {
                    for (int j = 0; j < UserList.users.Count; j++)
                    {
                        BetterNetworkUser val2 = UserList.users[j];
                        float             num6 = Mathf.Abs(Vector3.Distance(val, val2.position));
                        if (num6 < 10.5f)
                        {
                            NetworkChat.sendAlert(val2.name + " " + str);
                            NetworkSounds.askSoundMax("Sounds/spooky/spooky_0", val, 500f, 1f, 700f, 3500f);
                            return;
                        }
                    }
                }
                if (enableEffects)
                {
                    int num7 = 0;
                    for (int k = 0; k < 25; k++)
                    {
                        NetworkEffects.askEffect("Effects/sparksRed", new Vector3(val.x, val.y + (float)num7, val.z), Quaternion.Euler(-90f, 0f, 0f), 100f);
                        num7 += 2;
                    }
                    NetworkSounds.askSound("Sounds/projectiles/smoke", val, 500f, 1f, 700f);
                }
                Thread.Sleep(300);
            }
        }
Пример #2
0
    public void destroyBarricade(Vector3 position)
    {
        int indexFromPositionServer;

        ClientItem[,] crateItems;
        Point2  region  = NetworkRegions.getRegion(position);
        bool    flag    = false;
        int     item    = -1;
        Vector3 vector3 = Vector3.zero;

        if (Network.isServer)
        {
            indexFromPositionServer = SpawnBarricades.getIndexFromPositionServer(region, position);
            if (SpawnBarricades.regions[region.x, region.y].barricades[indexFromPositionServer].id == 16019 || SpawnBarricades.regions[region.x, region.y].barricades[indexFromPositionServer].id == 16025 || SpawnBarricades.regions[region.x, region.y].barricades[indexFromPositionServer].id == 16023)
            {
                if (SpawnBarricades.regions[region.x, region.y].barricades[indexFromPositionServer].id != 16019)
                {
                    string[] strArrays = Packer.unpack(SpawnBarricades.regions[region.x, region.y].barricades[indexFromPositionServer].state, '\u005F');
                    crateItems = InteractionInterface.getCrateItems(SpawnBarricades.regions[region.x, region.y].barricades[indexFromPositionServer].id, Sneaky.expose(strArrays[2]));
                }
                else
                {
                    crateItems = InteractionInterface.getCrateItems(SpawnBarricades.regions[region.x, region.y].barricades[indexFromPositionServer].id, Sneaky.expose(SpawnBarricades.regions[region.x, region.y].barricades[indexFromPositionServer].state));
                }
                for (int i = 0; i < 2; i++)
                {
                    for (int j = 0; j < BarricadeStats.getCapacity(SpawnBarricades.regions[region.x, region.y].barricades[indexFromPositionServer].id); j++)
                    {
                        if (!ItemStackable.getStackable(crateItems[i, j].id))
                        {
                            SpawnItems.drop(crateItems[i, j].id, crateItems[i, j].amount, crateItems[i, j].state, position);
                        }
                        else
                        {
                            for (int k = 0; k < crateItems[i, j].amount; k++)
                            {
                                SpawnItems.drop(crateItems[i, j].id, 1, crateItems[i, j].state, position);
                            }
                        }
                    }
                }
            }
            else if (ExplosiveStats.getDamage(SpawnBarricades.regions[region.x, region.y].barricades[indexFromPositionServer].id) != 0)
            {
                flag = true;
                item = SpawnBarricades.regions[region.x, region.y].barricades[indexFromPositionServer].id;
                if (SpawnBarricades.regions[region.x, region.y].barricades[indexFromPositionServer].id != 16015)
                {
                    vector3 = position + Vector3.up;
                    NetworkEffects.askEffect("Effects/grenade", position, Quaternion.Euler(-90f, 0f, 0f), -1f);
                    NetworkSounds.askSoundMax("Sounds/Projectiles/grenade", position, 1f, UnityEngine.Random.Range(0.95f, 1.05f), 4f, 64f);
                }
                else
                {
                    vector3 = position + SpawnBarricades.regions[region.x, region.y].models[indexFromPositionServer].transform.up;
                    NetworkEffects.askEffect("Effects/bomb", position, Quaternion.Euler(-90f, 0f, 0f), -1f);
                    NetworkSounds.askSoundMax("Sounds/Projectiles/bomb", position, 1f, UnityEngine.Random.Range(0.95f, 1.05f), 4f, 64f);
                }
            }
            if (indexFromPositionServer != -1 && indexFromPositionServer < SpawnBarricades.regions[region.x, region.y].barricades.Count)
            {
                SpawnBarricades.regions[region.x, region.y].barricades.RemoveAt(indexFromPositionServer);
            }
        }
        indexFromPositionServer = SpawnBarricades.getIndexFromPositionClient(region, position);
        if (indexFromPositionServer != -1 && indexFromPositionServer < SpawnBarricades.regions[region.x, region.y].models.Count)
        {
            UnityEngine.Object.Destroy(SpawnBarricades.regions[region.x, region.y].models[indexFromPositionServer]);
            SpawnBarricades.regions[region.x, region.y].models.RemoveAt(indexFromPositionServer);
        }
        if (flag)
        {
            ExplosionTool.explode(vector3, (float)ExplosiveStats.getRange(item), ExplosiveStats.getDamage(item));
        }
    }
Пример #3
0
    public void Update()
    {
        if (this.real)
        {
            if (Network.isServer)
            {
                if (base.transform.position.y < Ocean.level - 1f && this.health != this.maxHealth)
                {
                    base.networkView.RPC("tellHealth", RPCMode.All, new object[] { this.maxHealth });
                }
                if ((this.wrecked || this.exploded) && this.headlights)
                {
                    base.networkView.RPC("tellHeadlights", RPCMode.All, new object[] { false });
                }
                if ((this.wrecked || this.exploded) && this.sirens)
                {
                    base.networkView.RPC("tellSirens", RPCMode.All, new object[] { false });
                }
                if (!this.wrecked)
                {
                    if (base.transform.position.y < Ocean.level - 1f)
                    {
                        this.wrecked = true;
                        base.networkView.RPC("tellWrecked", RPCMode.All, new object[] { true });
                    }
                    else if (this.health < 10)
                    {
                        this.wrecked = true;
                        base.networkView.RPC("tellWrecked", RPCMode.All, new object[] { true });
                    }

                    // Checking if NOW wrecked
                    if (this.wrecked)
                    {
                        this.ejectAll();
                        this.lastWrecked = Time.realtimeSinceStartup;
                    }
                    else if (this.lastSpeed != 0 && Time.realtimeSinceStartup - this.lastPump > 3f && this.fuel > 0)
                    {
                        this.lastPump = Time.realtimeSinceStartup;
                        this.burn(1);
                        if (this.fuel == 0)
                        {
                            base.networkView.RPC("tellHeadlights", RPCMode.All, new object[] { false });
                            base.networkView.RPC("tellSirens", RPCMode.All, new object[] { false });
                        }
                    }
                }
                else if (Time.realtimeSinceStartup - this.lastWrecked > 10f && !this.exploded && base.transform.position.y > Ocean.level - 1f)
                {
                    this.exploded = true;
                    base.networkView.RPC("tellExploded", RPCMode.All, new object[] { true });
                    ExplosionTool.explode(base.transform.position + base.transform.forward, 10f, 70);
                    NetworkEffects.askEffect("Effects/bomb", this.position, Quaternion.Euler(-90f, 0f, 0f), -1f);
                    NetworkSounds.askSoundMax("Sounds/Projectiles/bomb", this.position, 1f, UnityEngine.Random.Range(0.95f, 1.05f), 4f, 64f);
                    base.rigidbody.AddForce(new Vector3(0f, 20f, 0f), ForceMode.Impulse);
                    base.rigidbody.AddTorque(new Vector3((float)UnityEngine.Random.Range(-20, 20), 0f, 0f), ForceMode.Impulse);
                    base.Invoke("removeFromWorld", 30f);
                }

                if (this.lastSpeed == 0)
                {
                    this.lastPump = Time.realtimeSinceStartup + 1f;
                }
                if (this.passengers[0] == null && (double)(Time.realtimeSinceStartup - this.lastTick) > 0.2)
                {
                    this.lastTick = Time.realtimeSinceStartup;
                    if ((base.transform.position - this.lastPosition).sqrMagnitude > 1f)
                    {
                        this.lastPosition = this.position;
                        base.networkView.RPC("updatePosition", RPCMode.All, new object[] { base.transform.position, base.transform.rotation });
                    }
                }
            }
            if ((Movement.vehicle != this || !Movement.isDriving) && (!Network.isServer || this.passengers[0] != null))
            {
                base.rigidbody.MovePosition(Vector3.Lerp(base.transform.position, this.position, (float)NetworkInterpolation.INTERPOLATION_RATE * Time.deltaTime));
                base.rigidbody.MoveRotation(Quaternion.Lerp(base.transform.rotation, this.rotation, (float)NetworkInterpolation.INTERPOLATION_RATE * Time.deltaTime));
            }
            if (this.sirens)
            {
                if (Time.realtimeSinceStartup % 0.717f >= 0.3585f)
                {
                    base.transform.FindChild("siren").light.color = Color.blue;
                }
                else
                {
                    base.transform.FindChild("siren").light.color = Color.red;
                }
            }
            AudioSource audioSource = base.audio;
            float       single      = base.audio.volume;
            if (this.fuel <= 0)
            {
                fuel = 0;
            }
            else
            {
                fuel = 1;
            }
        }
    }