Exemplo n.º 1
0
    //This is used when we have a game of multiple streaming maps over a few different scenes
    //Statics need to be cleared
    public static StreamingMap GetInstance(bool fresh)
    {
        if (instance == null || fresh)
        {
            instance = GameObject.FindObjectOfType(typeof(StreamingMap)) as StreamingMap;
        }

        return(instance);
    }
Exemplo n.º 2
0
    public override void OnInspectorGUI()
    {
        base.OnInspectorGUI();

        if (GUILayout.Button("Add Color Profile"))
        {
            StreamingMap map = target as StreamingMap;

            StreamingMapColorProfile mp = map.gameObject.GetComponentInChildren <StreamingMapColorProfile>();

            if (mp != null)
            {
                Debug.LogWarning("No dice, there's already a color profile attached to the map. Look down a little in the inspector!");
            }
            else
            {
                //We add this to a new gameobject to allow the user to create a prefab from this color profile
                //
                //In this way, they can transfer color profiles between maps

                GameObject colorRoot = new GameObject("Color Profile");

                colorRoot.transform.parent = map.transform;

                colorRoot.transform.localPosition = Vector3.zero;

                mp     = colorRoot.AddComponent <StreamingMapColorProfile>();
                mp.map = map;

                Selection.activeGameObject = colorRoot.gameObject;
            }
        }

        if (EditorApplication.isPlaying)
        {
            //Warning! This will take a long time for larger maps
            //
            //Use this function at your own discretion. It's for debugging purposes ONLY

            if (GUILayout.Button("Debug: Draw Map"))
            {
                StreamingMap map = target as StreamingMap;

                int radius = map.width;

                if (radius < map.height)
                {
                    radius = map.height;
                }

                int x = (int)((float)map.width * 0.5f);
                int y = (int)((float)map.height * 0.5f);

                map.DrawMap(x, y, 1, radius, true);
            }
        }
    }
Exemplo n.º 3
0
	// Use this for initialization
	void Start () {
			
		//Sanity, please
		if(minStartingHeight <= 0){
			minStartingHeight = 1;
		}
		
		this.streamingMap = gameObject.AddComponent<StreamingMap>();
				
		streamingMap.GenerateMap(mapWidth,mapHeight,1,"Map",new Vector3(1.0f,1.0f,1.0f),5,5,BlockMap.GrowthAxis.Up,0,0,3);
		
		PopulateMap();
		AddPlayerToMap();
		
	}
Exemplo n.º 4
0
    // Use this for initialization
    void Start()
    {
        //Sanity, please
        if (minStartingHeight <= 0)
        {
            minStartingHeight = 1;
        }

        this.streamingMap = gameObject.AddComponent <StreamingMap>();

        streamingMap.GenerateMap(mapWidth, mapHeight, 1, "Map", new Vector3(1.0f, 1.0f, 1.0f), 5, 5, BlockMap.GrowthAxis.Up, 0, 0, 3);

        PopulateMap();
        AddPlayerToMap();
    }
Exemplo n.º 5
0
 public DestroyComparer(StreamingMap map)
 {
     this.map = map;
 }
Exemplo n.º 6
0
 public CreateComparer(StreamingMap map)
 {
     this.map = map;
 }
Exemplo n.º 7
0
    public override void OnInitializeEntity()
    {
        base.OnInitializeEntity();

        this.streamingMap = GameObject.FindObjectOfType(typeof(StreamingMap)) as StreamingMap;
    }
Exemplo n.º 8
0
	public override void OnInitializeEntity ()
	{
		base.OnInitializeEntity ();
		
		this.streamingMap = GameObject.FindObjectOfType(typeof(StreamingMap)) as StreamingMap;
	}