コード例 #1
0
        /// <summary>
        /// Prompts this resource node to drop one hit's worth of items.
        /// </summary>
        public virtual void DropItem(Vector3 pos)
        {
            GameObject drop = (GameObject)UnityEngine.Object.Instantiate(Resources.Load("i3"), pos, Quaternion.identity);

            int[] st = GadgetCoreAPI.ConstructIntArrayFromItem(ItemDrop);
            st[1] += UnityEngine.Random.Range(0, RandomDropBonus + 1);
            if (GameScript.challengeLevel > 0)
            {
                if (UnityEngine.Random.Range(0, 200) < GameScript.challengeLevel * 2)
                {
                    Camera.main.SendMessage("AUDSPEC2", SendMessageOptions.DontRequireReceiver);
                    int[] array = new int[11];
                    array[0] = UnityEngine.Random.Range(201, 221);
                    array[1] = 1;
                    int[]      value      = array;
                    GameObject gameObject = (GameObject)UnityEngine.Object.Instantiate(Resources.Load("i3"), pos, Quaternion.identity);
                    gameObject.SendMessage("InitL", value);
                }
                if (UnityEngine.Random.Range(0, 200) < GameScript.challengeLevel)
                {
                    Camera.main.SendMessage("AUDSPEC3", SendMessageOptions.DontRequireReceiver);
                    int[] array2 = new int[11];
                    array2[0] = UnityEngine.Random.Range(86, 89);
                    array2[1] = 1;
                    int[]      value2      = array2;
                    GameObject gameObject2 = (GameObject)UnityEngine.Object.Instantiate(Resources.Load("i3"), pos, Quaternion.identity);
                    gameObject2.SendMessage("InitL", value2);
                }
            }
            int randomBonus = UnityEngine.Random.Range(0, 90);

            if (Type == ObjectType.ORE)
            {
                randomBonus += (int)(GameScript.MODS[19] * 1.5f);
            }
            else if (Type == ObjectType.TREE || Type == ObjectType.PLANT)
            {
                randomBonus += (int)(GameScript.MODS[20] * 1.5f);
            }
            else if (Type == ObjectType.BUGSPOT)
            {
                randomBonus += (int)(GameScript.MODS[22] * 1.5f);
            }
            if (randomBonus > 110)
            {
                st[1] += 4;
            }
            else if (randomBonus > 100)
            {
                st[1] += 3;
            }
            else if (randomBonus > 90)
            {
                st[1] += 2;
            }
            else if (randomBonus > 80)
            {
                st[1] += 1;
            }
            drop.SendMessage("InitL", st);
        }