public static void LoadBrushes () {

		// Set brush presets and custom brush texture
		brushPrefabs = new List<Object>();
		string assetsDataPath = Application.dataPath;
		string editorBrushPath = assetsDataPath+"/"+PlaygroundParticleWindowC.playgroundPath+PlaygroundParticleWindowC.brushPath;
		string[] editorBrushPaths = Directory.GetFiles (editorBrushPath);
		
		foreach (string thisBrushPath in editorBrushPaths) {
			string convertedBrushPath = thisBrushPath.Substring(assetsDataPath.Length-6);
			Object brushPathObject = (Object)AssetDatabase.LoadAssetAtPath(convertedBrushPath, typeof(Object));
			if (brushPathObject!=null && (brushPathObject.GetType().Name)=="GameObject") {
				brushPrefabs.Add (brushPathObject);
			}
		}


		brushNames = new string[brushPrefabs.Count];
		paintSpacings = new float[brushPrefabs.Count];
		brushPresets = new PlaygroundBrushC[brushPrefabs.Count];
		exceedMaxStopsPaintList = new bool[brushPrefabs.Count];
		for (int i = 0; i<brushPresets.Length; i++) {
			GameObject thisBrushGO = (GameObject)Instantiate (brushPrefabs[i]);
			PlaygroundBrushPresetC thisBrushPrefab = thisBrushGO.GetComponent<PlaygroundBrushPresetC>();
			brushNames[i] = thisBrushPrefab.presetName;
			brushPresets[i] = new PlaygroundBrushC();
			brushPresets[i].texture = thisBrushPrefab.texture as Texture2D;
			brushPresets[i].detail = thisBrushPrefab.detail;
			brushPresets[i].scale = thisBrushPrefab.scale;
			brushPresets[i].distance = thisBrushPrefab.distance;
			
			paintSpacings[i] = thisBrushPrefab.spacing;
			exceedMaxStopsPaintList[i] = thisBrushPrefab.exceedMaxStopsPaint;
			DestroyImmediate (thisBrushGO);
		}
		
		if (source.intValue==5 && paintTexture!=null)
			SetBrush(selectedBrushPreset);
		
		
		if (playgroundParticlesScriptReference.paint!=null && playgroundParticlesScriptReference.paint.brush!=null && playgroundParticlesScriptReference.paint.brush.texture!=null) {
			paintTexture = playgroundParticlesScriptReference.paint.brush.texture;
		}
	}
コード例 #2
0
	// Clone this PlaygroundBrush
	public PlaygroundBrushC Clone () {
		PlaygroundBrushC playgroundBrush = new PlaygroundBrushC();
		playgroundBrush.texture = this.texture;
		playgroundBrush.scale = this.scale;
		playgroundBrush.detail = this.detail;
		playgroundBrush.distance = this.distance;
		playgroundBrush.color = this.color.Clone() as Color32[];
		playgroundBrush.colorLength = this.colorLength;
		return playgroundBrush;
	}
	public static void LoadBrushes () {
		// Set brush presets and custom brush texture
		brushPrefabs = Resources.LoadAll("Csharp/Brushes", typeof(PlaygroundBrushPresetC));
		brushNames = new string[brushPrefabs.Length];
		paintSpacings = new float[brushPrefabs.Length];
		brushPresets = new PlaygroundBrushC[brushPrefabs.Length];
		exceedMaxStopsPaintList = new bool[brushPrefabs.Length];
		for (int i = 0; i<brushPresets.Length; i++) {
			PlaygroundBrushPresetC thisBrushPrefab = brushPrefabs[i] as PlaygroundBrushPresetC;
			brushNames[i] = thisBrushPrefab.presetName;
			brushPresets[i] = new PlaygroundBrushC();
			brushPresets[i].texture = thisBrushPrefab.texture as Texture2D;
			brushPresets[i].detail = thisBrushPrefab.detail;
			brushPresets[i].scale = thisBrushPrefab.scale;
			brushPresets[i].distance = thisBrushPrefab.distance;
			
			paintSpacings[i] = thisBrushPrefab.spacing;
			exceedMaxStopsPaintList[i] = thisBrushPrefab.exceedMaxStopsPaint;
		}
		
		if (source.intValue==5 && paintTexture!=null)
			SetBrush(selectedBrushPreset);
		
		
		if (playgroundParticlesScriptReference.paint!=null && playgroundParticlesScriptReference.paint.brush!=null && playgroundParticlesScriptReference.paint.brush.texture!=null) {
			paintTexture = playgroundParticlesScriptReference.paint.brush.texture;
		}
	}
コード例 #4
0
	public bool initialized = false;								// Is this PaintObject initialized yet?
	
	// Initializes a PaintObject for painting
	public void Initialize () {
		paintPositions = new List<PaintPositionC>();
		brush = new PlaygroundBrushC();
		lastPaintPosition = PlaygroundC.initialTargetPosition;
		initialized = true;
	}