public override void GetOffsetAndHeading(out Vector offset, out Axis heading)
        {
            switch (FastRand.NextInteger(3))
            {
            case 0:
            {         // Left
                offset = new Vector(Width * -0.5f, FastRand.NextSingle(Height * -0.5f, Height * 0.5f));
                break;
            }

            case 1:
            {         // Top
                offset = new Vector(FastRand.NextSingle(Width * -0.5f, Width * 0.5f), Height * -0.5f);
                break;
            }

            case 2:
            {         // Right
                offset = new Vector(Width * 0.5f, FastRand.NextSingle(Height * -0.5f, Height * 0.5f));
                break;
            }

            default:
            {         // Bottom
                offset = new Vector(FastRand.NextSingle(Width * -0.5f, Width * 0.5f), Height * 0.5f);
                break;
            }
            }

            FastRand.NextUnitVector(out heading);
        }
예제 #2
0
        public void Begin(double milliseconds, ScreenManager.ScreenStates captureScreen)
        {
            _capturedScreen = captureScreen;
            MaxTimer        = milliseconds;
            Timer           = 0;
            startFlag       = true;

            int transition = lastTransition;

            while (transition == lastTransition)
            {
                transition = FastRand.NextInteger(0, transitionAmount - 1);
            }

            currentTransitionType = (TransitionType)transition;
            lastTransition        = transition;
        }
예제 #3
0
        public override void GetOffsetAndHeading(out Vector offset, out Axis heading)
        {
            var rand = FastRand.NextInteger((int)(2 * Width + 2 * Height));

            if (rand < Width) // Top
            {
                offset = new Vector(FastRand.NextSingle(Width * -0.5f, Width * 0.5f), Height * -0.5f);
            }
            else if (rand < 2 * Width) // Bottom
            {
                offset = new Vector(FastRand.NextSingle(Width * -0.5f, Width * 0.5f), Height * 0.5f);
            }
            else if (rand < 2 * Width + Height) // Left
            {
                offset = new Vector(Width * -0.5f, FastRand.NextSingle(Height * -0.5f, Height * 0.5f));
            }
            else // Right
            {
                offset = new Vector(Width * 0.5f, FastRand.NextSingle(Height * -0.5f, Height * 0.5f));
            }

            FastRand.NextUnitVector(out heading);
        }