Example #1
0
        /// <summary>
        /// 反序列化部件
        /// </summary>
        /// <param name="part"></param>
        /// <param name="weapon"></param>
        /// <returns></returns>
        static MonoPart DeserializeParts(PreserializedPart part, PreserializedWeapon weapon)
        {
            if (part.containedParts == null)
            {
                return(null);
            }

            var portCount = part.containedParts.Length;
            var prefab    = WAPrefabStore.GetPartPrefab(part.prefabID);
            var mPart     = GameObject.Instantiate(prefab.gameObject).GetComponent <MonoPart>();
            var ports     = mPart.Ports.ToArray();

            for (int i = 0; i < ports.Length; i++)
            {
                if (part.containedParts[i] < 0)
                {
                    continue;
                }
                var index = part.containedParts[i];

                // TODO: Remove Workspace dependence?
                Workspace.Workspace.InstallPart((MonoPort)ports[i], DeserializeParts(weapon.containedParts[index], weapon));
            }

            return(mPart);
        }
Example #2
0
    void GameOver()
    {
        huanhu.Play();
        AudioSource.PlayClipAtPoint(shengli, transform.position);

        if (Menu.level == 1)
        {
            if (!Menu.roomNum[1, Menu.level] == true)
            {
                Menu.roomNum[1, Menu.level] = true;
                Menu.balabala[1]           += 0.333f;
            }
            if (killNum >= kill)
            {
                if (!Menu.roomNum[2, Menu.level] == true)
                {
                    Menu.roomNum[2, Menu.level] = true;
                    PlayerWeaponStorage.ReturnPart(Instantiate(WAPrefabStore.GetPartPrefab("A1_Si_V1")));
                    PlayerWeaponStorage.ReturnPart(Instantiate(WAPrefabStore.GetPartPrefab("A1_Ba_V1")));
                    Menu.balabala[1] += 0.333f;
                }
            }
            if (!anquanjuli)
            {
                if (!Menu.roomNum[3, Menu.level] == true)
                {
                    Menu.roomNum[3, Menu.level] = true;
                    PlayerWeaponStorage.ReturnPart(Instantiate(WAPrefabStore.GetPartPrefab("M4A1_R_V1")));
                    PlayerWeaponStorage.ReturnPart(Instantiate(WAPrefabStore.GetPartPrefab("A1_M_V1")));
                    PlayerWeaponStorage.ReturnPart(Instantiate(WAPrefabStore.GetPartPrefab("M4A1_B_V1")));
                    PlayerWeaponStorage.ReturnPart(Instantiate(WAPrefabStore.GetPartPrefab("M4A1_St_V1")));
                    Menu.balabala[1] += 0.333f;
                }
            }
        }
        if (Menu.level == 2)
        {
            if (!Menu.roomNum[1, Menu.level] == true)
            {
                Menu.roomNum[1, Menu.level] = true;
                Menu.balabala[2]           += 0.333f;
            }
            if (time <= 60)
            {
                if (!Menu.roomNum[2, Menu.level] == true)
                {
                    Menu.roomNum[2, Menu.level] = true;
                    PlayerWeaponStorage.ReturnPart(Instantiate(WAPrefabStore.GetPartPrefab("A3_Si_V1")));
                    PlayerWeaponStorage.ReturnPart(Instantiate(WAPrefabStore.GetPartPrefab("A1_A_V1")));
                    Menu.balabala[2] += 0.333f;
                }
            }
            if (time <= 35)
            {
                if (!Menu.roomNum[3, Menu.level] == true)
                {
                    Menu.roomNum[3, Menu.level] = true;
                    PlayerWeaponStorage.ReturnPart(Instantiate(WAPrefabStore.GetPartPrefab("A3_R_V1")));
                    PlayerWeaponStorage.ReturnPart(Instantiate(WAPrefabStore.GetPartPrefab("A3_M_V1")));
                    PlayerWeaponStorage.ReturnPart(Instantiate(WAPrefabStore.GetPartPrefab("A3_B_V1")));
                    PlayerWeaponStorage.ReturnPart(Instantiate(WAPrefabStore.GetPartPrefab("A1_St_V1")));
                    Menu.balabala[2] += 0.333f;
                }
            }
        }
        if (Menu.level == 3)
        {
            if (!Menu.roomNum[1, Menu.level] == true)
            {
                Menu.roomNum[1, Menu.level] = true;
                Menu.balabala[3]           += 0.333f;
            }
            if (killNum <= kill)
            {
                if (!Menu.roomNum[2, Menu.level] == true)
                {
                    Menu.roomNum[2, Menu.level] = true;
                    PlayerWeaponStorage.ReturnPart(Instantiate(WAPrefabStore.GetPartPrefab("AWM_Si_V1")));
                    PlayerWeaponStorage.ReturnPart(Instantiate(WAPrefabStore.GetPartPrefab("A1_A_V2")));
                    Menu.balabala[3] += 0.333f;
                }
            }
            if (!anquanjuli)
            {
                if (!Menu.roomNum[3, Menu.level] == true)
                {
                    Menu.roomNum[3, Menu.level] = true;
                    PlayerWeaponStorage.ReturnPart(Instantiate(WAPrefabStore.GetPartPrefab("AWM_R_V1")));
                    PlayerWeaponStorage.ReturnPart(Instantiate(WAPrefabStore.GetPartPrefab("A4_M_V1")));
                    PlayerWeaponStorage.ReturnPart(Instantiate(WAPrefabStore.GetPartPrefab("A5_M_V1")));
                    PlayerWeaponStorage.ReturnPart(Instantiate(WAPrefabStore.GetPartPrefab("A1_St_V2")));
                    Menu.balabala[3] += 0.333f;
                }
            }
        }
        if (Menu.level == 4)
        {
            if (!Menu.roomNum[1, Menu.level] == true)
            {
                Menu.roomNum[1, Menu.level] = true;
                Menu.balabala[4]           += 0.333f;
            }
            if (killNum <= kill)
            {
                if (!Menu.roomNum[2, Menu.level] == true)
                {
                    Menu.roomNum[2, Menu.level] = true;
                    PlayerWeaponStorage.ReturnPart(Instantiate(WAPrefabStore.GetPartPrefab("7.62mm")));
                    PlayerWeaponStorage.ReturnPart(Instantiate(WAPrefabStore.GetPartPrefab("A2_Si_V1")));
                    PlayerWeaponStorage.ReturnPart(Instantiate(WAPrefabStore.GetPartPrefab("A1_Ba_V2")));
                    Menu.balabala[4] += 0.333f;
                }
            }
            if (anquanxiaoxiong)
            {
                if (!Menu.roomNum[3, Menu.level] == true)
                {
                    Menu.roomNum[3, Menu.level] = true;
                    PlayerWeaponStorage.ReturnPart(Instantiate(WAPrefabStore.GetPartPrefab("A2_R_V1")));
                    PlayerWeaponStorage.ReturnPart(Instantiate(WAPrefabStore.GetPartPrefab("A3_M_V2")));
                    PlayerWeaponStorage.ReturnPart(Instantiate(WAPrefabStore.GetPartPrefab("A2_B_V1")));
                    PlayerWeaponStorage.ReturnPart(Instantiate(WAPrefabStore.GetPartPrefab("AK47_St_V2")));
                    Menu.balabala[4] += 0.333f;
                }
            }
        }
        if (Menu.level == 5)
        {
            if (!Menu.roomNum[1, Menu.level] == true)
            {
                Menu.roomNum[1, Menu.level] = true;
                Menu.balabala[5]           += 0.333f;
            }
            if (anquanxiaoxiong)
            {
                if (!Menu.roomNum[2, Menu.level] == true)
                {
                    Menu.roomNum[2, Menu.level] = true;
                    PlayerWeaponStorage.ReturnPart(Instantiate(WAPrefabStore.GetPartPrefab("A1_Ad_V1")));
                    PlayerWeaponStorage.ReturnPart(Instantiate(WAPrefabStore.GetPartPrefab("A2_St_V1")));
                    Menu.balabala[5] += 0.333f;
                }
            }
            if (time <= 30)
            {
                if (!Menu.roomNum[3, Menu.level] == true)
                {
                    Menu.roomNum[3, Menu.level] = true;
                    PlayerWeaponStorage.ReturnPart(Instantiate(WAPrefabStore.GetPartPrefab("A1_R_V1")));
                    PlayerWeaponStorage.ReturnPart(Instantiate(WAPrefabStore.GetPartPrefab("A3_M_V3")));
                    PlayerWeaponStorage.ReturnPart(Instantiate(WAPrefabStore.GetPartPrefab("A1_B_V1")));
                    Menu.balabala[5] += 0.333f;
                }
            }
        }

        win = true;
    }