Пример #1
0
        public static TrackedItemBase GetNewItem_Predefined(TrackedItemHarness harness, TrackedItemType itemType, Point position, Vector velocity, bool bounceOffWalls)
        {
            if (harness == null)
            {
                throw new InvalidOperationException("Harness must be created first");
            }

            switch (itemType)
            {
            case TrackedItemType.Streaker:
                return(new TrackedItemStreaker(harness.MapSize, bounceOffWalls, harness.Time)
                {
                    Position = position,
                    Velocity = velocity,
                });

            default:
                throw new ApplicationException("Unsupported TrackedItemType: " + itemType.ToString());
            }
        }
Пример #2
0
        public static TrackedItemBase GetNewItem_Random(TrackedItemHarness harness, TrackedItemType itemType, bool bounceOffWalls, double maxSpeed)
        {
            if (harness == null)
            {
                throw new InvalidOperationException("Harness must be created first");
            }

            switch (itemType)
            {
            case TrackedItemType.Streaker:
                return(new TrackedItemStreaker(harness.MapSize, bounceOffWalls, harness.Time)
                {
                    Position = Math3D.GetRandomVector(harness.MapSize / 2).ToPoint2D(),
                    Velocity = Math3D.GetRandomVector_Circular(maxSpeed).ToVector2D(),
                });

            default:
                throw new ApplicationException("Unsupported TrackedItemType: " + itemType.ToString());
            }
        }