示例#1
0
	// Plays a video either locally (must be in the StreamingAssets folder or accessible via full path) or remotely.  The video format must be compatible with the current
	// device.  Many devices have different supported video formats so choose the most common (probably 3gp).
	// When playing a video from the StreamingAssets folder you only need to provide the filename via the pathOrUrl parameter.
	public static void playMovie( string pathOrUrl, uint bgColor, bool showControls, ScalingMode scalingMode, bool closeOnTouch )
	{
		if( Application.platform != RuntimePlatform.Android )
			return;
		
		_plugin.Call( "playMovie", pathOrUrl, (int)bgColor, showControls, (int)scalingMode, closeOnTouch );
	}
 // Update is called once per frame
 void Update()
 {
     if (ScalingMode.ScaleUp == _scalingMode)
     {
         if (transform.localScale.x < 1.0f)
         {
             float scaleAmount = 1.0f / timeToScaleUp * Time.deltaTime;
             transform.localScale = new Vector3(Mathf.Min(1.0f, transform.localScale.x + scaleAmount),
                                                Mathf.Min(1.0f, transform.localScale.y + scaleAmount),
                                                1.0f);
         }
         else
         {
             _scalingMode = ScalingMode.None;
         }
     }
     else if (ScalingMode.ScaleDown == _scalingMode)
     {
         if (transform.localScale.x > 0.0f)
         {
             float scaleAmount = 1.0f / timeToScaleDown * Time.deltaTime;
             transform.localScale = new Vector3(Mathf.Max(0.0f, transform.localScale.x - scaleAmount),
                                                Mathf.Max(0.0f, transform.localScale.y - scaleAmount),
                                                1.0f);
         }
         else
         {
             // We're done, can destroy ourselves.
             _scalingMode = ScalingMode.None;
             Destroy(gameObject);
         }
     }
     else // should we timeout and start collapsing ourselves?
     {
         if (Time.time - _startTime > maxLifetime)
         {
             ScaleDown();
         }
     }
 }
示例#3
0
        /// <summary>
        /// Rescales destination exponentValue according to its associated exponent.
        /// </summary>
        /// <param name="current">The current exponentValue.</param>
        /// <param name="baseValue">The unscaled exponentValue, gotten from the prefab.</param>
        /// <param name="name">The name of the field.</param>
        /// <param name="scalingMode">Information on exactly how to scale this.</param>
        /// <param name="factor">The rescaling factor.</param>
        /// <returns>The rescaled exponentValue.</returns>
        private static void Rescale(MemberUpdater current, MemberUpdater baseValue, string name, ScalingMode scalingMode, ScalingFactor factor)
        {
            var exponentValue = scalingMode.Exponent;
            var exponent = double.NaN;
            double[] values = null;
            if (exponentValue.Contains(','))
            {
                if (factor.index == -1)
                {
                    Tools.LogWf("Value list used for freescale part exponent field {0}: {1}", name, exponentValue);
                    return;
                }
                values = Tools.ConvertString(exponentValue, new double[] { });
                if (values.Length <= factor.index)
                {
                    Tools.LogWf("Too few values given for {0}. Expected at least {1}, got {2}: {3}", name, factor.index + 1, values.Length, exponentValue);
                    return;
                }
            }
            else if (!double.TryParse(exponentValue, out exponent))
            {
                Tools.LogWf("Invalid exponent {0} for field {1}", exponentValue, name);
            }

            double multiplyBy = 1;
            if (!double.IsNaN(exponent))
              multiplyBy = Math.Pow(scalingMode.UseRelativeScaling ? factor.relative.linear : factor.absolute.linear, exponent);

            if (current.MemberType.GetInterface("IList") != null)
            {
                var v = (IList)current.Value;
                var v2 = (IList)baseValue.Value;
                if(v == null)
                {
                    Tools.LogWf("current.Value == null!");
                    return;
                }

                for (var i = 0; i < v.Count && i < v2.Count; ++i)
                {
                    if (values != null)
                    {
                        v[i] = values[factor.index];
                    }
                    else if (!double.IsNaN(exponent))
                    {
                        if (v[i] is float)
                        {
                            v[i] = (float)v2[i] * multiplyBy;
                        }
                        else if (v[i] is double)
                        {
                            v[i] = (double)v2[i] * multiplyBy;
                        }
                        else if (v[i] is Vector3)
                        {
                            v[i] = (Vector3)v2[i] * (float)multiplyBy;
                        }
                    }
                }
            }

            if (values != null)
            {
                if (current.MemberType == typeof (float))
                {
                    current.Set((float)values[factor.index]);
                }
                else if (current.MemberType == typeof(float))
                {
                    current.Set(values[factor.index]);
                }

            }
            else if (!double.IsNaN(exponent))
            {
                current.Scale(multiplyBy, baseValue);
            }
        }
 public void StopScaling()
 {
     _scalingMode = ScalingMode.None;
 }
 public void ScaleDown()
 {
     transform.GetChild(0).GetComponent<CircleCollider2D>().enabled = false;
     _scalingMode = ScalingMode.ScaleDown;
     _loopingSound.FadeOut();
 }
示例#6
0
 public static extern int imaqScale(IntPtr dest, IntPtr source, int xScale, int yScale, ScalingMode scaleMode, Rect rect);