private void SightList_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            ListView lv = (ListView)sender;
            Sight    s  = (Sight)lv.SelectedItem;

            Frame.Navigate(typeof(SightPage), s);
        }
        Sight ISightManager.AddSight(Suit suit, Point position, double size)
        {
            var obj = new Sight(suit, position, size);

            _sights.Add(obj);
            return(obj);
        }
Exemple #3
0
        public async Task <IActionResult> PutSight([FromRoute] int id, [FromBody] Sight sight)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != sight.id)
            {
                return(BadRequest());
            }

            _context.Entry(sight).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!SightExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Exemple #4
0
        public void GetSight()
        {
            SmartsheetClient ss    = HelperFunctions.SetupClient("Get Sight");
            Sight            sight = ss.SightResources.GetSight(52);

            Assert.AreEqual(52, (long)sight.Id);
        }
Exemple #5
0
 private void Awake()
 {
     navMeshAgent            = gameObject.GetComponent <NavMeshAgent>();
     speed                   = gameObject.GetComponent <Speed>();
     sight                   = gameObject.GetComponent <Sight>();
     blobAnimationController = gameObject.GetComponent <AnimationController>();
 }
Exemple #6
0
        public SightsControllerTests() : base()
        {
            apiRoute = "sights";
            var stringContent = new StringContent(JsonConvert.SerializeObject(new RegisterDto {
                Email = "*****@*****.**", FirstName = "Aaaa", LastName = "Aaa", Password = "******"
            }), Encoding.UTF8, "application/json");
            var response       = client.PostAsync("accounts/register", stringContent);
            var jsonString     = response.Result.Content.ReadAsStringAsync();
            var model          = JsonConvert.DeserializeObject <bool>(jsonString.Result);
            var stringContent2 = new StringContent(JsonConvert.SerializeObject(new LoginDto {
                Email = "*****@*****.**", Password = "******"
            }), Encoding.UTF8, "application/json");
            var response2   = client.PostAsync("accounts/login", stringContent2);
            var jsonString2 = response2.Result.Content.ReadAsStringAsync();
            var model2      = JsonConvert.DeserializeObject <User>(jsonString2.Result);

            client.DefaultRequestHeaders.Add("Authorization", $"Bearer {model2.Token}");
            testId       = Guid.Parse("ffe5e70a-8338-4135-85d5-0fbe348cc697");
            unexistingId = Guid.Parse("ffa5e70a-8338-4135-85d5-0fbe348cc697");
            excursionId  = Guid.Parse("ffe5e70a-8338-4135-85d5-0fbe348cc698");
            testSight1   = new Sight {
                Id = Guid.Parse("ffe5e70a-8338-4135-85d5-0fbe348cc697"), Name = "Jihn Sniw"
            };
            testSight2 = new Sight {
                Id = Guid.Parse("ffe5e70a-8338-4135-85d5-0fbe348cc695"), Name = "Jick Blick"
            };
        }
