Пример #1
0
        public void Update(Vector2 position)
        {
            IsActive = false;
            if (scopeSensorsData != null)
            {
                for (int i = 0; i < scopeSensorsData.Length; i++)
                {
                    ScopeSensors[i].IsActive = false;
                }
            }

            var aabb = new AABB(a + position, b + position);

            sensorTransform = new Transform(ref position, ref sensorRotation);
            world.QueryAABB(TestPlatformCollision, ref aabb);

            if (!IsActive || scopeSensorsData == null)
            {
                return;
            }
            for (currentScopeIndex = 0; currentScopeIndex < scopeSensorsData.Length; currentScopeIndex++)
            {
                world.RayCast(
                    TestPlatformCollision,
                    position + scopeSensorsData[currentScopeIndex].From,
                    position + scopeSensorsData[currentScopeIndex].To
                    );
            }
        }