예제 #1
0
    public void BuildUnit(int headID, int bodyID, int lArmID, int weaponLID, int rArmID, int weaponRID, int legID, Transform pos)
    {
        //pos.rotation = Quaternion.Euler(0, 0, 0);//パーツ生成時に向きを合わせる
        GameObject leg = Instantiate(partsList.GetLegObject(legID));

        leg.transform.position = pos.position;
        leg.transform.parent   = pos;
        Leg = leg.GetComponent <PartsLeg>();
        GameObject body = Instantiate(partsList.GetBodyObject(bodyID));

        body.transform.parent = Leg.transform;
        Body = body.GetComponent <PartsBody>();
        Body.TransFormParts(Leg.GetPartsHigh().position);
        GameObject head = Instantiate(partsList.GetHeadObject(headID));

        head.transform.parent = Body.transform;
        Head = head.GetComponent <PartsHead>();
        Head.TransFormParts(Body.GetHeadPos().position);
        GameObject lArm = Instantiate(partsList.GetLArmObject(lArmID));

        lArm.transform.parent = Body.transform;
        LArm = lArm.GetComponent <PartsLArm>();
        LArm.TransFormParts(Body.GetLArmPos().position);
        GameObject weaponL = Instantiate(partsList.GetWeaponObject(weaponLID));

        weaponL.transform.parent = LArm.ArmParts().transform;
        LArmWeapon = weaponL.GetComponent <Weapon>();
        LArmWeapon.TransFormParts(LArm.GetGrip().position);
        GameObject rArm = Instantiate(partsList.GetRArmObject(rArmID));

        rArm.transform.parent = Body.transform;
        RArm = rArm.GetComponent <PartsRArm>();
        RArm.TransFormParts(Body.GetRArmPos().position);
        GameObject weaponR = Instantiate(partsList.GetWeaponObject(weaponRID));

        weaponR.transform.parent = RArm.ArmParts().transform;
        RArmWeapon = weaponR.GetComponent <Weapon>();
        RArmWeapon.TransFormParts(RArm.GetGrip().position);
    }
예제 #2
0
 public void BuildUnit(int headID, int bodyID, int lArmID, int weaponLID, int rArmID, int weaponRID, int legID)
 {
     if (!silhouetteOn)
     {
         transform.rotation = Quaternion.Euler(0, 0, 0);//パーツ生成時に向きを合わせる
         GameObject leg = Instantiate(partsList.GetLegObject(legID));
         leg.transform.position = transform.position;
         leg.transform.parent   = transform;
         Leg = leg.GetComponent <PartsLeg>();
         GameObject body = Instantiate(partsList.GetBodyObject(bodyID));
         body.transform.parent = Leg.transform;
         Body = body.GetComponent <PartsBody>();
         Body.TransFormParts(Leg.GetPartsHigh().position);
         GameObject head = Instantiate(partsList.GetHeadObject(headID));
         head.transform.parent = Body.transform;
         Head = head.GetComponent <PartsHead>();
         Head.TransFormParts(Body.GetHeadPos().position);
         GameObject lArm = Instantiate(partsList.GetLArmObject(lArmID));
         lArm.transform.parent = Body.transform;
         LArm = lArm.GetComponent <PartsLArm>();
         LArm.TransFormParts(Body.GetLArmPos().position);
         GameObject weaponL = Instantiate(partsList.GetWeaponObject(weaponLID));
         weaponL.transform.parent = LArm.ArmParts().transform;
         LArmWeapon = weaponL.GetComponent <Weapon>();
         LArmWeapon.TransFormParts(LArm.GetGrip().position);
         GameObject rArm = Instantiate(partsList.GetRArmObject(rArmID));
         rArm.transform.parent = Body.transform;
         RArm = rArm.GetComponent <PartsRArm>();
         RArm.TransFormParts(Body.GetRArmPos().position);
         GameObject weaponR = Instantiate(partsList.GetWeaponObject(weaponRID));
         weaponR.transform.parent = RArm.ArmParts().transform;
         RArmWeapon = weaponR.GetComponent <Weapon>();
         RArmWeapon.TransFormParts(RArm.GetGrip().position);
         silhouetteOn    = true;
         partsTotalPlice = Body.GetPrice() + Head.GetPrice() + LArm.GetPrice() + RArm.GetPrice() + Leg.GetPrice() + LArmWeapon.GetPrice() + RArmWeapon.GetPrice();
         unitNumber.text = "機体番号:" + j + "\n価格" + partsTotalPlice;
     }
 }