示例#1
0
        public void UpdatePlatformValues(LinkedSurfaces linkedSurface)
        {
            this.linkedSurface = linkedSurface;
            speed = (float)NativeObject.Speed / 30f;
            delay = (float)NativeObject.Delay / 30f;

            var minimumHeight = NativeObject.RuntimeMinimumHeight(ParentLevel.Level);
            var maximumHeight = NativeObject.RuntimeMaximumHeight(ParentLevel.Level);

            if (NativeObject.ComesFromFloor && NativeObject.ComesFromCeiling)
            {
                extendedPosition = (float)(maximumHeight + minimumHeight) / 2f / GeometryUtilities.WorldUnitIncrementsPerMeter;

                if (linkedSurface == LinkedSurfaces.Floor)
                {
                    contractedPosition = (float)minimumHeight / GeometryUtilities.WorldUnitIncrementsPerMeter;
                }
                else
                {
                    contractedPosition = (float)maximumHeight / GeometryUtilities.WorldUnitIncrementsPerMeter;
                }
            }
            else
            {
                if (linkedSurface == LinkedSurfaces.Floor)
                {
                    extendedPosition   = (float)maximumHeight / GeometryUtilities.WorldUnitIncrementsPerMeter;
                    contractedPosition = (float)minimumHeight / GeometryUtilities.WorldUnitIncrementsPerMeter;
                }
                else
                {
                    extendedPosition   = (float)minimumHeight / GeometryUtilities.WorldUnitIncrementsPerMeter;
                    contractedPosition = (float)maximumHeight / GeometryUtilities.WorldUnitIncrementsPerMeter;
                }
            }
        }