Exemple #7
0
        public virtual void LeaveWorld(Entity entity)
        {
            if (entity is Player)
            {
                Player dummy;
                Players.TryRemove(entity.Id, out dummy);
                PlayersCollision.Remove(entity);

                // if in trade, cancel it...
                if (dummy.tradeTarget != null)
                {
                    dummy.CancelTrade();
                }
            }
            else if (entity is Enemy)
            {
                Enemy dummy;
                Enemies.TryRemove(entity.Id, out dummy);
                EnemiesCollision.Remove(entity);
                if (entity.ObjectDesc.Quest)
                {
                    Quests.TryRemove(entity.Id, out dummy);
                }
            }
            else if (entity is Projectile)
            {
                var p = entity as Projectile;
                Projectiles.TryRemove(new Tuple <int, byte>(p.ProjectileOwner.Self.Id, p.ProjectileId), out p);
            }
            else if (entity is StaticObject)
            {
                StaticObject dummy;
                StaticObjects.TryRemove(entity.Id, out dummy);

                if (entity.ObjectDesc?.BlocksSight == true)
                {
                    if (Blocking == 3)
                    {
                        Sight.UpdateRegion(Map, (int)entity.X, (int)entity.Y);
                    }

                    foreach (var plr in Players.Values
                             .Where(p => MathsUtils.DistSqr(p.X, p.Y, entity.X, entity.Y) < Player.RadiusSqr))
                    {
                        plr.Sight.UpdateCount++;
                    }
                }

                if (entity is Decoy)
                {
                    PlayersCollision.Remove(entity);
                }
                else
                {
                    EnemiesCollision.Remove(entity);
                }
            }

            entity.Dispose();
        }
        public static void AddSightRecordForm(string name, string year, int street)
        {
            try
            {
                using (var db = new DatabaseEntities())
                {
                    var sight = new Sight
                    {
                        NameSight         = name,
                        FoundingDateSight = DateTime.Now,
                        IdStreet          = street
                    };

                    db.Sight.Add(sight);
                    db.SaveChanges();

                    MessageBox.Show(Helper.MessageAdded);
                }
            }
            catch (Exception e)
            {
                MessageBox.Show(e.ToString());
                throw;
            }
        }
Exemple #9
0
    public void OnRegisterEnemy(GameObject gameObject)
    {
        Sight sight = gameObject.GetComponent <Sight>();

        if (sight == null)
        {
            Debug.LogWarning("GameObject #" + gameObject.name + " doesn't have a Sight component.");
            return;
        }
        if (this._detectionElements.ContainsKey(sight))
        {
            Debug.LogWarning("GameObject #" + gameObject.name + " already present.");
            return;
        }

        Element element = new Element();

        element.detectionElement = Instantiate(this._detectionPrefab, this.transform);
        element.rectTransform    = element.detectionElement.GetComponent <RectTransform>();

        this._playerViewportPosition = this._camera.WorldToViewportPoint(Helper.GetCenter(GameConstants.playerVariable.gameObject));

        this.TransformElement(sight, element);

        this._detectionElements.Add(sight, element);
        if (this._detectionElements.Count > 0)
        {
            this.enabled = true;
        }
    }
Exemple #10
0
        public async Task <JsonResult> AddSight(Sight sight)
        {
            bool result = false;

            if (ModelState.IsValid)
            {
                int count = 0;
                if (sight.Id == 0)
                {
                    _context.Add(sight);
                    count = await _context.SaveChangesAsync();

                    if (count == 1)
                    {
                        result = true;
                    }
                }
                else
                {
                    _context.Update(sight);
                    count = await _context.SaveChangesAsync();

                    if (count == 1)
                    {
                        result = true;
                    }
                }
            }

            return(Json(result));
        }
Exemple #11
0
        protected void FromDungeonGen(int seed, DungeonTemplate template)
        {
            Log.InfoFormat("Loading template for world {0}({1})...", Id, Name);

            var gen = new Generator(seed, template);

            gen.Generate();
            var ras = new Rasterizer(seed, gen.ExportGraph());

            ras.Rasterize();
            var dTiles = ras.ExportMap();

            if (Map == null)
            {
                Map = new Wmap(Manager.Resources.GameData);
                Interlocked.Add(ref _entityInc, Map.Load(dTiles, _entityInc));
                if (Blocking == 3)
                {
                    Sight.CalcRegionBlocks(Map);
                }
            }
            else
            {
                Map.ResetTiles();
            }

            InitMap();
        }
