Ejemplo n.º 1
0
    /// <summary>
    /// Basic initialisation.
    /// </summary>
    void Start()
    {
        textLabel = this.GetComponent <Text>();
        GameObject stepGenGameObject = GameObject.FindGameObjectWithTag("StepGenerator");

        stepGenerator = stepGenGameObject.GetComponent <StepGenerator>();
        stepGenerator.AddStepReceiver(this);
    }
Ejemplo n.º 2
0
        public BeatRandomizer(BeatRandomizerSettings settings)
        {
            stepGenerator  = new StepGenerator();
            mineGenerator  = new MineGenerator();
            generatorState = new GeneratorState(settings.random);

            this.settings = settings;
        }
Ejemplo n.º 3
0
    /// <summary>
    /// Initializes a new instance of the <see cref="StatisticsWriter"/> class.
    /// </summary>
    /// <param name="paramSet">The set of project parameters.</param>
    public StatisticsWriter(Garden garden, ParamSet paramSet)
    {
        this.garden             = garden;
        this.statisticsFileName = paramSet.StringParam(ParamSet.ParamGroupStatisticsWriter, ParamSet.ParamStatisticsFileName);
        GameObject stepGenGameObject = GameObject.FindGameObjectWithTag("StepGenerator");

        this.stepGenerator = stepGenGameObject.GetComponent <StepGenerator>();
        EpisodeManager.AddEpisodeChangesReceiver(this);
        // Write the statistics headline into the csv file
        WriteValuesIntoCSVLine(new string[] { statisticsNameEpisode, statisticsNameStepsNeeded });
    }
Ejemplo n.º 4
0
        static CodeGenerator NewStepCodeGenerator(Step Step, StepGenerator StepRunnerGenerator)
        {
            switch (Step.Type)
            {
            case StepType.Table: return(new StepWithSimpleTableGenerator(StepRunnerGenerator));

            case StepType.HeaderTable: return(new StepWithHeaderTableGenerator(StepRunnerGenerator));

            case StepType.ObjectTable: return(Step.Method.LastArg().IsArray ?
                                              new StepWithSimpleTableGenerator(StepRunnerGenerator) as CodeGenerator :
                                              new StepWithHeaderTableGenerator(StepRunnerGenerator));

            default: return(new SimpleStepGenerator(StepRunnerGenerator));
            }
        }
Ejemplo n.º 5
0
    /// <summary>
    /// Starts the project, if the parameters command it to.
    /// </summary>
    void Start()
    {
        // Handle the auto run param.
        bool autoRun = projectParamSet.BoolParam(ParamSet.ParamGroupSetupManager, ParamSet.ParamAutoRun);

        if (autoRun)
        {
            GameObject.FindObjectOfType <RunManager>().StartStopButtonFunctionality = RunManager.StartStopFunctionality.StopFuntionality;
            GameObject    stepGenGameObject = GameObject.FindGameObjectWithTag("StepGenerator");
            StepGenerator stepGen           = stepGenGameObject.GetComponent <StepGenerator>();
            stepGen.StartSteps();
        }
        else
        {
            GameObject.FindObjectOfType <RunManager>().StartStopButtonFunctionality = RunManager.StartStopFunctionality.StartFunctionality;
        }
    }
Ejemplo n.º 6
0
    /// <summary>
    /// Initializes a new instance of the <see cref="Garden"/> class.
    /// Since this is a heavy-weight constructor with lots of error-potential if used incorrectly,
    /// all Garden objects should be created using the <see cref="T:GardenFactory"/>.
    /// </summary>
    /// <param name="gardenWidth">The garden width.</param>
    /// <param name="gardenHeight">The garden height.</param>
    /// <param name="tiles">A list of all tiles of the garden. Must contain <paramref name="gardenWidth"/> times <paramref name="gardenHeight"/> tiles</param>.
    /// <param name="mowerStartPosition">The start position of the mower robot.</param>
    /// <param name="movingObstacles">A list of all moving obstacles in the garden.</param>
    /// <param name="staticObstacles">A list of all static obstacles in the garden.</param>
    /// <param name="paramSet">The set of parameters for this project.</param>
    public Garden(uint gardenWidth, uint gardenHeight,
                  List <Tile> tiles,
                  GridPosition mowerStartPosition,
                  List <MovingObstacle> movingObstacles,
                  List <StaticObstacle> staticObstacles,
                  ParamSet paramSet)
    {
        this.GardenWidth        = gardenWidth;
        this.GardenHeigth       = gardenHeight;
        this.Tiles              = tiles;
        this.MowerStartPosition = mowerStartPosition;
        this.MovingObstacles    = movingObstacles;
        this.StaticObstacles    = staticObstacles;

        this.NumGrassTiles = 0;
        foreach (var tile in Tiles)
        {
            if (tile.GetMowStatus() == Tile.MowStatus.LongGrass)
            {
                this.NumGrassTiles++;
            }
        }
        Debug.Log(string.Format("Garden initialized with {0} tiles to mow", this.NumGrassTiles));

        // Create the mower agent.
        mower = new Mower(MowerStartPosition, this, paramSet);
        mower.AddObserver(this);

        foreach (var movingObstacle in MovingObstacles)
        {
            movingObstacle.AddObserver(this);
        }

        // Receive episode changes.
        EpisodeManager.AddEpisodeChangesReceiver(this);

        // Receive a step-call after each time-step.
        GameObject    stepGenGameObject = GameObject.FindGameObjectWithTag("StepGenerator");
        StepGenerator stepGen           = stepGenGameObject.GetComponent <StepGenerator>();

        stepGen.AddStepReceiver(this);
    }
Ejemplo n.º 7
0
 protected StepCodeGenerator(StepGenerator StepGenerator)
 {
     this.StepGenerator = StepGenerator;
 }
Ejemplo n.º 8
0
    /// <summary>
    /// Used to initialize the RunManager.
    /// </summary>
    void Awake()
    {
        GameObject stepGenGameObject = GameObject.FindGameObjectWithTag("StepGenerator");

        stepGenerator = stepGenGameObject.GetComponent <StepGenerator>();
    }