Esempio n. 1
0
        public List <LightingUnit> LightsToActivateInPath(Occupant Occupant, List <LightingUnit> LightingUnits)
        {
            //Makes sure we don't find lights in path when no path is available
            if (Occupant.IsPosition1Initialized == false &&
                Occupant.IsPosition2Initialized == false)
            {
                return(null);
            }

            //List to return
            List <LightingUnit> LightingUnitsToActivateInPath = new List <LightingUnit>();

            //Defines the movement vector
            Coords MovementVector = VectorMath.CalculateVector(Occupant.Position1, Occupant.Position2);

            List <LightingUnit> LightingUnitsInPath = FindLightsInPath(Occupant.Position2, MovementVector,
                                                                       LightingUnits);

            foreach (LightingUnit LightingUnitToSave in LightingUnitsInPath)
            {
                LightingUnitToSave.wantedLightLevel = (CalculateLightingLevel(Occupant.Position2, LightingUnitToSave,
                                                                              _predictedMovementScaling));

                LightingUnitsToActivateInPath.Add(LightingUnitToSave);
            }
            return(LightingUnitsToActivateInPath);
        }
Esempio n. 2
0
        public void CalculateVectorTest()
        {
            Coords Expectet = new Coords(10, 0);
            Coords result   = VectorMath.CalculateVector(p1, p2);

            Assert.AreEqual(Expectet.x, result.x);
            Assert.AreEqual(Expectet.y, result.y);
        }
Esempio n. 3
0
 public Coords GetMovementVector(Occupant Occupant)
 {
     return(VectorMath.CalculateVector(Occupant.Position1, Occupant.Position2));
 }