Exemple #12
0
        /// <summary>
        /// Determines the closest sight to the current location.
        /// </summary>
        /// <remarks>May return null if there are no sights added to the trip (i.e. IsMySight == true)</remarks>
        /// <param name="currentLocation">The current location.</param>
        /// <param name="trip">The trip we are searching.</param>
        /// <param name="useWalkingDistance"><c>true</c> if we are using walking distance; otherwise false.</param>
        /// <returns>returns the closest <see cref="Sight"/> or null if no sights are added to the trip.</returns>
        public static async Task <Sight> FindClosestSightAsync(Geopoint currentLocation, Trip trip, bool useWalkingDistance = true)
        {
            Sight closestSight    = null;
            var   closestDistance = double.MaxValue;

            // we only wish to search sights that have been added to our trip
            // note: that may mean we return null if there is no sight in our trip!
            foreach (var sight in trip.Sights.Where(s => s.IsMySight))
            {
                double distance;
                if (useWalkingDistance)
                {
                    distance = await GetWalkingDistanceAsync(currentLocation, sight);
                }
                else
                {
                    distance = await GetDrivingDistanceAsync(currentLocation, sight);
                }
                if (distance < closestDistance)
                {
                    closestDistance = distance;
                    closestSight    = sight;
                }
            }

            // may return null here.
            return(closestSight);
        }
Exemple #13
0
        public async Task CreateSightAsync(Guid id, Sight sight)
        {
            var town = await Context.Towns.FirstOrDefaultAsync(t => t.Id == id);

            town.Sights.Add(sight);
            await Context.SaveChangesAsync();
        }
Exemple #14
0
        public Placemark(Sight sight)
        {
            //string _image = "<img src=\"http://192.168.1.5/" + sight.PhotoUri + "\"/><br><br>";
            string _image = "<img src=\"https://uwalks.000webhostapp.com/photos/" + sight.PhotoUri + "\"/><br><br>";

            string _description = sight.Description != null?PrepDescription(sight.Description) : sight.Description;

            XmlDocument doc = new XmlDocument();

            //Create a CData section.
            XmlCDataSection CData;

            CData = doc.CreateCDataSection(_image + _description);

            Name = sight.Name;
            //Description = "<![CDATA[" + _image + _description + "]]>";
            Description = CData;
            Point       = new Location()
            {
                Longitude = Double.Parse(sight.Longitude.ToString(),
                                         CultureInfo.InvariantCulture),
                Latitude = Double.Parse(sight.Latitude.ToString(),
                                        CultureInfo.InvariantCulture),
            };
        }
Exemple #15
0
        private IEnumerable<ObjectDef> GetNewStaticsV2 () {
            var result = new HashSet<ObjectDef> ();
            try {
                var blockSight = Sight.GetSighCircle (0).Distinct ().ToList ();
                blockSight.Where (_ => {
                    var (x, y, tile) = (_.X, _.Y, _map[_.X, _.Y]);
                    return !(x < 0 || x >= _mW || y < 0 || y >= _mH || tile.ObjectType == 0 || !_clientStatics.Add (new IntPoint (x, y)));
                }).Select (_ => {
                    var (x, y, tile, tileDef, cls) = (_.X, _.Y, _map[_.X, _.Y], _map[_.X, _.Y].ToDefinition (_.X, _.Y), Program.GameData.ObjectDescs[_map[_.X, _.Y]].Class.ToString ());

                    if (cls == "ConnectedWall" || cls == "CaveWall")
                        if (tileDef.ObjStats.Stats.Count (__ => __.Key == StatsType.ObjectConnection && __.Value != null) == 0)
                            tileDef.ObjStats.Stats = new KeyValuePair<StatsType, object>[] {
                                new KeyValuePair<StatsType, object> (StatsType.ObjectConnection,
                                (int) ConnectionComputer.Compute ((xx, yy) => Owner.Map[x + xx, y + yy].ObjectType == tile.ObjectType).Bits)
                            };

                    result.Add (tileDef);

                    return _;
                }).ToList ();
            } catch { }

            return result;
        }
