Exemplo n.º 1
0
    public static CreatureDescriptor CreateRandomCreatureDescriptor()
    {
        CreatureDescriptor randomDNA = new CreatureDescriptor();

        randomDNA.Color = CritterConstants.PickRandomCreatureColor();
        randomDNA.Shape = CritterConstants.PickRandomCreatureShape();
        randomDNA.Size  = CritterConstants.PickRandomCreatureSize();

        if (CritterSpawner.Instance != null)
        {
            CritterSpawner.Instance.PickNRandomAttachmentPrefabs(randomDNA);
            //randomDNA.SortAttachments();
        }

        return(randomDNA);
    }
Exemplo n.º 2
0
    CustomerOrder CreateRandomOrder()
    {
        CustomerOrder newOrder = new CustomerOrder();

        newOrder.OrderNumber     = _ordersIssued + 1;
        newOrder.SpawnDescriptor = CreatureDescriptor.CreateRandomCreatureDescriptor();

        int numDesiredChanges = OrderDesiredChanges.RandomValue;

        CustomerDesire.DesireType[] desiredChangeSequence = new CustomerDesire.DesireType[4] {
            CustomerDesire.DesireType.ChangeColor,
            CustomerDesire.DesireType.ChangeShape,
            CustomerDesire.DesireType.ChangeSize,
            CustomerDesire.DesireType.ChangeAttachments
        };
        ArrayUtilities.KnuthShuffle <CustomerDesire.DesireType>(desiredChangeSequence);

        newOrder.CustomerDesires = new CustomerDesire[numDesiredChanges];
        for (int desireIndex = 0; desireIndex < numDesiredChanges; ++desireIndex)
        {
            CustomerDesire.DesireType desiredChangeType = desiredChangeSequence[desireIndex];
            switch (desiredChangeType)
            {
            case CustomerDesire.DesireType.ChangeAttachments:
            {
                CreatureAttachmentDesire newDesire = new CreatureAttachmentDesire();
                newDesire.AttachmentDescriptor = CritterSpawner.Instance.PickRandomAttachmentDescriptor();
                newDesire.Count = DesiredAttachmentCount.RandomValue;

                newOrder.CustomerDesires[desireIndex] = newDesire;
            }
            break;

            case CustomerDesire.DesireType.ChangeColor:
            {
                CustomerColorDesire newDesire = new CustomerColorDesire();
                newDesire.DesiredColor = CritterConstants.PickRandomCreatureColor();

                newOrder.CustomerDesires[desireIndex] = newDesire;
            }
            break;

            case CustomerDesire.DesireType.ChangeShape:
            {
                CustomerShapeDesire newDesire = new CustomerShapeDesire();
                newDesire.DesiredShape = CritterConstants.PickRandomCreatureShape();

                newOrder.CustomerDesires[desireIndex] = newDesire;
            }
            break;

            case CustomerDesire.DesireType.ChangeSize:
            {
                CustomerSizeDesire newDesire = new CustomerSizeDesire();
                newDesire.DesiredSize = CritterConstants.PickRandomCreatureSize();

                newOrder.CustomerDesires[desireIndex] = newDesire;
            }
            break;
            }
        }

        return(newOrder);
    }