Exemple #1
0
    /// <summary>
    /// Sets up the episode
    /// </summary>
    public override void OnEpisodeBegin()
    {
        goldCollected = 0;

        //If the agent dies, then must reset its health and location
        this.rigidbody.angularVelocity = Vector3.zero;
        this.rigidbody.velocity        = Vector3.zero;
        this.transform.localPosition   = new Vector3(-50f, -35f, -33f);

        health = 100;

        objectSpawner.RemoveAllObjects();
    }
    public override void OnInspectorGUI()
    {
        ObjectSpawner objectSpawner = (ObjectSpawner)target;

        DrawDefaultInspector();

        if (GUILayout.Button("Re-generate"))
        {
            objectSpawner.RemoveAllObjects();
            TerrainGenerator tg = FindObjectOfType <TerrainGenerator>();
            objectSpawner.SpawnObjects(tg.GetAllTileData());
        }

        if (GUILayout.Button("Spawn Objects"))
        {
            TerrainGenerator tg = FindObjectOfType <TerrainGenerator>();
            objectSpawner.SpawnObjects(tg.GetAllTileData());
        }

        if (GUILayout.Button("Remove all objects"))
        {
            objectSpawner.RemoveAllObjects();
        }
    }