Exemple #16
0
    // The recursive higher-order observation method as described in the thesis.
    // It has a height limiter to specify the desired max order of observation.
    public void UpdateToM(Subject s, Beliefs b, HashSet <Location> fov, int height)
    {
        if (height == 0 || b.Sees.Agents.Count == 0)
        {
            return;
        }

        foreach (KeyValuePair <char, Subject> kvp in b.Sees.Agents)
        {
            HashSet <Location> intersectFov = FOV.GetSharedFov(kvp.Value, s);

            VisionPercept vp = Sight.Perceive(kvp.Key, intersectFov);
            AudioPercept  ap = Hearing.Perceive(kvp.Key, kvp.Value.Location);

            if (!b.ToM.ContainsKey(kvp.Key))
            {
                b.ToM.Add(kvp.Key, new Beliefs());
            }

            b.ToM[kvp.Key].Update(vp);
            b.ToM[kvp.Key].Update(ap);

            UpdateToM(kvp.Value, b.ToM[kvp.Key], intersectFov, height - 1);
        }
    }
        private bool IsTargetInSight(out float sensitivity)
        {
            sensitivity = 0.0f;

            if (!Target || !Target.activeSelf)
            {
                return(false);
            }

            if (dynamicSightData.Sights == null || dynamicSightData.Sights.Length == 0)
            {
                return(false);
            }

            for (int i = 0; i < dynamicSightData.Sights.Length; i++)
            {
                Sight sight = dynamicSightData.Sights[i];

                if (InSight(sight) && sensitivity < sight.sensitivity)
                {
                    sensitivity = sight.sensitivity;
                }
            }

            return(sensitivity != 0f);
        }
Exemple #18
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            sight       = (Sight)e.Parameter;
            DataContext = sight;

            AddToSplitView();
        }
Exemple #19
0
        public void LookForTarget(Player player)
        {
            if (target == null)
            {
                List <Unit> enemiesInSight = new List <Unit>();

                foreach (Unit enemy in player.units)
                {
                    if (Sight.Contains(enemy.pos))
                    {
                        enemiesInSight.Add(enemy);
                    }
                }

                if (enemiesInSight.Count == 0)
                {
                    return;
                }

                float shortest_distance = Sight.Radius;
                foreach (Unit enemy in enemiesInSight)
                {
                    float distance = (enemy.pos - pos).Length();
                    if (distance < shortest_distance)
                    {
                        shortest_distance = distance;
                        target            = enemy;
                    }
                }
            }
        }
 public override bool Attach(Sight input)
 {
     sight = input;
     input.transform.position = transform.position;
     input.transform.parent   = transform;
     return(false);
 }
        public IActionResult Delete(int id)
        {
            IActionResult _result       = new ObjectResult(false);
            GenericResult _removeResult = null;

            try
            {
                Sight _sightToRemove = this._sightRepository.GetSingle(id);
                this._sightRepository.Delete(_sightToRemove);
                this._sightRepository.Commit();

                _removeResult = new GenericResult()
                {
                    Succeeded = true,
                    Message   = "Sight is removed."
                };
            }
            catch (Exception ex)
            {
                _removeResult = new GenericResult()
                {
                    Succeeded = false,
                    Message   = ex.Message
                };

                _loggingRepository.Add(new Error()
                {
                    Message = ex.Message, StackTrace = ex.StackTrace, CreatedDate = DateTime.Now
                });
                _loggingRepository.Commit();
            }

            _result = new ObjectResult(_removeResult);
            return(_result);
        }
Exemple #22
0
        private void GuideMap_MouseUp(object sender, MouseButtonEventArgs e)
        {
            try
            {
                if (mAdd)
                {
                    e.Handled = true;

                    Point    mousePosition = e.GetPosition(this);
                    Location pinLocation   = GuideMap.ViewportPointToLocation(mousePosition);

                    Pushpin pin = new Pushpin
                    {
                        Location = pinLocation
                    };

                    var sight = new Sight(mUser)
                                .SetLocation(mUser, pinLocation)
                                .SetAddress(mUser, AddressTextBox.Text)
                                .SetName(mUser, NameTextBox.Text);

                    mUser.Add(sight).Commit();

                    GuideMap.Children.Add(pin);
                }
            }
            catch (AccessDeniedException)
            {
                // Обработать!!!
            }
            catch
            {
                throw;
            }
        }
