Esempio n. 1
0
        public void LatestPositionTestOnlyPos1()
        {
            oc.UpdatePositions(0, 0);
            Coords result = oc.LatestPosition();

            Assert.AreEqual(0, result.x);
            Assert.AreEqual(0, result.y);
        }
Esempio n. 2
0
        //Determines what lights need to be activated around the user. Not based on movement.
        //Receives a list of coordinates for every lighting unit in a room (LightingUnitsCoordinates), as well as the last known position of the
        //signal source (UserCoordinates). Calls "ExistsInCircle" to determine whether or not the lights in the room are close
        //enough to activate. If they are (if their coordinates exist in the circle around the user), the coordinates to the lighting
        //unit is stored in the LightingUnitsToActivate list (List<LightingUnits>), which is returned when every lighting unit has been checked.
        //Furthermore, the LightingLevel variable from the LightingUnit class is set by CalculateLightingLevel.

        public List <LightingUnit> LightsToActivateOnUser(Occupant Occupant, List <LightingUnit> LightingUnits)
        {
            List <LightingUnit> LightingUnitsToActivateOnUser = new List <LightingUnit>();

            foreach (LightingUnit LightingUnitToCheck in LightingUnits)
            {
                if (ExistsInCircle(Occupant.LatestPosition(), LightingUnitToCheck))
                {
                    LightingUnitToCheck.wantedLightLevel = Math.Round((CalculateLightingLevel(Occupant.LatestPosition(),
                                                                                              LightingUnitToCheck,
                                                                                              _radius)), 2);

                    LightingUnitsToActivateOnUser.Add(LightingUnitToCheck);
                }
            }

            EnsureCorrectLightingLevels(LightingUnitsToActivateOnUser);
            return(LightingUnitsToActivateOnUser);
        }