void Start ()
	{
		CheckHWSupport();
		
		Array waves;
		waves = this.GetComponents<WaveAnimation>();
		if(waves.Length == 1 && original == null)
		{
			original = this;	
		}
		
		foreach(GameObject s  in siblings)
		{
			AddCopy(s, original, false);	
		}
		if(waves.Length < this.GetComponent<Renderer>().materials.Length)
		{
			AddCopy(gameObject, original, true);
		}
		theMaterial = this.GetComponent<Renderer>().materials[index];
		color = theMaterial.GetColor("_Color");
		fadeColor = color;
		fadeColor.a = 0;
		texScale = theMaterial.GetTextureScale("_MainTex");	
	}
    void AddCopy(GameObject ob, WaveAnimation original, bool copy)
    {
        WaveAnimation newWave = ob.AddComponent <WaveAnimation>();

        newWave.original = original;
        if (copy)
        {
            newWave.index = index + 1;
        }
        else
        {
            newWave.index = index;
        }
        newWave.offset         = original.offset + (2.00f / (float)this.GetComponent <Renderer>().materials.Length);
        newWave.slideMin       = original.slideMin;
        newWave.slideMax       = original.slideMax;
        newWave.slideSpeed     = original.slideSpeed + UnityEngine.Random.Range(-original.slideSpeed / 5, original.slideSpeed / 5);
        newWave.slideSharpness = original.slideSharpness + UnityEngine.Random.Range(-original.slideSharpness / 5, original.slideSharpness / 5);
        newWave.scaleMin       = original.scaleMin;
        newWave.scaleMax       = original.scaleMax;
        newWave.scaleSpeed     = original.scaleSpeed + UnityEngine.Random.Range(-original.scaleSpeed / 5, original.scaleSpeed / 5);
        newWave.scaleSharpness = original.scaleSharpness + UnityEngine.Random.Range(-original.scaleSharpness / 5, original.scaleSharpness / 5);

        newWave.fadeSpeed = original.fadeSpeed;

        Vector3 randy = UnityEngine.Random.onUnitSphere;

        randy.y              = 0;
        newWave.baseScroll   = randy.normalized * original.baseScroll.magnitude;
        newWave.baseRotation = UnityEngine.Random.Range(0, 360);
        newWave.baseScale    = original.baseScale * UnityEngine.Random.Range(0.8f, 1.2f);
    }
Esempio n. 3
0
    public static WaveJointAnimate StartAnimation(WaveAnimation animController,GameObject objToAnim, Vector3 finalRotAngle, float time, float delay, bool changeScale,Vector3 scaleTo)
    {
        WaveJointAnimate tempAnim = objToAnim.AddComponent<WaveJointAnimate>();
        tempAnim.finalRotAngle = finalRotAngle;
        tempAnim.time = time;
        tempAnim.delay = delay;
        tempAnim.changeScale = changeScale;
        tempAnim.scaleTo = scaleTo;
        tempAnim.waveAnimationController = animController;

        return tempAnim;
    }
 /// <summary>
 /// Shows the specified wave animation
 /// </summary>
 /// <param name="animation">Wave animation to show</param>
 public void ShowAnimation( WaveAnimation animation )
 {
     buildButton.Enabled = true;
     if ( animation.Frames.Length == 0 )
     {
         animationPanel.BackgroundImage = null;
         return;
     }
     animationPanel.BackgroundImage = animation.Frames[ 0 ];
     m_CurrentFrame = 0;
     m_Animation = animation;
 }
Esempio n. 5
0
        private void WaveAnimation()
        {
            foreach (var s in ParentSurface.RenderableSeries)
            {
                if (s is BaseRenderableSeries series)
                {
                    var trans = new WaveAnimation();
                    trans.Duration       = TimeSpan.FromSeconds(2);
                    trans.AnimationDelay = TimeSpan.FromSeconds(2);
                    if (s.DataSeries != null)
                    {
                        trans.ZeroLine = (double)series.DataSeries.YMin;
                    }

                    series.SeriesAnimation = trans;
                }
            }
        }
Esempio n. 6
0
 public static void StartAnimation(WaveAnimation animController,GameObject objToAnim, Vector3 finalRotAngle,float time,float delay)
 {
     StartAnimation(animController,objToAnim, finalRotAngle, time, delay, false, Vector3.zero);
 }