Exemple #23
0
        private Sight[] SightData()
        {
            var sight = new Sight[]
            {
                new Sight {
                    Id = new Guid("e6a4ed1d-a17c-4bd8-994f-c6679157e464"), Name = "Central Park", Description = "The most visited urban park in the world!", TownId = new Guid("213b70c1-24f8-4279-b36c-cbfd732f9f3b")
                },
                new Sight {
                    Id = new Guid("0691f43f-5388-4b68-a946-f2f9816c868c"), Name = "Empire State Building", Description = "A 102-story skyscrapper located in Midtown Manhatan.", TownId = new Guid("213b70c1-24f8-4279-b36c-cbfd732f9f3b")
                },
                new Sight {
                    Id = new Guid("dca44c14-9615-407e-8f98-ab0e9b24bda6"), Name = "Cathedral of Our Lady", Description = "A Gothic style cathedral, conceived by architects Jan and Pieter Appelmans.", TownId = new Guid("f9598a2e-2b3a-4dda-b7d9-c103144f510f")
                },
                new Sight {
                    Id = new Guid("a9c30a4a-30c0-458e-871e-8ee1741b54f2"), Name = "Antwerp Central Station", Description = "The finest example of railway architecture in Belgium.", TownId = new Guid("f9598a2e-2b3a-4dda-b7d9-c103144f510f")
                },
                new Sight {
                    Id = new Guid("787ec76e-f3d0-4aa3-84e0-d8b13b844286"), Name = "Eiffel Tower", Description = "A wrought iron lattice tower on the Champ de Mars, named after engineer Gustave Eiffel.", TownId = new Guid("404659b6-39d1-49be-bf29-c7df4501d7ee")
                },
                new Sight {
                    Id = new Guid("e35de2a6-9e7f-4567-a84a-49239d9680ef"), Name = "The Louvra", Description = "The world's largest museum.", TownId = new Guid("404659b6-39d1-49be-bf29-c7df4501d7ee")
                },
            };

            return(sight);
        }
Exemple #24
0
    public override void InitPercept()
    {
        base.InitPercept();

        _percepts["PERCEPT_ENEMY"] = delegate()
        {
            Sight             sight           = GetComponent <Sight>();
            List <GameObject> _listOfUnitColl = new List <GameObject>();
            GetComponent <Stats>().SetTarget(null);
            foreach (GameObject gO in sight._listOfCollision)
            {
                if (gO)
                {
                    if (gO.GetComponent <Stats>() && gO.GetComponent <Stats>()._teamIndex != GetComponent <Stats>()._teamIndex)
                    {
                        GetComponent <Stats>().SetTarget(gO);
                        GetComponent <Stats>().SetHeading(getAngle(gO));
                        return(true);
                    }
                }
            }
            return(false);
        };

        _percepts["PERCEPT_ENEMY_LOW_LIFE"] = delegate()
        {
            return(_percepts["PERCEPT_ENEMY"]() && GetComponent <Stats>().GetTarget().GetComponent <Stats>().GetHealthRatio() <= 0.5f);
        };
    }
    public void SetSight(Sight sight)
    {
        var bounds = sight.GetBounds();
        var center = bounds.center;

        child.transform.localPosition = center;
        child.transform.localScale    = new Vector3(bounds.size.x, bounds.size.y, 1);
    }
        public async Task <Sight> Create(Sight sight)
        {
            await _dbContext.Sights.AddAsync(sight);

            await _dbContext.SaveChangesAsync();

            return(sight);
        }
        public async Task <List <Restaurant> > GetRestaurantsForSightAsync(Sight sight)
        {
            // Uses driving directions - slower
            //return await FindClosestRestaurantsAsync(sight.Location, 5);

            // much faster, but line of sight instead
            return(await FindClosestRestaurantsAsCrowFliesAsync(sight.Location, 5));
        }
    void Awake()
    {
        DontDestroyOnLoad(gameObject);
        //prevPosition = transform.position;

        sight     = GetComponent <Sight>();
        inventory = GetComponentInChildren <Inventory>();
    }
