void Start()
	{
		currentBlock = fxBlocks[0];
		for(int i=0;i<fxBlocks.Length;i++){
			FXBlock fxBlock = fxBlocks[i];
			totalCount+=fxBlock.particlePrefabs.Length;
		}
		spawnPeriodString=spawnPeriod.ToString("00.0");
		prevspawnPeriod=spawnPeriod;
	}
示例#2
0
 void Start()
 {
     currentBlock = fxBlocks[0];
     for (int i = 0; i < fxBlocks.Length; i++)
     {
         FXBlock fxBlock = fxBlocks[i];
         totalCount += fxBlock.particlePrefabs.Length;
     }
     spawnPeriodString = spawnPeriod.ToString("00.0");
     prevspawnPeriod   = spawnPeriod;
 }
	void OnGUI()
	{		
		GUILayout.BeginArea(new Rect(10,10,Screen.width-10,30));
		GUILayout.BeginHorizontal();
		
		GUILayout.Label("Spawn Period", GUILayout.Width(90));
		
		GUILayout.Label(currentPrefabName, GUILayout.Width(350));
				
		GUILayout.EndHorizontal();
		GUILayout.EndArea();
		
		
		GUILayout.BeginArea(new Rect(10,40,Screen.width-10,30));
		GUILayout.BeginHorizontal();
		
		//spawnPeriod
		float newspawnPeriod;
		spawnPeriodString = GUILayout.TextField(spawnPeriodString,GUILayout.Width(40));
		if (float.TryParse(spawnPeriodString, out newspawnPeriod))
    	{
        	spawnPeriod = newspawnPeriod;
			if(spawnPeriod<0.1f)
			{
				spawnPeriod=0.1f;
			}
			
			if(spawnPeriod>=100)
			{
				spawnPeriod=99.9f;
			}
			
			
			if(prevspawnPeriod!=spawnPeriod)
			{
				spawnNextTime-= prevspawnPeriod-spawnPeriod;
			}
			prevspawnPeriod=spawnPeriod;
    	}
		
		spawnPeriodString=spawnPeriod.ToString("00.0");
		
		GUILayout.Label("", GUILayout.Width(50));
		
		if(GUILayout.Button("Prev",GUILayout.Width(60)))
		{
			currentPrefabId--;
			currentNumber--;
			if(currentPrefabId<0){
				currentBlockId--;
				if(currentBlockId<0){
					currentNumber = totalCount;
					currentBlockId = fxBlocks.Length-1;	
				}
				currentBlock = fxBlocks[currentBlockId];
				currentPrefabId = currentBlock.particlePrefabs.Length-1;
			}
			SwitchCurrentParticle();
		}
		
		if(GUILayout.Button("Next",GUILayout.Width(60)))
		{
			currentPrefabId++;
			currentNumber++;
			if(currentPrefabId>currentBlock.particlePrefabs.Length-1){
				currentBlockId++;
				if(currentBlockId>fxBlocks.Length-1){
					currentBlockId = 0;	
					currentNumber = 1;
				}
				currentBlock = fxBlocks[currentBlockId];
				currentPrefabId = 0;
			}
			SwitchCurrentParticle();
		}
		
		GUILayout.EndHorizontal();
		GUILayout.EndArea();
		
		GUI.Label (new Rect (Screen.width - 250,Screen.height - 40,250,250), "Click on the ground to spawn a particle");
	}
示例#4
0
    void OnGUI()
    {
        GUILayout.BeginArea(new Rect(10, 10, Screen.width - 10, 30));
        GUILayout.BeginHorizontal();

        GUILayout.Label("Spawn Period", GUILayout.Width(90));

        GUILayout.Label(currentPrefabName, GUILayout.Width(350));

        GUILayout.EndHorizontal();
        GUILayout.EndArea();


        GUILayout.BeginArea(new Rect(10, 40, Screen.width - 10, 30));
        GUILayout.BeginHorizontal();

        //spawnPeriod
        float newspawnPeriod;

        spawnPeriodString = GUILayout.TextField(spawnPeriodString, GUILayout.Width(40));
        if (float.TryParse(spawnPeriodString, out newspawnPeriod))
        {
            spawnPeriod = newspawnPeriod;
            if (spawnPeriod < 0.1f)
            {
                spawnPeriod = 0.1f;
            }

            if (spawnPeriod >= 100)
            {
                spawnPeriod = 99.9f;
            }


            if (prevspawnPeriod != spawnPeriod)
            {
                spawnNextTime -= prevspawnPeriod - spawnPeriod;
            }
            prevspawnPeriod = spawnPeriod;
        }

        spawnPeriodString = spawnPeriod.ToString("00.0");

        GUILayout.Label("", GUILayout.Width(50));

        if (GUILayout.Button("Prev", GUILayout.Width(60)))
        {
            currentPrefabId--;
            currentNumber--;
            if (currentPrefabId < 0)
            {
                currentBlockId--;
                if (currentBlockId < 0)
                {
                    currentNumber  = totalCount;
                    currentBlockId = fxBlocks.Length - 1;
                }
                currentBlock    = fxBlocks[currentBlockId];
                currentPrefabId = currentBlock.particlePrefabs.Length - 1;
            }
            SwitchCurrentParticle();
        }

        if (GUILayout.Button("Next", GUILayout.Width(60)))
        {
            currentPrefabId++;
            currentNumber++;
            if (currentPrefabId > currentBlock.particlePrefabs.Length - 1)
            {
                currentBlockId++;
                if (currentBlockId > fxBlocks.Length - 1)
                {
                    currentBlockId = 0;
                    currentNumber  = 1;
                }
                currentBlock    = fxBlocks[currentBlockId];
                currentPrefabId = 0;
            }
            SwitchCurrentParticle();
        }

        GUILayout.EndHorizontal();
        GUILayout.EndArea();

        GUI.Label(new Rect(Screen.width - 250, Screen.height - 40, 250, 250), "Click on the ground to spawn a particle");
    }