private void DoExtract(string input, string output) { VoiceIndex t = new VoiceIndex() { Entries = new List <IndexEntry>() }; if (!File.Exists(Path.Combine(input, "maplist"))) { MessageBox.Show("This FLevel is missing the maplist file"); return; } using (FileStream fileStream1 = new FileStream(Path.Combine(input, "maplist"), FileMode.Open)) { ushort num1 = Voices.Util.ReadUShortFrom((Stream)fileStream1, 0); byte[] numArray = new byte[32]; foreach (int num2 in Enumerable.Range(0, (int)num1)) { fileStream1.Position = (long)(2 + 32 * num2); fileStream1.Read(numArray, 0, 32); string str = Encoding.ASCII.GetString(numArray).Trim().TrimEnd(new char[1]); string path = Path.Combine(input, str); if (File.Exists(path)) { using (FileStream fileStream2 = new FileStream(path, FileMode.Open)) { VoiceList vl = Dumper.Dump((Stream)fileStream2, str); if (vl != null) { string file = Path.Combine(output, str + ".xml"); this.SetXML(vl, file); } else { continue; } } t.Entries.Add(new IndexEntry() { File = str + ".xml", FieldID = num2 }); } System.Diagnostics.Debug.WriteLine("Processed " + str); } } using (FileStream fileStream = new FileStream(Path.Combine(output, "index.xml"), FileMode.Create)) Voices.Util.Serialise <VoiceIndex>(t, (Stream)fileStream); }
void Update() { if (Warp) { _agent.Warp = true; } else { _agent.Warp = false; } if (IsFix) { _agent.SensorBlocking = true; } else { _agent.SensorBlocking = false; } if (Neutral) { if (Owner != null) { gameObject.GetComponent <ShipAI>().ShipIsСaptured(); Owner = null; } } if (Assimilated) { VoiceIndex _vi = gameObject.GetComponent <VoiceIndex>(); _vi.race = VoiceIndex.enRace.Borg; _vi.initRace(); } if (STDLCMethods.FindInList(gameObject, _GDB.selectList)) { Proector.GetComponent <MeshRenderer>().enabled = true; } else { Proector.GetComponent <MeshRenderer>().enabled = false; } if (orderstoptimer > 0) { orderstoptimer -= Time.deltaTime; } else { StopOrder = false; orderstoptimer = 0.5f; } if (AI || FreandAI) { gameObject.GetComponent <ShipAI>().enabled = true; } else { gameObject.GetComponent <ShipAI>().enabled = false; } if (targetTransform == gameObject.transform) { targetTransform = null; } if (!SelectLock) { if (TimerDown) { if (Timer > 0) { Timer -= Time.deltaTime; } if (Timer <= 0) { if (isSelect) { WasSelect = true; } Timer = 0.1f; TimerDown = false; } } if (Selected) { Camera.GetComponent <CameraRay>().Locker = false; //_select.Lock = false; } else { Camera.GetComponent <CameraRay>().Locker = true; //elect.Lock = true; } } else { //BoxSelected = false; //MeshLock = false; } if (AI) { gameObject.tag = "Enemy"; } if (!AI) { if (FreandAI && !Neutral && !NeutralAgrass) { gameObject.tag = "Freand"; } if (!FreandAI && !Neutral && !NeutralAgrass) { gameObject.tag = "Dwarf"; } } if (Neutral) { gameObject.tag = "Neutral"; } if (NeutralAgrass) { gameObject.tag = "NeutralAgrass"; } if (_HP.curTractorBeamSystemHealth > 0) { if (!_AS.Tractor.GetComponent <Tractor>().Use) { if (_HP.maxCrew > 0) { if (_HP.curImpulseSystemHealth > _HP.maxImpulseSystemHealth * 0.125f && !_HP.ActiveImpulse && _HP.curCrew > 0) { if (Vector3.Distance(gameObject.transform.position, targetVector) > 400) { if (_HP.curWarpEngingSystemHealth > _HP.maxWarpEngingSystemHealth * 0.125 && !_HP.ActiveWarpEnging && _HP.curWarpCoreHealth > _HP.maxWarpCoreHealth * 0.125 && !_HP.ActiveWarpCore) { if (!_agent.CUBETYPE) { if (!_agent.ForwardBlocked && Vector3.Distance(_agent.RightSensor.transform.position, _agent.TargetVector) < Vector3.Distance(_agent.LeftSensor.transform.position, _agent.TargetVector) + (0.1f * _agent.RotationSpeed) && Vector3.Distance(_agent.LeftSensor.transform.position, _agent.TargetVector) < Vector3.Distance(_agent.RightSensor.transform.position, _agent.TargetVector) + (0.1f * _agent.RotationSpeed) && Vector3.Distance(_agent.UpSensor.transform.position, _agent.TargetVector) < Vector3.Distance(_agent.DownSensor.transform.position, _agent.TargetVector) + (0.1f * _agent.RotationSpeed) && Vector3.Distance(_agent.DownSensor.transform.position, _agent.TargetVector) < Vector3.Distance(_agent.UpSensor.transform.position, _agent.TargetVector) + (0.1f * _agent.RotationSpeed)) { if (WarpEffectDelay > 0) { WarpEffect = true; WarpEffectDelay -= Time.deltaTime; } else { Warp = true; WarpEffect = false; } } else { Warp = false; WarpEffect = false; WarpEffectDelay = 0.5f; } } else { if (WarpEffectDelay > 0) { WarpEffect = true; WarpEffectDelay -= Time.deltaTime; } else { Warp = true; WarpEffect = false; } } } else { if (Warp) { Warp = false; WarpEffect = false; WarpEffectDelay = 0.5f; } } } if (Vector3.Distance(gameObject.transform.position, targetVector) <= 200) { if (Warp) { Warp = false; WarpEffect = false; WarpEffectDelay = 0.5f; } } } else { Warp = false; WarpEffect = false; WarpEffectDelay = 0.5f; _agent.Warp = false; } } else { if (_HP.curImpulseSystemHealth > _HP.maxImpulseSystemHealth * 0.125f && !_HP.ActiveImpulse) { if (Vector3.Distance(gameObject.transform.position, targetVector) > 400) { if (_HP.curWarpEngingSystemHealth > _HP.maxWarpEngingSystemHealth * 0.125 || !_HP.ActiveWarpEnging) { Warp = true; } else { if (Warp) { Warp = false; } } } if (Vector3.Distance(gameObject.transform.position, targetVector) <= 200) { if (Warp) { Warp = false; } } } else { Warp = false; } } } } else { if (_HP.maxCrew > 0) { if (_HP.curImpulseSystemHealth > _HP.maxImpulseSystemHealth * 0.125f && !_HP.ActiveImpulse && _HP.curCrew > 0) { if (Vector3.Distance(gameObject.transform.position, targetVector) > 400) { if (_HP.curWarpEngingSystemHealth > _HP.maxWarpEngingSystemHealth * 0.125 && !_HP.ActiveWarpEnging && _HP.curWarpCoreHealth > _HP.maxWarpCoreHealth * 0.125 && !_HP.ActiveWarpCore) { if (!_agent.CUBETYPE) { if (!_agent.ForwardBlocked && Vector3.Distance(_agent.RightSensor.transform.position, _agent.TargetVector) < Vector3.Distance(_agent.LeftSensor.transform.position, _agent.TargetVector) + (0.1f * _agent.RotationSpeed) && Vector3.Distance(_agent.LeftSensor.transform.position, _agent.TargetVector) < Vector3.Distance(_agent.RightSensor.transform.position, _agent.TargetVector) + (0.1f * _agent.RotationSpeed) && Vector3.Distance(_agent.UpSensor.transform.position, _agent.TargetVector) < Vector3.Distance(_agent.DownSensor.transform.position, _agent.TargetVector) + (0.1f * _agent.RotationSpeed) && Vector3.Distance(_agent.DownSensor.transform.position, _agent.TargetVector) < Vector3.Distance(_agent.UpSensor.transform.position, _agent.TargetVector) + (0.1f * _agent.RotationSpeed)) { if (WarpEffectDelay > 0) { WarpEffect = true; WarpEffectDelay -= Time.deltaTime; } else { Warp = true; WarpEffect = false; } } else { Warp = false; WarpEffect = false; WarpEffectDelay = 0.5f; } } else { if (WarpEffectDelay > 0) { WarpEffect = true; WarpEffectDelay -= Time.deltaTime; } else { Warp = true; WarpEffect = false; } } } else { if (Warp) { Warp = false; WarpEffect = false; WarpEffectDelay = 0.5f; } } } if (Vector3.Distance(gameObject.transform.position, targetVector) <= 200) { if (Warp) { Warp = false; WarpEffect = false; WarpEffectDelay = 0.5f; } } } else { Warp = false; WarpEffect = false; WarpEffectDelay = 0.5f; } } else { if (_HP.curImpulseSystemHealth > _HP.maxImpulseSystemHealth * 0.125f && !_HP.ActiveImpulse) { if (Vector3.Distance(gameObject.transform.position, targetVector) > 400) { if (_HP.curWarpEngingSystemHealth > _HP.maxWarpEngingSystemHealth * 0.125 || !_HP.ActiveWarpEnging) { Warp = true; } else { if (Warp) { Warp = false; } } } if (Vector3.Distance(gameObject.transform.position, targetVector) <= 200) { if (Warp) { Warp = false; } } } else { Warp = false; // gameObject.GetComponent<Rigidbody>().velocity = gameObject.transform.forward * _agent.MovementSpeed; } } } if (!isSelect) { AttackStations = false; DefenceStations = false; NatralStations = false; } if (Name == System.String.Empty) { InitName(); } SensorsLine.transform.position = gameObject.transform.position; _scr.radius = _es.VisionRadius; WeaponLine.transform.position = gameObject.transform.position; _wcr.radius = _AS.radiuse; }