Пример #1
0
    private void BuildClassWeapon(WeaponItem wItem, MechManager mechManager, SectionManager sectionManager, int secIndex, int subIndex, int classIndex)
    {
        if (wItem == null)
        {
            return;
        }

        /* Create the Wep */
        GameObject newWeapon = Object.Instantiate(wItem.prefab);

        newWeapon.transform.parent           = sectionManager.GetSectionLinksByIndex(secIndex, classIndex)[subIndex];
        newWeapon.transform.localPosition    = Vector3.zero;
        newWeapon.transform.localEulerAngles = Vector3.zero;

        /* Add the weapons to the MechManager on the mech encapsulating object */
        mechManager.GetWeaponObjByIndex(secIndex).Add(newWeapon);

        /* Add the ref to the parent section to the weapon's script */
        newWeapon.GetComponent <WeaponExecutable>().sectionParent = sectionManager.GetSectionByIndex(secIndex);
        newWeapon.GetComponent <WeaponExecutable>().mechManager   = mechManager;

        // Move into modify???
        /* Create an executable for the weapon and add it to MechManager ref */
        mechManager.GetExecutableByIndex(secIndex).Add(newWeapon.GetComponent <WeaponExecutable>());
    }