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>()); }
/* Use this to check for lethal damage etc */ public void CheckForDamage() { if (sectionManager.torsoSection.IsDestroyed) { totallyDestroyed = true; gameObject.SetActive(false); } if (sectionManager.GetSectionByIndex((int)SectionIndex.torso) == null || sectionManager.GetSectionByIndex((int)SectionIndex.torso).IsDestroyed) { } if (sectionManager.GetSectionByIndex((int)SectionIndex.head) == null || sectionManager.GetSectionByIndex((int)SectionIndex.head).IsDestroyed) { } if (sectionManager.GetSectionByIndex((int)SectionIndex.legs) == null || sectionManager.GetSectionByIndex((int)SectionIndex.legs).IsDestroyed) { } }