示例#1
0
    //Method used to randomize the order of the list of events
    protected override void randomizeEvents()
    {
        System.Random rand = new System.Random();

        //Apply a base randomization
        for (int i = 0; i < events.Count - 1; i++)
        {
            AssociateEvent originalStats = (AssociateEvent)events[i];

            int spotToMove = rand.Next(i, events.Count);

            events[i] = events[spotToMove];

            events[spotToMove] = originalStats;
        }
    }
示例#2
0
        public static void EventHandler(string script)
        {
            var e = new AssociateEvent(script);

            switch (script)
            {
            case BEFORE_ADD:    BeforeAddAssociate(e); break;

            case AFTER_ADD:     AfterAddAssociate(e); break;

            case BEFORE_REMOVE: BeforeRemoveAssociate(e); break;

            case AFTER_REMOVE:  AfterRemoveAssociate(e); break;

            default: break;
            }
        }
示例#3
0
    //Generate practice pitches
    protected override void generatePractice()
    {
        List <EventStats> newPractice = new List <EventStats>();

        newPractice.Add(new AssociateEvent(-1, new List <int>()
        {
            -4, -3, -2, -5
        }));
        newPractice.Add(new AssociateEvent(-4, new List <int>()
        {
            -5, -2, -1, -3
        }));
        newPractice.Add(new AssociateEvent(-2, new List <int>()
        {
            -3, -1, -5, -4
        }));
        newPractice.Add(new AssociateEvent(-3, new List <int>()
        {
            -4, -5, -1, -2
        }));

        System.Random rand = new System.Random();

        //Just simply randomize the order
        for (int i = 0; i < newPractice.Count - 1; i++)
        {
            AssociateEvent originalStats = (AssociateEvent)newPractice[i];

            int spotToMove = rand.Next(i, newPractice.Count);

            newPractice[i] = newPractice[spotToMove];

            newPractice[spotToMove] = originalStats;
        }

        practice.AddRange(newPractice);
    }