public ValueTask <Recording> ProcessFileAsync(TargetInformation information, Recording recording) { var stream = information.FileStream; var tryWamdData = Wamd.ExtractMetadata(stream); if (tryWamdData.IsSucc) { Wamd wamdData = (Wamd)tryWamdData; int numMicrophones = wamdData.MicrophoneType.Length; // Update recording information with wamd metadata recording = recording with { StartDate = recording.StartDate ?? (wamdData.StartDate.IsLeft ? (OffsetDateTime?)wamdData.StartDate : null), LocalStartDate = recording.LocalStartDate ?? (wamdData.StartDate.IsRight ? (LocalDateTime?)wamdData.StartDate : null), Sensor = (recording.Sensor ?? new Sensor()) with { Name = recording.Sensor?.Name ?? wamdData.Name, SerialNumber = recording.Sensor?.SerialNumber ?? wamdData.SerialNumber, Firmware = recording.Sensor?.Firmware ?? wamdData.Firmware, Temperature = recording.Sensor?.Temperature ?? wamdData.Temperature, Microphones = recording.Sensor?.Microphones ?? new Microphone[numMicrophones], },
protected override string GetImageFileName(TargetInformation Target) { string fileName = _indexHelper.GetModification(Target.CellId, Target.ModificationId).CustomProperties[_propertyName]; if (fileName == null) throw new SectionImageFileWasNotSpecified(_propertyName); return Path.Combine(_root, fileName); }
public ValueTask <bool> CanProcessAsync(TargetInformation information) { // TODO: Add support for .wac (or other Wildlife Acoustic) files var result = information.IsPcmWaveFile() && information.HasVersion1WamdChunk(); return(ValueTask.FromResult(result)); }
// Handler logic - will be invoked every time we get new information about what characters we can see. private void HandleNewPerception(object sender, IReadOnlyList <TargetInformation> eventData) { // Copy all our data into a local, mutable list which we can safely work with without affecting the sender's data (which is a read only collection) List <TargetInformation> visibleColliders = new List <TargetInformation>(eventData); // Treat all visible characters as enemies. // Target the nearest visible character. if (visibleColliders.Count > 0) { TargetInformation closest = visibleColliders[0]; float currDist = Vector3.Distance(transform.position, closest.collider.transform.position); visibleColliders.RemoveAt(0); foreach (TargetInformation c in visibleColliders) { float d = Vector3.Distance(transform.position, c.collider.transform.position); if (d < currDist) { currDist = d; closest = c; } } UpdateTargetCollider(closest); } else { currentTarget = newTarget = null; reacting = false; // We lost sight of whatever we are trying to react to. } }
// Keeps the 'current target' variable up to date, and also checks whether or not the target aquired was a new one. private void UpdateTargetCollider(TargetInformation c) { if (c == null) { return; } if (currentTarget == null || currentTarget.collider != c.collider) { // The new target is not the same as the current target! // If we aren't already reacting to this target, then we need to set up a 'reaction' timer for it. if (newTarget == null || newTarget.collider != c.collider) { newTarget = c; reacting = true; nextReactTime = Time.time + reactionTime; } else if (newTarget.collider == c.collider) { // Need to update the aim point! newTarget.aimPosition = c.aimPosition; } } else if (currentTarget.collider == c.collider) { // Need to update the aim point! currentTarget.aimPosition = c.aimPosition; } }
private TargetInformation getSlowestTarget(ArrayList characterList) { TargetInformation result = new TargetInformation(); float slowestVelocity = 10000; for (int i = 0; i < characterList.Count; i++) { Character potentialTarget = (Character)characterList[i]; if (potentialTarget.ID != this.ID) { float targetVelocity = Vector3.Magnitude(potentialTarget.rigidbody.velocity); if (targetVelocity < slowestVelocity) { slowestVelocity = targetVelocity; result.target = potentialTarget; } } } if (result.target) { result.distance = Vector3.Distance(result.target.transform.position, this.transform.position); result.velocityMagnitude = slowestVelocity; } return(result); }
internal static void ProcessAttrCert7(IX509AttributeCertificate attrCert, PkixCertPath certPath, PkixCertPath holderCertPath, PkixParameters pkixParams) { ISet criticalExtensionOids = attrCert.GetCriticalExtensionOids(); if (criticalExtensionOids.Contains(X509Extensions.TargetInformation.Id)) { try { TargetInformation.GetInstance(PkixCertPathValidatorUtilities.GetExtensionValue(attrCert, X509Extensions.TargetInformation)); } catch (Exception cause) { throw new PkixCertPathValidatorException("Target information extension could not be read.", cause); } } criticalExtensionOids.Remove(X509Extensions.TargetInformation.Id); foreach (PkixAttrCertChecker pkixAttrCertChecker in pkixParams.GetAttrCertCheckers()) { pkixAttrCertChecker.Check(attrCert, certPath, holderCertPath, criticalExtensionOids); } if (!criticalExtensionOids.IsEmpty) { throw new PkixCertPathValidatorException("Attribute certificate contains unsupported critical extensions: " + criticalExtensionOids); } }
// Update is called once per frame void Update() { // If we need to do another check, then do the check! if (Time.time >= nextCheckTime) { nextCheckTime = Time.time + checkFrequencySeconds; List <TargetInformation> visibleCharacterColliders = new List <TargetInformation>(); // Find all colliders in the character layer that are within the search radius of us! foreach (Collider potentialTarget in Physics.OverlapSphere(transform.position, maxVisionDistance, characterLayerMask, QueryTriggerInteraction.Ignore)) { if (!selfColliders.Contains(potentialTarget)) { TargetInformation data = CalculateTargetInfo(potentialTarget); if (data != null) { visibleCharacterColliders.Add(data); } } } // Notify interested parties of the update! // DebuggingHelpers.Log("I am the ICharacterDetector and i am sending a vision update, sending " + visibleCharacterColliders.Count + " possible colliders to check"); VisionUpdatedEvent?.Invoke(this, visibleCharacterColliders.AsReadOnly()); } }
public ValueTask <bool> CanProcessAsync(TargetInformation information) { var hasName = information.HasFileName(); // true if the target has a filename return(ValueTask.FromResult(hasName)); }
public override void PerformTest() { Target[] targets = new Target[2]; Target targetName = new Target(Target.Choice.Name, new GeneralName(GeneralName.DnsName, "www.test.com")); Target targetGroup = new Target(Target.Choice.Group, new GeneralName(GeneralName.DirectoryName, "o=Test, ou=Test")); targets[0] = targetName; targets[1] = targetGroup; Targets targetss = new Targets(targets); TargetInformation targetInformation1 = new TargetInformation(targetss); // use an Target array TargetInformation targetInformation2 = new TargetInformation(targets); // targetInformation1 and targetInformation2 must have same // encoding. if (!targetInformation1.Equals(targetInformation2)) { Fail("targetInformation1 and targetInformation2 should have the same encoding."); } TargetInformation targetInformation3 = TargetInformation.GetInstance(targetInformation1.ToAsn1Object()); TargetInformation targetInformation4 = TargetInformation.GetInstance(targetInformation2.ToAsn1Object()); if (!targetInformation3.Equals(targetInformation4)) { Fail("targetInformation3 and targetInformation4 should have the same encoding."); } }
private TargetInformation getClosestTarget(ArrayList characterList) { TargetInformation result = new TargetInformation(); float shortestDistance = 200; for (int i = 0; i < characterList.Count; i++) { Character potentialTarget = (Character)characterList[i]; if (potentialTarget.ID != this.ID) { float newDistance = Vector3.Distance(this.transform.position, potentialTarget.transform.position); if (newDistance < shortestDistance && potentialTarget.isAlive()) { shortestDistance = newDistance; result.target = potentialTarget; } } } if (result.target) { result.distance = shortestDistance; result.velocityMagnitude = Vector3.Magnitude(result.target.rigidbody.velocity); } return(result); }
/// <summary>Находит TargetName для ячейки</summary> /// <param name="Target">Цель прошивки</param> public string GetTargetName(TargetInformation Target) { ModificationKind modification = _indexHelper.GetModification(Target.CellId, Target.ModificationId); string unichannelProperty = modification.CustomProperties["unichannel"]; return unichannelProperty != null && bool.Parse(unichannelProperty) ? string.Format("cpu{0}", Target.ChannelNumber) : null; }
// Update is called once per frame - NOTE: shooting timing should probably be done in fixed update, so that gun firing is not FPS dependent.. But oh well handle that shit when you do it properly. void Update() { // If we are 'reacting', that means that we just spotted a new target. After 'reaction time' has elapsed, the newTarget will become the current target, and the 'newTarget' becomes null. if (reacting && Time.time >= nextReactTime) { //REACT! reacting = false; currentTarget = newTarget; newTarget = null; // Invoke the target engaged event! if (currentTarget != null) { EnemyEngagedEvent?.Invoke(this, currentTarget); } // If the target is further away than the stand still threshold, then we should stop moving to aim carefully! prevTargetDistance = Vector3.Distance(transform.position, currentTarget.collider.transform.position); if (prevTargetDistance > standStillThreshold) { agent.isStopped = true; // Pause the agent's path. } } // If we have a target, then rather than just walking around, we should lookat, and shoot at, our target! If the target info contains a null reference we assume our target was destroyed. if (currentTarget != null) { // Check if the target has been killed. If so, reset the current target. if (!TargetStillAlive(currentTarget)) { currentTarget = null; } // We have a target, and that target is still alive! Let's continue our logic. else { AimTowardsTarget(currentTarget); // If the target was previously inside our distance threshold, and just moved outside of it this tick, then we should stop moving and aim carefully. float currDist = Vector3.Distance(transform.position, currentTarget.collider.transform.position); if (prevTargetDistance <= standStillThreshold && currDist > standStillThreshold) { agent.isStopped = true; // Pause the agent's path. } else if (currDist < standStillThreshold) { agent.isStopped = false; // Resume walking if the target get's too close! } AttemptToShoot(currentTarget); prevTargetDistance = currDist; } } else { agent.isStopped = false; // Resume walking if there is no target to worry about! AimTowardsWalkDirection(); // Turn the body back in the direction of the nav agent's facing direction! } }
public void HasLogFileTest(FixtureModel model) { if (model.Process.ContainsKey(FixtureModel.FrontierLabsLogFileExtractor)) { TargetInformation ti = model.ToTargetInformation(this.RealFileSystem); Assert.True(ti.TargetSupportFiles.ContainsKey(LogFile.LogFileKey)); } }
public void ToStringNoExpandedTargets() { const string name = "name"; var info = new TargetInformation { Name = name }; Assert.Equal(name, info.ToString()); }
private IX509AttributeCertificate CreateAttrCert() { // CertificateFactory fact = CertificateFactory.getInstance("X.509", "BC"); // X509Certificate iCert = (X509Certificate) fact // .generateCertificate(new ByteArrayInputStream(holderCert)); X509Certificate iCert = new X509CertificateParser().ReadCertificate(holderCert); // // a sample key pair. // // RSAPublicKeySpec pubKeySpec = new RSAPublicKeySpec( // new BigInteger( // "b4a7e46170574f16a97082b22be58b6a2a629798419be12872a4bdba626cfae9900f76abfb12139dce5de56564fab2b6543165a040c606887420e33d91ed7ed7", // 16), new BigInteger("11", 16)); // // set up the keys // // KeyFactory kFact = KeyFactory.getInstance("RSA", "BC"); // PrivateKey privKey = kFact.generatePrivate(RsaPrivateKeySpec); IAsymmetricKeyParameter privKey = RsaPrivateKeySpec; X509V2AttributeCertificateGenerator gen = new X509V2AttributeCertificateGenerator(); // the actual attributes GeneralName roleName = new GeneralName(GeneralName.Rfc822Name, "*****@*****.**"); Asn1EncodableVector roleSyntax = new Asn1EncodableVector(roleName); // roleSyntax OID: 2.5.24.72 X509Attribute attributes = new X509Attribute("2.5.24.72", new DerSequence(roleSyntax)); gen.AddAttribute(attributes); gen.SetHolder(new AttributeCertificateHolder(PrincipalUtilities.GetSubjectX509Principal(iCert))); gen.SetIssuer(new AttributeCertificateIssuer(new X509Name("cn=test"))); gen.SetNotBefore(DateTime.UtcNow.AddSeconds(-50)); gen.SetNotAfter(DateTime.UtcNow.AddSeconds(50)); gen.SetSerialNumber(BigInteger.One); gen.SetSignatureAlgorithm("SHA1WithRSAEncryption"); Target targetName = new Target( Target.Choice.Name, new GeneralName(GeneralName.DnsName, "www.test.com")); Target targetGroup = new Target( Target.Choice.Group, new GeneralName(GeneralName.DirectoryName, "o=Test, ou=Test")); Target[] targets = new Target[] { targetName, targetGroup }; TargetInformation targetInformation = new TargetInformation(targets); gen.AddExtension(X509Extensions.TargetInformation.Id, true, targetInformation); return(gen.Generate(privKey)); }
public void Can_Dump_Process() { DumpCreator creator = new DumpCreator(true, false); var process = AllocStrings(); string file = creator.Dump(new string[] { process.Id.ToString(), "test.dmp" }); Assert.IsNotNull(file, "Output dump file was null!"); Assert.IsTrue(File.Exists(file), "Dump file does not exist!"); Assert.IsNotNull(TargetInformation.GetExistingVMMapFile(file), "Associated VMMap dump file was not found. Is VMMap.exe in path?"); }
// Use this for initialization void Start() { // Register to listen for events perception = GetComponent <ICharacterDetector>(); perception.VisionUpdatedEvent += HandleNewPerception; gun = GetComponent <IGunMechanics>(); agent = GetComponent <NavMeshAgent>(); currentTarget = newTarget = null; // Need to acquire a target(s) first. reacting = false; nextShootTime = Time.time; // Can fire right away! currBodyAngularVelocity = 0f; }
public int GetConfiguration(TargetInformation Target) { ModificationKind modification = _indexHelper.GetModification(Target.CellId, Target.ModificationId); string configurationString = modification.CustomProperties["config"]; int configuration; if (configurationString == null || !Int32.TryParse(configurationString, NumberStyles.HexNumber, CultureInfo.InvariantCulture, out configuration)) throw new BootloaderConfigurationNotFoundException(); return configuration; }
private bool TargetStillAlive(TargetInformation t) { // if either the collider null check or the character null check (given the target is a character) pass, then we assume the target object has been destroyed if (t == null || t.collider == null || (t.IsCharacter && t.character == null)) { return(false); } else { return(true); } }
private void removeTargetsOutOfRange() { for (int i = 0; i < targetsInRange.Count; i++) { Character target = (Character)targetsInRange[i]; float distance = Vector3.Distance(this.transform.position, target.transform.position); if (distance > bow.getMaxRange() * 1.3f) { targetsInRange.Remove(target); } } primaryTarget = null; }
public void ToStringWithExpandedTargets() { const string group = "name"; const string expanded1 = "expanded1"; const string expanded2 = "expanded2"; var expandedTargets = new[] { expanded1, expanded2 }; var info = new TargetInformation { Name = group, ExpandedTargets = expandedTargets }; var groupedToString = String.Format(LocalizedStrings.TargetInformationGroups, group, String.Join(CultureInfo.CurrentCulture.TextInfo.ListSeparator + " ", expandedTargets)); Assert.Equal(groupedToString, info.ToString()); }
public void TryTarget(ITargetable targetable, Vector3 point) { if (targetable != null && !targetable.Targetable) { return; } foreach (var squad in selection) { var targetInformation = new TargetInformation(targetable as IHittable, point); if (squad.CanTarget(targetInformation)) { squad.setTarget(targetInformation); } } }
public ValueTask <Recording> ProcessFileAsync(TargetInformation information, Recording recording) { var result = this.parser.Parse(information.Path); recording = recording with { Extension = recording.Extension ?? result.Extension, Stem = recording.Stem ?? result.Prefix + result.DatePart + result.Suffix, StartDate = recording.StartDate ?? result.OffsetDateTime, LocalStartDate = recording.LocalStartDate ?? result.LocalDateTime, Location = recording.Location ?? result.Location, }; return(ValueTask.FromResult(recording)); }
private float CheckAimAngle(TargetInformation target) { //Calculate the angle between our left right orientation, and our target. Vector3 pointsToTarget = target.aimPosition - transform.position; pointsToTarget.y = 0; //Remove the vertical component. Vector3 forwardNoVertical = characterBody.transform.forward; forwardNoVertical.y = 0; float angle = Vector3.Angle(forwardNoVertical, pointsToTarget); return((angle < 0) ? -angle : angle); //Make sure to return positive value. }
public void CleanDump() { if (File.Exists(dumpFileName)) { File.Delete(dumpFileName); } string vmmapFile = TargetInformation.GetExistingVMMapFile(dumpFileName); if (vmmapFile != null) { File.Delete(vmmapFile); } Program.IsDebug = true; }
private void AddButton_Click(object sender, RoutedEventArgs e) { string path = FileManager.SelectFile(); if (path == "" || exist.ContainsKey(path)) { return; } exist.Add(path, true); string fileName = System.IO.Path.GetFileName(path); TargetInformation c = new TargetInformation(fileName, path, "Visible", "True"); configInformationList.Add(c); listView.Items.Refresh(); autoSetWidth(); }
internal static void ProcessAttrCert7( IX509AttributeCertificate attrCert, PkixCertPath certPath, PkixCertPath holderCertPath, PkixParameters pkixParams) { // TODO: // AA Controls // Attribute encryption // Proxy ISet critExtOids = attrCert.GetCriticalExtensionOids(); // 7.1 // process extensions // target information checked in step 6 / X509AttributeCertStoreSelector if (critExtOids.Contains(X509Extensions.TargetInformation.Id)) { try { TargetInformation.GetInstance(PkixCertPathValidatorUtilities .GetExtensionValue(attrCert, X509Extensions.TargetInformation)); } catch (Exception e) { throw new PkixCertPathValidatorException( "Target information extension could not be read.", e); } } critExtOids.Remove(X509Extensions.TargetInformation.Id); foreach (PkixAttrCertChecker checker in pkixParams.GetAttrCertCheckers()) { checker.Check(attrCert, certPath, holderCertPath, critExtOids); } if (!critExtOids.IsEmpty) { throw new PkixCertPathValidatorException( "Attribute certificate contains unsupported critical extensions: " + critExtOids); } }
public override void initialize(int characterID, GameObject gameManager) { targetsInRange = new ArrayList(); primaryTarget = null; base.initialize(characterID, gameManager); bow.Initialize(); currentMovementSpeed = defaultMovespeed; anim.StopPlayback(); shotTimer = Random.Range(0.5f, 5.0f); quiver = new Quiver(); quiver.Initialize(7, this.gameObject); quiver.addArrow(ArrowType.FireArrow, 3); quiver.addArrow(ArrowType.IceArrow, 3); quiver.addArrow(ArrowType.ForceArrow, 3); quiver.addArrow(ArrowType.TreeArrow, 3); quiver.addArrow(ArrowType.PiercingArrow, 3); quiver.addArrow(ArrowType.SplitArrow, 3); this.transform.position = new Vector3(this.transform.position.x, 0.0f, this.transform.position.z); }
public ValueTask <Recording> ProcessFileAsync(TargetInformation information, Recording recording) { var samples = Flac.ReadTotalSamples(information.FileStream); var sampleRate = Flac.ReadSampleRate(information.FileStream); var channels = Flac.ReadNumChannels(information.FileStream); var bitDepth = Flac.ReadBitDepth(information.FileStream); Rational?duration = samples.IsFail || sampleRate.IsFail || (uint)sampleRate == 0 ? null : (new Rational((ulong)samples) / new Rational((uint)sampleRate)); uint? bitRate = sampleRate.IsFail || bitDepth.IsFail || channels.IsFail ? null : (uint)sampleRate * (uint)bitDepth * (uint)channels; recording = recording with { DurationSeconds = recording.DurationSeconds ?? duration, SampleRateHertz = recording.SampleRateHertz ?? (sampleRate.IsFail ? null : (uint)sampleRate), TotalSamples = recording.TotalSamples ?? (samples.IsFail ? null : (ulong)samples), Channels = recording.Channels ?? (channels.IsFail ? null : (byte)channels), BitDepth = recording.BitDepth ?? (bitDepth.IsFail ? null : (byte)bitDepth), BitsPerSecond = recording.BitsPerSecond ?? bitRate, }; return(ValueTask.FromResult(recording)); }
public ValueTask <Recording> ProcessFileAsync(TargetInformation information, Recording recording) { var stream = information.FileStream; var riffChunk = Wave.FindRiffChunk(stream); var waveChunk = riffChunk.Bind(r => Wave.FindWaveChunk(stream, r)); var formatChunk = waveChunk.Bind(w => Wave.FindFormatChunk(stream, w)); var dataChunk = waveChunk.Bind(w => Wave.FindDataChunk(stream, w)); if (formatChunk.IsFail) { this.logger.LogError("Failed to process wave file: {error}", formatChunk); return(new ValueTask <Recording>(recording)); } var formatSpan = RangeHelper.ReadRange(stream, (RangeHelper.Range)formatChunk); var sampleRate = Wave.GetSampleRate(formatSpan); var bitsPerSample = Wave.GetBitsPerSample(formatSpan); var byteRate = Wave.GetByteRate(formatSpan); var channels = Wave.GetChannels(formatSpan); var samples = dataChunk.Map(d => (ulong?)Wave.GetTotalSamples(d, channels, bitsPerSample)); var fileLength = stream.Length; // TODO: replace with rational type from master branch var duration = samples.Map(s => (Rational?)new Rational((uint)samples !, (uint)sampleRate)); return(ValueTask.FromResult(recording with { DurationSeconds = duration.IfFail((Rational?)null), TotalSamples = samples.IfFail((ulong?)null), SampleRateHertz = sampleRate, Channels = (ushort)channels, BitsPerSecond = byteRate * BinaryHelpers.BitsPerByte, BitDepth = (byte)bitsPerSample, FileLengthBytes = (ulong)fileLength, })); }
public override void initialize(int characterID, GameObject gameManager) { targetsInRange = new ArrayList (); primaryTarget = null; base.initialize (characterID, gameManager); bow.Initialize (); currentMovementSpeed = defaultMovespeed; anim.StopPlayback (); shotTimer = Random.Range(0.5f, 5.0f); quiver = new Quiver (); quiver.Initialize (7, this.gameObject); quiver.addArrow (ArrowType.FireArrow, 3); quiver.addArrow (ArrowType.IceArrow, 3); quiver.addArrow (ArrowType.ForceArrow, 3); quiver.addArrow (ArrowType.TreeArrow, 3); quiver.addArrow (ArrowType.PiercingArrow, 3); quiver.addArrow (ArrowType.SplitArrow, 3); this.transform.position = new Vector3 (this.transform.position.x, 0.0f, this.transform.position.z); }
// This function is the Event handler we register to receive updates from the Combat Ai. It is called when the combat ai decides to engage a particular enemy. private void HandleEnemyEngagedEvent(object sender, TargetInformation enemy) { if (!enemy.IsCharacter) { return; } if (!enemiesAwareOf.ContainsKey(enemy.character)) { enemiesAwareOf.Add(enemy.character, AwarenessStates.EngagedWith); EnemyEngagedEvent?.Invoke(this, enemy.character); } else if (enemiesAwareOf[enemy.character] != AwarenessStates.EngagedWith) { enemiesAwareOf[enemy.character] = AwarenessStates.EngagedWith; EnemyEngagedEvent?.Invoke(this, enemy.character); } else { // Do nothing. Our internal state seems to think we are already engaging this target. Why are we recieving this event.. ? (Check for timing bugs?) } }
public static void AnalysisXml(string path, List <TargetInformation> configList, bool isLocalConfig = true) { XmlDocument conXml = new XmlDocument(); conXml.Load(path); XmlNode xm = conXml.SelectSingleNode("Files"); //得到根节点Files XmlNodeList xml = xm.ChildNodes; //得到根节点的所有子节点 string deleteButtonVisible; // 如果是远端配置文件或者当前使用的配置文件, delete按钮是不可见的 string updateMethodEnable; if (isLocalConfig) { deleteButtonVisible = "Visible"; updateMethodEnable = "True"; } else { deleteButtonVisible = "Hidden"; updateMethodEnable = "False"; } configList.Clear(); foreach (XmlNode file in xml) { XmlNodeList fileList = file.ChildNodes; TargetInformation configInformation; configInformation = new TargetInformation(); configInformation.Path = fileList.Item(0).InnerText; configInformation.FileName = fileList.Item(1).InnerText; configInformation.UpdateMethod = fileList.Item(2).InnerText; configInformation.Md5 = fileList.Item(3).InnerText; configInformation.DeleteButtonVisible = deleteButtonVisible; configInformation.UpdateMethodEnable = updateMethodEnable; configList.Add(configInformation); } }
protected override string GetImageFileName(TargetInformation Target) { return _fileName; }
private TargetInformation getClosestTarget(ArrayList characterList) { TargetInformation result = new TargetInformation(); float shortestDistance = 200; for(int i = 0; i < characterList.Count; i++) { Character potentialTarget = (Character)characterList[i]; if(potentialTarget.ID != this.ID) { float newDistance = Vector3.Distance(this.transform.position, potentialTarget.transform.position); if(newDistance < shortestDistance && potentialTarget.isAlive()) { shortestDistance = newDistance; result.target = potentialTarget; } } } if (result.target) { result.distance = shortestDistance; result.velocityMagnitude = Vector3.Magnitude (result.target.rigidbody.velocity); } return result; }
private void removeTargetsOutOfRange() { for(int i = 0; i < targetsInRange.Count; i++) { Character target = (Character)targetsInRange[i]; float distance = Vector3.Distance(this.transform.position, target.transform.position); if(distance > bow.getMaxRange() * 1.3f) { targetsInRange.Remove(target); } } primaryTarget = null; }
protected abstract string GetImageFileName(TargetInformation Target);
public ProgrammerType GetProgrammerType(TargetInformation Target) { return _programmer; }
public FirmwareProject(TargetInformation Target, IList<ModuleProject> Modules) { this.Modules = Modules; this.Target = Target; }
public CortexBootloaderPropertiesProvider(TargetInformation Target, IBootloaderConfigurationCatalog ConfigurationCatalog) { _target = Target; _configurationCatalog = ConfigurationCatalog; }
/// <summary>Находит BoardName для ячейки по её идентификатору и модификации</summary> /// <param name="Target">Цель прошивки</param> public string GetBoardName(TargetInformation Target) { ModificationKind modification = _indexHelper.GetModification(Target.CellId, Target.ModificationId); return modification.CustomProperties["board"]; }
public ProgrammerType GetProgrammerType(TargetInformation Target) { return _unichannelKindProvider.GetParameter(Target, _directProgrammer, i => _programmersAssassinations[i]); }
private TargetInformation getSlowestTarget(ArrayList characterList) { TargetInformation result = new TargetInformation (); float slowestVelocity = 10000; for(int i = 0; i < characterList.Count; i++) { Character potentialTarget = (Character)characterList[i]; if(potentialTarget.ID != this.ID) { float targetVelocity = Vector3.Magnitude(potentialTarget.rigidbody.velocity); if(targetVelocity < slowestVelocity) { slowestVelocity = targetVelocity; result.target = potentialTarget; } } } if (result.target) { result.distance = Vector3.Distance (result.target.transform.position, this.transform.position); result.velocityMagnitude = slowestVelocity; } return result; }
public DevicePropertiesProvider(TargetInformation Target) { _target = Target; }
public string GetBoardName(TargetInformation Target) { ModificationKind modification = _indexHelper.GetModification(Target.CellId, Target.ModificationId); return _boards[modification.DeviceName]; }
//Target Priority: //1. If the current leader is winning by 5+ points more than this AI and is within firing range //2. If the slowest target is also the closest //3. If the slowest target is closer than half of the max Range //4. If the slowest target is not moving //5. The closest target private void choosePrimaryTarget() { ScoreManager scoreManager = gameManager.GetComponent<ScoreManager> (); int index = indexInScoreList(); int AIScore = ( (ScoreManager.Score)scoreManager.characterScores[index] ).score; TargetInformation leaderTarget = null; if (scoreManager.leadScore - AIScore > 4) { leaderTarget = new TargetInformation(); leaderTarget.target = ((ScoreManager.Score)scoreManager.characterScores [scoreManager.leaderIndex]).character; if(leaderTarget.target != null) { leaderTarget.distance = Vector3.Distance (this.transform.position, leaderTarget.target.transform.position); leaderTarget.velocityMagnitude = Vector3.Magnitude (leaderTarget.target.rigidbody.velocity); } } if (leaderTarget != null) { if(leaderTarget.target != null) { if(leaderTarget.distance <= bow.getMaxRange ()) { primaryTarget = leaderTarget; } } } if(primaryTarget == null) { TargetInformation closest = getClosestTarget (targetsInRange); TargetInformation slowest = getSlowestTarget (targetsInRange); if (!closest.target) { primaryTarget = slowest; } else if (!slowest.target) { primaryTarget = closest; } else if (closest.distance <= 10) { primaryTarget = closest; } else if (closest.target.ID == slowest.target.ID) { primaryTarget = slowest; } else if (slowest.distance <= bow.getMaxRange () / 2) { primaryTarget = slowest; } else if (slowest.velocityMagnitude == 0) { primaryTarget = slowest; } else { primaryTarget = closest; } } }