Exemple #29
0
    void Start()
    {
        hunger   = 10;
        steering = GetComponent <Steering> ();
        sight    = GetComponent <Sight> ();

        InitBeeHIVE();
    }
Exemple #30
0
    public override void SetPart(WeaponPart part)
    {
        base.SetPart(part);

        data = part as Sight;

        fov = Sight.baseFov / data.GetStats(WeaponPartStats.Zoom, 1f);
    }
Exemple #31
0
	void Awake()
	{
		
		//set the caches correctly
		weaponController = GetComponent<AIWeaponController>();
		movementManager = GetComponent<AIMovementSwitcher>();
		coverManager = GetComponent<SearchCover>();
		sightManager = sight.GetComponent<Sight>();
		earsManager = ears.GetComponent<Auditory>();
		patrolM = patrolManager.GetComponent<PatrolManager>();
		
		
		//at the start the current state is patroling
		currentState = CurrentState.patrol;
		//and the engagment is set to free
		engagementStatus = EngagementState.free;
		
		//some variables that we will later use for reference
		initFreezeTime = freezeTime;
		initShockTime = shockTime;
		initFOV = sightManager.fieldOfView;
		initChanceForFight = chanceForFight;
		initFear = fear;
		audioControl = GetComponent<ShooterAIAudioControl>();
		
		if(GetComponent<NavMeshAgent>() != null)
		{
			initHeight = GetComponent<NavMeshAgent>().height;
		}

		
		initYScale = GetComponentInChildren<HealthManager>().gameObject.transform.localScale.y;
		
		movement = movementManager;
		
		
		
		
		//anti-bottlenecking procedure
		enemyDistanceCheckFrameBarrier += Random.Range(-30f, 30f);
	
		//find the health manager automatically
		healthManager = GetComponentInChildren<HealthManager>().gameObject;
		
		//setup multiple weapons correctly
		otherWeapons.Add( weaponController.weaponHoldingObject );
		otherWeaponsMelee.Add( meleeAttackUsed ); 
	}
    //Initilization
    protected override void Start()
    {
        //start living entity base class
        base.Start();
        startingHealth = baseHealth;
        switch (dietinfo) {
            case 'h':
                dietType = Diet.Herbivorous;
                break;
            case 'o':
                dietType = Diet.Omnivorous;
                break;
            case 'p':
                dietType = Diet.Carnivorous;
                break;
        }

        //Action marker setup
        skinDefalt = GetComponent<Renderer>().material;
        defaltColor = skinDefalt.color;

        //navagation set up
        pathfinder = GetComponent<NavMeshAgent>();
        pathfinder.acceleration = acceleration;
        pathfinder.speed = movmentSpeed;

        currentState = State.Idle;
        currentTargetList = new List<Transform>();
        currentTargetType = targetType.Water;

        //Combat set up
        animatCombat = GetComponent<Combat>();
        attackDistanceThreshold = attackRange / 1.2f;
        animatCombat.SetStats(attackRange, attackAccuracy, attackDamage);

        //Sence Components set up
        //sight
        animatSight = GetComponent<Sight>();
        animatSight.SetStats(sightRange);

        //olfaction
        animatOlfaction = GetComponent<Olfaction>();
        animatOlfaction.SetStats(olfactionRange, olfactionAccuracy);

        //audition
        animatAudition = GetComponent<Audition>();
        animatAudition.SetStats(hearingRange);

        //Metabolism
        hunger = (int)(baseSatation/1.5);
        thirst = (int)(baseHydration/1.5);
        StartCoroutine(Metabolism());

        //Cognition
        spawnOrigin = GetComponentInParent<Spawner>();
        noOfTargetsConsumed = 0;
        StartCoroutine(DecisionBlock());
        StartCoroutine(ActionBlock());    

    }