/// <summary> /// Initializes client properties. /// </summary> private void Initialize() { this.Arm = new Arm(this); this.TestTarget = new TestTarget(this); this.Values = new Values(this); this.Vision = new Vision(this); this.BaseUri = new Uri("http://10.125.169.141:8182"); SerializationSettings = new JsonSerializerSettings { Formatting = Formatting.Indented, DateFormatHandling = DateFormatHandling.IsoDateFormat, DateTimeZoneHandling = DateTimeZoneHandling.Utc, NullValueHandling = NullValueHandling.Ignore, ReferenceLoopHandling = ReferenceLoopHandling.Serialize, ContractResolver = new ReadOnlyJsonContractResolver(), Converters = new List <JsonConverter> { new Iso8601TimeSpanConverter() } }; DeserializationSettings = new JsonSerializerSettings { DateFormatHandling = DateFormatHandling.IsoDateFormat, DateTimeZoneHandling = DateTimeZoneHandling.Utc, NullValueHandling = NullValueHandling.Ignore, ReferenceLoopHandling = ReferenceLoopHandling.Serialize, ContractResolver = new ReadOnlyJsonContractResolver(), Converters = new List <JsonConverter> { new Iso8601TimeSpanConverter() } }; CustomInitialize(); }
public EntityTemplate( IDictionary <string, IEntityStatistic> statistics, IDictionary <string, IEntitySkill> skills, string[] needs, IAbility[] abilities, string[] slots, int size, IVision visionType, string creatureType, string type, string description, string[] tags) { this.m_Statistics = statistics; this.m_Skills = skills; this.m_Abilities = abilities; this.m_Slots = slots; this.m_Needs = needs; this.Description = description; this.m_Size = size; this.m_Sentient = tags.Any(tag => tag.Equals("sentient", StringComparison.OrdinalIgnoreCase)); this.VisionType = visionType; this.m_CreatureType = creatureType; this.m_Type = type; this.m_Tags = new HashSet <string>(); for (int i = 0; i < tags.Length; i++) { this.m_Tags.Add(tags[i]); } }
/// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='id'> /// </param> /// <param name='filename'> /// </param> /// <param name='command'> /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <VisionAssertionResult> AnalyzeAsync(this IVision operations, long id, string filename, string command, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.AnalyzeWithHttpMessagesAsync(id, filename, command, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
public static Color GetColour(int light, IVision vision) { float lerp = Normalise(0, GlobalConstants.MAX_LIGHT, light); Color displayColour = vision.DarkColour.LinearInterpolate(vision.LightColour, lerp); if (light > vision.MaximumLightLevel || light < vision.MinimumLightLevel) { displayColour.a = 1f; } else if (light > vision.MaximumComfortLevel) { float alpha = Normalise(vision.MaximumComfortLevel, GlobalConstants.MAX_LIGHT, light); displayColour.a = alpha; } else if (light < vision.MinimumComfortLevel) { float alpha = Normalise(0, vision.MinimumComfortLevel, light); displayColour.a = 1f - alpha; } else { displayColour.a = 0f; } return(displayColour); }
/// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='id'> /// </param> /// <param name='command'> /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <object> UploadAsync(this IVision operations, long id, string command, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.UploadWithHttpMessagesAsync(id, command, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
private void Start() { //get interfaces _vision = GetComponent <IVision>(); _health = GetComponent <IHealth>(); _sfxController = GetComponent <ISfxController>(); _pathFinding = GetComponent <IPathFinding>(); _movement = GetComponent <IMovement>(); _rotation = GetComponent <IRotation>(); _damageDisplayManager = GetComponent <IDamageDisplayManager>(); //get the animator if (animator == null) { animator = GetComponent <Animator>(); } //initial properties _lastSeenPlayerPos = new Vector3(); //initial _isAgro = false; _hasLastPlayerPos = false; _isAttacking = false; _isAttackCoolingDown = false; invisible = false; //register event listener EventSystem.Current.RegisterEventListener <BulletHitCtx>(OnBulletHit); }
private void Start() { //get the animator animator = GetComponent <Animator>(); //get interfaces _vision = GetComponent <IVision>(); _health = GetComponent <IHealth>(); _sfxController = GetComponent <ISfxController>(); _pathFinding = GetComponent <IPathFinding>(); _movement = GetComponent <IMovement>(); _rotation = GetComponent <IRotation>(); _simpleDamageDisplayManager = GetComponent <IDamageDisplayManager>(); //initial properties _normalSpeed = _movement.GetSpeed(); //initial states _isAgro = false; _isAttacking = false; _isAttackCoolingDown = false; invisible = false; //register event listener EventSystem.Current.RegisterEventListener <BulletHitCtx>(OnBulletHit); }
public ImageBusiness(SmartCityContext context, IConfiguration configuration, ICloudStorage cloudStorage, IFileExtension fileExtension, IStringExtension stringExtension, IVision vision, IStepAnalyseBusiness stepAnalyseBusiness) { _context = context; _cloudStorage = cloudStorage; _fileExtension = fileExtension; _stringExtension = stringExtension; _vision = vision; _stepAnalyseBusiness = stepAnalyseBusiness; _configuration = configuration; }
public bool AddVision(IVision vision) { if (this.VisionTypes.ContainsKey(vision.Name)) { return(false); } this.VisionTypes.Add(vision.Name, vision); return(true); }
public bool Add(IVision value) { if (this.VisionTypes.ContainsKey(value.Name)) { return(false); } this.VisionTypes.Add(value.Name, value); return(true); }
public ThreadController(IThread thread, IConfiguration configuration, UserManager <LoginUser> userManager, IUpload uploadService, IApplicationUsers userService, IVision visionService, IAlbum albumService, IChannel channelService) { _service = thread; _configuration = configuration; _userManager = userManager; _uploadService = uploadService; _userService = userService; _visionService = visionService; _albumService = albumService; _channelService = channelService; }
/// <summary> /// Initializes a new instance of the <see cref="StepController" /> class. /// </summary> /// <param name="repository">the repository that will interact with the data</param> public StepController(IStepRepository repository, IVision vision) { this._repository = repository; _vision = vision; }
public IEnumerable <IEntityTemplate> Load() { List <IEntityTemplate> entities = new List <IEntityTemplate>(); string[] files = Directory.GetFiles( Directory.GetCurrentDirectory() + GlobalConstants.ASSETS_FOLDER + GlobalConstants.DATA_FOLDER + "Entities", "*.json", SearchOption.AllDirectories); foreach (string file in files) { JSONParseResult result = JSON.Parse(File.ReadAllText(file)); if (result.Error != Error.Ok) { GlobalConstants.ActionLog.Log("Could not load entity templates from " + file, LogLevel.Warning); GlobalConstants.ActionLog.Log(result.ErrorString, LogLevel.Warning); GlobalConstants.ActionLog.Log("On line: " + result.ErrorLine, LogLevel.Warning); continue; } if (!(result.Result is Dictionary dictionary)) { GlobalConstants.ActionLog.Log("Could not parse JSON to Dictionary from " + file, LogLevel.Warning); continue; } Array templateArray = this.ValueExtractor.GetValueFromDictionary <Array>(dictionary, "Entities"); foreach (Dictionary templateDict in templateArray) { string creatureType = this.ValueExtractor.GetValueFromDictionary <string>(templateDict, "CreatureType"); string type = this.ValueExtractor.GetValueFromDictionary <string>(templateDict, "Type"); string visionType = this.ValueExtractor.GetValueFromDictionary <string>(templateDict, "VisionType") ?? "diurnal vision"; IVision vision = this.VisionProviderHandler.Get(visionType); string description = this.ValueExtractor.GetValueFromDictionary <string>(templateDict, "Description"); IDictionary <string, IEntityStatistic> statistics = new System.Collections.Generic.Dictionary <string, IEntityStatistic>(); ICollection <Dictionary> statisticsCollection = this.ValueExtractor.GetCollectionFromArray <Dictionary>( this.ValueExtractor.GetValueFromDictionary <Array>(templateDict, "Statistics")); foreach (Dictionary innerDict in statisticsCollection) { string statName = this.ValueExtractor.GetValueFromDictionary <string>(innerDict, "Name"); int statValue = this.ValueExtractor.GetValueFromDictionary <int>(innerDict, "Value"); int threshold = innerDict.Contains("Threshold") ? this.ValueExtractor.GetValueFromDictionary <int>(innerDict, "Threshold") : GlobalConstants.DEFAULT_SUCCESS_THRESHOLD; IEntityStatistic statistic = GlobalConstants.GameManager.StatisticHandler.Get(statName); statistic.SetValue(statValue); statistic.SetThreshold(threshold); statistics.Add( statName, statistic); } IDictionary <string, IEntitySkill> skills = new System.Collections.Generic.Dictionary <string, IEntitySkill>(); if (templateDict.Contains("Skills")) { ICollection <Dictionary> skillCollection = this.ValueExtractor.GetCollectionFromArray <Dictionary>( this.ValueExtractor.GetValueFromDictionary <Array>(templateDict, "Skills")); foreach (Dictionary innerDict in skillCollection) { string skillName = this.ValueExtractor.GetValueFromDictionary <string>(innerDict, "Name"); int skillValue = this.ValueExtractor.GetValueFromDictionary <int>(innerDict, "Value"); int threshold = innerDict.Contains("Threshold") ? this.ValueExtractor.GetValueFromDictionary <int>(innerDict, "Threshold") : GlobalConstants.DEFAULT_SUCCESS_THRESHOLD; IEntitySkill skill = GlobalConstants.GameManager.SkillHandler.Get(skillName); skill.SetValue(skillValue); skill.SetThreshold(threshold); skills.Add( skillName, skill); } } ICollection <string> tags = this.ValueExtractor.GetCollectionFromArray <string>( this.ValueExtractor.GetValueFromDictionary <Array>(templateDict, "Tags")); ICollection <string> slots = this.ValueExtractor.GetCollectionFromArray <string>( this.ValueExtractor.GetValueFromDictionary <Array>(templateDict, "Slots")); ICollection <string> needs = this.ValueExtractor.GetCollectionFromArray <string>( this.ValueExtractor.GetValueFromDictionary <Array>(templateDict, "Needs")); ICollection <IAbility> abilities = new List <IAbility>(); if (templateDict.Contains("Abilities")) { ICollection <string> abilityNames = this.ValueExtractor.GetCollectionFromArray <string>( this.ValueExtractor.GetValueFromDictionary <Array>(templateDict, "Abilities")); foreach (string name in abilityNames) { abilities.Add(this.AbilityHandler.Get(name)); } } int size = this.ValueExtractor.GetValueFromDictionary <int>(templateDict, "Size"); entities.Add( new EntityTemplate( statistics, skills, needs.ToArray(), abilities.ToArray(), slots.ToArray(), size, vision, creatureType, type, description, tags.ToArray())); } } return(entities); }
/// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='id'> /// </param> /// <param name='filename'> /// </param> /// <param name='command'> /// </param> public static VisionAssertionResult Analyze(this IVision operations, long id, string filename, string command) { return(Task.Factory.StartNew(s => ((IVision)s).AnalyzeAsync(id, filename, command), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult()); }
public static void LookAt(this IVision vision, Option <Vector3> target) { Ensure.That(vision, nameof(vision)).IsNotNull(); vision.LookTarget = target; }
public VisionController(IVision service, IThread threadService) { _service = service; _threadService = threadService; }
public InspectionFacade(IVision visionService, IMeasurement measurementService, IInspectionRepository inspectionRepository) { this.measurementService = measurementService; this.inspectionRepository = inspectionRepository; this.visionService = visionService; }
/// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='id'> /// </param> /// <param name='command'> /// </param> public static object Upload(this IVision operations, long id, string command) { return(Task.Factory.StartNew(s => ((IVision)s).UploadAsync(id, command), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult()); }