Ejemplo n.º 1
0
 void RemoveProperities(MaterialFxV2 fx)
 {
     for (int i = 0; i < fx.propertyNames.Length; i++)
     {
         if (!IsUsedByOtherFx(fx.propertyNames[i]))
         {
             SetPropertyBack(fx.propertyNames[i], fx.isColor[i]);
             if (fx.isColor[i])
             {
                 colorProperities.Remove(fx.propertyNames[i]);
             }
             else
             {
                 floatProperities.Remove(fx.propertyNames[i]);
             }
         }
     }
 }
Ejemplo n.º 2
0
	void PlayFx(MaterialFxV2 fx)
	{
		thisTarget.Play(fx);

	}
Ejemplo n.º 3
0
 public void Stop(MaterialFxV2 fx = null)
 {
     if (fx == null)
     {
         ani.Stop();
         Cleanup();
     }
     else
     {
         if (currentFxs.Contains(fx) && ani.IsPlaying(fx.clip.name))
         {
             ani.Stop(fx.clip.name);
             currentFxs.Remove(fx);
             RemoveProperities(fx);
         }
     }
 }
Ejemplo n.º 4
0
    public void Play(MaterialFxV2 matFx)
    {
        if (ani == null)
            return;

        enabled = true;

        if (oriMaterials == null)
            GetMats();

        if (ani[matFx.name] == null)
        {
            ani.AddClip(matFx.clip, matFx.name);
        }

        AnimationState aniState = ani[matFx.name];

        aniState.wrapMode = WrapMode.Once;


        if (matFx.mode == MaterialFxV2.Mode.Normal)
        {
            aniState.layer = ++currentLayer;
            aniState.blendMode = AnimationBlendMode.Blend;
        }
        else if (matFx.mode == MaterialFxV2.Mode.StopOther)
        {
            aniState.layer = currentLayer;
            aniState.blendMode = AnimationBlendMode.Blend;

            colorProperities.Clear();
            floatProperities.Clear();
            animation.Stop();
            SetMaterialToOris(false);
        }

        AddProperities(matFx);
        if (!currentFxs.Contains(matFx))
        {
            currentFxs.Add(matFx);
        }
        else
        {
            if (ani.IsPlaying(matFx.clip.name))
                ani.Rewind(matFx.clip.name);
        }
        ani.Play(matFx.clip.name);
        IsPlaying = true;
    }
Ejemplo n.º 5
0
 void AddProperities(MaterialFxV2 fx)
 {
     for (int i = 0; i < fx.propertyNames.Length; i++)
     {
         if (fx.isColor[i])
         {
             if (!colorProperities.Contains(fx.propertyNames[i]))
                 colorProperities.Add(fx.propertyNames[i]);
         }
         else
         {
             if (!floatProperities.Contains(fx.propertyNames[i]))
                 floatProperities.Add(fx.propertyNames[i]);
         }
     }
 }
Ejemplo n.º 6
0
	public void Play(MaterialFxV2 fx)
	{
		if (character == null)
		{
			Debug.LogError("Assign Character");
			return;
		}

		Transform playerT = character.transform.Find("materialFxPlayer");
		if (playerT == null)
		{
			playerT = (new GameObject()).transform;
			playerT.name = "materialFxPlayer";
			playerT.parent = character.transform;
			playerT.localPosition = Vector3.zero;
			playerT.localEulerAngles = Vector3.zero;
			playerT.localScale = Vector3.one;
		}


		player = playerT.GetComponent<MaterialFxPlayerV2>() ?? playerT.gameObject.AddComponent<MaterialFxPlayerV2>();
		MaterialParameters mp = playerT.GetComponent<MaterialParameters>() ?? playerT.gameObject.AddComponent<MaterialParameters>();
		Animation ani = playerT.GetComponent<Animation>();
		if (ani == null)
			ani = playerT.gameObject.AddComponent<Animation>();

		


		if (fx)
			player.Play(fx);
		else
		{
			Debug.LogWarning("target fx is null");
		}

	}
Ejemplo n.º 7
0
	public void Stop(MaterialFxV2 fx = null)
	{
		if (player)
			player.Stop(fx);
	}