Esempio n. 1
0
        private void skyDrop(List <Vector3> pos)
        {
            UnturnedEffect skyDrop = UnturnedEffectManager.GetEffectsById(Feast.Instance.Configuration.Instance.SkydropEffectId);

            foreach (Vector3 p in pos)
            {
                skyDrop.Trigger(new Vector3(p.x, p.y + 45, p.z));
            }
        }
Esempio n. 2
0
        internal void runFeast()
        {
            // Get how many items are going to drop and setup the item id list.
            int        itemsNum = UnityEngine.Random.Range((int)Feast.Instance.Configuration.Instance.MinItemsDrop, (int)Feast.Instance.Configuration.Instance.MaxItemsDrop + 1);
            List <int> list     = new List <int>();

            foreach (FeastItem current in Feast.Instance.Configuration.Instance.Items)
            {
                if (current.Location.Contains(Feast.Instance.nextLocation.Name) || current.Location.Contains("all") || current.Location.Contains("All"))
                {
                    for (byte b = 0; b < current.Chance; b++)
                    {
                        list.Add(current.Id);
                    }
                }
            }

            // Figure out the base point of the feast drop.
            Vector3 p = Feast.Instance.nextLocation.Pos;

            /*p.y = 500;
             * RaycastHit hit;
             * Physics.Raycast(p, Vector3.down, out hit, 500);
             * p = hit.point;*/

            // Get the ending item positions and items
            List <Vector3> drops = new List <Vector3>();
            List <Item>    items = new List <Item>();

            for (int i = 0; i < itemsNum; i++)
            {
                int     item = UnityEngine.Random.Range(0, list.Count);
                int     num2 = list[item];
                Vector3 pos1 = new Vector3();
                pos1.x += p.x + (float)UnityEngine.Random.Range((int)Feast.Instance.Configuration.Instance.DropRadius * -1, (int)Feast.Instance.Configuration.Instance.DropRadius + 1);
                pos1.z += p.z + (float)UnityEngine.Random.Range((int)Feast.Instance.Configuration.Instance.DropRadius * -1, (int)Feast.Instance.Configuration.Instance.DropRadius + 1);
                pos1.y  = 200;
                RaycastHit hit;
                Physics.Raycast(pos1, Vector3.down, out hit, 500);
                Vector3 pos = hit.point;
                Item    g   = new Item((ushort)num2, true);
                //drops[i] = pos;
                drops.Add(pos);
                //items[i] = g;
                items.Add(g);
                list.RemoveAt(item);
            }
            Feast.Instance.numItems = itemsNum;
            Feast.Instance.drops    = drops;
            Feast.Instance.items    = items;
            // See if skydrop is turned on.  If it is, let's start the effects.

            if (Feast.Instance.Configuration.Instance.SkyDrop)
            {
                // Trigger timer for effects
                UnturnedEffect plane = UnturnedEffectManager.GetEffectsById(Feast.Instance.Configuration.Instance.PlaneEffectId);
                if (plane == null)
                {
                    Logger.Log("The skydrop plane bundle is not the server!  Cannot trigger the airdrop animation.  Just sending items.");
                    this.spawnItems(this.items, drops);
                }
                else
                {
                    Vector3 loc = new Vector3(Feast.Instance.nextLocation.Pos.x, Feast.Instance.nextLocation.Pos.y + 50, Feast.Instance.nextLocation.Pos.z + 500);
                    plane.Trigger(loc);
                    Feast.Instance.effectNum = 1;
                    Feast.Instance.Timer.Start();
                }
            }
            else
            {
                // No effects, just spawn in the items on the ground.
                this.spawnItems(this.items, drops);
            }

            // Reset the feast for the next round.
            Feast.Instance.resetFeast();
        }