/// <summary> /// This function used to update turret's structure /// </summary> /// <param name="curStructure"></param> public void UpdateTurret(TurretStructure curStructure) { if (curStructure == null) { return; } UpdateBase(curStructure.Base); UpdateSwivel(curStructure.Swivel, curStructure.SwivelPrefix); UpdateHead(curStructure.Head, curStructure.HeadPrefix); UpdateMount(curStructure.Mount, curStructure.MountPrefix); UpdateBreeches(curStructure.WeaponBreeches, curStructure.WeaponSlotsNames, curStructure.WeaponBarrels, curStructure.WeaponBarrelSockets); }
//Updates turret structure to another public void UpdateFullTurret(TurretStructure struc) { if (!Application.isPlaying) { UpdateTurret(struc); if (struc.NeedLOD) { InstallLods(); } if (struc.HasTurretScript) { InstallTurretController(); } else { var tmp = GetComponent <F3DTurret>(); if (tmp != null) { tmp.destroyIt = true; } } } }
//Changes selected turret index to new value with new turret structure public void ChangeTurretIndex(int index, TurretStructure struc) { turretIndex = index; UpdateFullTurret(struc); }