本文整理汇总了C#中UnityEngine.AnimationCurve类的典型用法代码示例。如果您正苦于以下问题:C# AnimationCurve类的具体用法?C# AnimationCurve怎么用?C# AnimationCurve使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AnimationCurve类属于UnityEngine命名空间,在下文中一共展示了AnimationCurve类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: NormalCurveRenderer
public NormalCurveRenderer(AnimationCurve curve)
{
this.m_Curve = curve;
if (this.m_Curve != null)
return;
this.m_Curve = new AnimationCurve();
}
示例2: SetLoupiotteAproach
void SetLoupiotteAproach()
{
AnimationClip clip = new AnimationClip();
Keyframe[] xValues = new Keyframe[5];
Keyframe[] yValues = new Keyframe[5];
Keyframe[] zValues = new Keyframe[5];
Keyframe[] stateValues = new Keyframe[5];
for (int i = 0; i<5; i++)
{
xValues[i] = new Keyframe(i * 3.0f, i < 4 ? Random.Range(-20.0f / (2 * i + 1), 20.0f / (2 * i + 1)) : xReference);
zValues[i] = new Keyframe(i * 3.0f, i < 4 ? Random.Range(-20.0f / (2 * i + 1), 20.0f / (2 * i + 1)) : zReference);
stateValues[i] = new Keyframe(i * 3.0f, i < 4 ? 0.0f : 1.0f);
}
yValues[0] = new Keyframe(0.0f, 50.0f);
yValues[1] = new Keyframe(3.0f, 35.0f);
yValues[2] = new Keyframe(6.0f, 25.0f);
yValues[3] = new Keyframe(9.0f, 15.0f);
yValues[4] = new Keyframe(12.0f, yReference);
AnimationCurve xCurve = new AnimationCurve(xValues);
AnimationCurve yCurve = new AnimationCurve(yValues);
AnimationCurve zCurve = new AnimationCurve(zValues);
AnimationCurve stateCurve = new AnimationCurve(stateValues);
clip.legacy = true;
clip.SetCurve("", typeof(Loupiotte), "positionToPlayer.x", xCurve);
clip.SetCurve("", typeof(Loupiotte), "positionToPlayer.y", yCurve);
clip.SetCurve("", typeof(Loupiotte), "positionToPlayer.z", zCurve);
clip.SetCurve("", typeof(Loupiotte), "state", stateCurve);
anim.AddClip(clip, "Approche");
}
示例3: UpdateTangentsFromMode
public static void UpdateTangentsFromMode(AnimationCurve curve)
{
for (int i = 0; i < curve.length; i++)
{
CurveUtility.UpdateTangentsFromMode(curve, i);
}
}
示例4: OnDeathStart
void OnDeathStart(DynamicScreen loser, float loseTime, AnimationCurve loseRate)
{
if (loser.screenIndex == instanceIndex)
{
StartCoroutine(DeathRoutine(loseTime));
}
}
示例5: OnEnable
void OnEnable()
{ // This function is called when the object is loaded (used for similar reasons to MonoBehaviour.Reset)
id = GUID.Create(id);
if (attribDataFabs == null) attribDataFabs = new List<RPGAttributeData>(0);
if (levelCurve == null) levelCurve = AnimationCurve.Linear(1, 1, maxXP, maxLevel);
if (xpAttribId == null) xpAttribId = new GUID();
}
示例6: OnEnter
public override void OnEnter()
{
base.OnEnter();
finishInNextStep = false;
resultFloats = new float[4];
fromFloats = new float[4];
fromFloats[0] = fromValue.IsNone ? 0f : fromValue.Value.r;
fromFloats[1] = fromValue.IsNone ? 0f : fromValue.Value.g;
fromFloats[2] = fromValue.IsNone ? 0f : fromValue.Value.b;
fromFloats[3] = fromValue.IsNone ? 0f : fromValue.Value.a;
toFloats = new float[4];
toFloats[0] = toValue.IsNone ? 0f : toValue.Value.r;
toFloats[1] = toValue.IsNone ? 0f : toValue.Value.g;
toFloats[2] = toValue.IsNone ? 0f : toValue.Value.b;
toFloats[3] = toValue.IsNone ? 0f : toValue.Value.a;
curves = new AnimationCurve[4];
curves[0] = curveR.curve;
curves[1] = curveG.curve;
curves[2] = curveB.curve;
curves[3] = curveA.curve;
calculations = new Calculation[4];
calculations[0] = calculationR;
calculations[1] = calculationG;
calculations[2] = calculationB;
calculations[3] = calculationA;
//call Init after you have initialized curves array
Init();
}
示例7: Start
// Use this for initialization
void Start()
{
m_InitialPosition = gameObject.transform.localPosition;
m_RelPosition.Set(0, 0, 0);
m_Translations = new Vector3[3];
m_Translations[0].Set(m_Speed, 0, 0);
m_Translations[1].Set(0, m_Speed, 0);
m_Translations[2].Set(0, 0, m_Speed);
gameObject.AddComponent<Animation>();
gameObject.animation.animatePhysics = true;
m_Forward = new AnimationClip();
var curvex = new AnimationCurve();
var curvey = new AnimationCurve();
var curvez = new AnimationCurve();
var minpos = m_InitialPosition+m_MinIncrement;
var maxpos = m_InitialPosition-m_MaxIncrement;
float dist = (minpos-maxpos).magnitude;
m_MaxTime = dist/m_Speed;
curvex.AddKey(0f, minpos.x);
curvex.AddKey(dist/m_Speed, maxpos.x);
curvey.AddKey(0f, minpos.y);
curvey.AddKey(dist/m_Speed, maxpos.y);
curvez.AddKey(0f, minpos.z);
curvez.AddKey(dist/m_Speed, maxpos.z);
m_Forward.wrapMode = WrapMode.ClampForever;
m_Forward.SetCurve("", typeof(Transform), "localPosition.x", curvex);
m_Forward.SetCurve("", typeof(Transform), "localPosition.y", curvey);
m_Forward.SetCurve("", typeof(Transform), "localPosition.z", curvez);
this.animation.AddClip(m_Forward, "Forward");
this.animation.Play("Forward");
m_ForwardState = this.animation["Forward"];
}
示例8: TreeGroup
public TreeGroup()
{
Keyframe[] keys = new Keyframe[] { new Keyframe(0f, 1f), new Keyframe(1f, 1f) };
this.distributionCurve = new AnimationCurve(keys);
this.distributionNodes = 5;
this.distributionTwirl = 0f;
this.distributionPitch = 0f;
Keyframe[] keyframeArray2 = new Keyframe[] { new Keyframe(0f, 1f), new Keyframe(1f, 1f) };
this.distributionPitchCurve = new AnimationCurve(keyframeArray2);
this.distributionScale = 1f;
Keyframe[] keyframeArray3 = new Keyframe[] { new Keyframe(0f, 1f), new Keyframe(1f, 0.3f) };
this.distributionScaleCurve = new AnimationCurve(keyframeArray3);
this.showAnimationProps = true;
this.animationPrimary = 0.5f;
this.animationSecondary = 0.5f;
this.animationEdge = 1f;
this.visible = true;
this.lockFlags = 0;
this.nodeIDs = new int[0];
this.parentGroupID = -1;
this.childGroupIDs = new int[0];
this.nodes = new List<TreeNode>();
this.parentGroup = null;
this.childGroups = new List<TreeGroup>();
}
示例9: OnEnter
public override void OnEnter()
{
base.OnEnter();
finishInNextStep = false;
resultFloats = new float[3];
fromFloats = new float[3];
fromFloats[0] = vectorVariable.IsNone ? 0f : vectorVariable.Value.x;
fromFloats[1] = vectorVariable.IsNone ? 0f : vectorVariable.Value.y;
fromFloats[2] = vectorVariable.IsNone ? 0f : vectorVariable.Value.z;
curves = new AnimationCurve[3];
curves[0] = curveX.curve;
curves[1] = curveY.curve;
curves[2] = curveZ.curve;
calculations = new Calculation[3];
calculations[0] = calculationX;
calculations[1] = calculationY;
calculations[2] = calculationZ;
Init();
// Set initial value
if (Math.Abs(delay.Value) < 0.01f)
{
UpdateVariableValue();
}
}
示例10: Start
void Start()
{
// Initialize the time value to the end time of the animation to prevent it from playing right away
_timeValue = flashDuration;
_flashCurve = new AnimationCurve (new Keyframe (0, 0), new Keyframe (flashDuration * 0.15F, 1), new Keyframe (flashDuration, 0));
}
示例11: Start
void Start()
{
moves[0] = new Vector3( 0f, 1f, 0f);
moves[1] = new Vector3(-3f, 1f, 5f);
moves[2] = new Vector3( 3f, 1f, 5f);
moves[3] = new Vector3(-3f, 1f, -3f);
moves[4] = new Vector3( 3f, 1f, -3f);
for(int i=0;i<5;i++){
cubes[i] = GameObject.Find ("BoardCube"+i);
Vector3 move = cubes[i].transform.position;
AnimationClip clip = new AnimationClip();
Keyframe[] keysX = new Keyframe[2];
keysX[0] = new Keyframe( 0f, move.x-3);
keysX[1] = new Keyframe(i+1f, move.x+3);
AnimationCurve curveX = new AnimationCurve(keysX);
clip.SetCurve("", typeof(Transform), "localPosition.x", curveX);
clip.wrapMode = WrapMode.PingPong;
Keyframe[] keysY = new Keyframe[2];
keysY[0] = new Keyframe( 0f, move.y);
keysY[1] = new Keyframe(i+1f, move.y);
AnimationCurve curveY = new AnimationCurve(keysY);
clip.SetCurve("", typeof(Transform), "localPosition.y", curveY);
Keyframe[] keysZ = new Keyframe[2];
keysZ[0] = new Keyframe( 0f, move.z);
keysZ[1] = new Keyframe(i+1f, move.z);
AnimationCurve curveZ = new AnimationCurve(keysZ);
clip.SetCurve("", typeof(Transform), "localPosition.z", curveZ);
cubes[i].animation.AddClip(clip, "clip1");
cubes[i].animation.Play("clip1");
}
}
示例12: GenerateTerrainMesh
public static MeshData GenerateTerrainMesh(float[,] heightMap, float heightMultiplier, AnimationCurve _heightCurve, int levelOfDetail) {
AnimationCurve heightCurve = new AnimationCurve (_heightCurve.keys);
int width = heightMap.GetLength (0);
int height = heightMap.GetLength (1);
float topLeftX = (width - 1) / -2f;
float topLeftZ = (height - 1) / 2f;
int meshSimplificationIncrement = (levelOfDetail == 0)?1:levelOfDetail * 2;
int verticesPerLine = (width - 1) / meshSimplificationIncrement + 1;
MeshData meshData = new MeshData (verticesPerLine, verticesPerLine);
int vertexIndex = 0;
for (int y = 0; y < height; y += meshSimplificationIncrement) {
for (int x = 0; x < width; x += meshSimplificationIncrement) {
meshData.vertices [vertexIndex] = new Vector3 (topLeftX + x, heightCurve.Evaluate (heightMap [x, y]) * heightMultiplier, topLeftZ - y);
meshData.uvs [vertexIndex] = new Vector2 (x / (float)width, y / (float)height);
if (x < width - 1 && y < height - 1) {
meshData.AddTriangle (vertexIndex, vertexIndex + verticesPerLine + 1, vertexIndex + verticesPerLine);
meshData.AddTriangle (vertexIndex + verticesPerLine + 1, vertexIndex, vertexIndex + 1);
}
vertexIndex++;
}
}
return meshData;
}
示例13: AddPoints
private void AddPoints(float minTime, float maxTime)
{
AnimationCurve quaternionX = this.quaternionX;
if (quaternionX.length == 0)
{
quaternionX = this.eulerX;
}
if (quaternionX.length != 0)
{
Keyframe keyframe = quaternionX[0];
if (keyframe.time >= minTime)
{
Keyframe keyframe2 = quaternionX[0];
Vector3 values = this.GetValues(keyframe2.time, true);
this.points[this.rangeStart] = values;
Keyframe keyframe3 = quaternionX[0];
this.points[keyframe3.time] = values;
}
Keyframe keyframe4 = quaternionX[quaternionX.length - 1];
if (keyframe4.time <= maxTime)
{
Keyframe keyframe5 = quaternionX[quaternionX.length - 1];
Vector3 vector2 = this.GetValues(keyframe5.time, true);
Keyframe keyframe6 = quaternionX[quaternionX.length - 1];
this.points[keyframe6.time] = vector2;
this.points[this.rangeEnd] = vector2;
}
for (int i = 0; i < (quaternionX.length - 1); i++)
{
Keyframe keyframe7 = quaternionX[i + 1];
if (keyframe7.time >= minTime)
{
Keyframe keyframe8 = quaternionX[i];
if (keyframe8.time <= maxTime)
{
Keyframe keyframe9 = quaternionX[i];
float time = keyframe9.time;
this.points[time] = this.GetValues(time, true);
for (float j = 1f; j <= 20f; j++)
{
Keyframe keyframe10 = quaternionX[i];
Keyframe keyframe11 = quaternionX[i + 1];
time = Mathf.Lerp(keyframe10.time, keyframe11.time, (j - 0.001f) / 40f);
this.points[time] = this.GetValues(time, false);
}
Keyframe keyframe12 = quaternionX[i + 1];
time = keyframe12.time;
this.points[time] = this.GetValues(time, true);
for (float k = 1f; k <= 20f; k++)
{
Keyframe keyframe13 = quaternionX[i];
Keyframe keyframe14 = quaternionX[i + 1];
time = Mathf.Lerp(keyframe13.time, keyframe14.time, 1f - ((k - 0.001f) / 40f));
this.points[time] = this.GetValues(time, false);
}
}
}
}
}
}
示例14: JetAffector
public JetAffector(float mag, MAGTYPE type, AnimationCurve curve,EffectNode node)
: base(node, AFFECTORTYPE.JetAffector)
{
Mag = mag;
MType = type;
MagCurve = curve;
}
示例15: TreeGroupBranch
public TreeGroupBranch()
{
Keyframe[] keys = new Keyframe[] { new Keyframe(0f, 1f, -1f, -1f), new Keyframe(1f, 0f, -1f, -1f) };
this.radiusCurve = new AnimationCurve(keys);
this.radiusMode = true;
this.capSmoothing = 0f;
this.crinklyness = 0.1f;
Keyframe[] keyframeArray2 = new Keyframe[] { new Keyframe(0f, 1f), new Keyframe(1f, 1f) };
this.crinkCurve = new AnimationCurve(keyframeArray2);
this.seekBlend = 0f;
Keyframe[] keyframeArray3 = new Keyframe[] { new Keyframe(0f, 1f), new Keyframe(1f, 1f) };
this.seekCurve = new AnimationCurve(keyframeArray3);
this.noise = 0.1f;
Keyframe[] keyframeArray4 = new Keyframe[] { new Keyframe(0f, 1f), new Keyframe(1f, 1f) };
this.noiseCurve = new AnimationCurve(keyframeArray4);
this.noiseScaleU = 0.2f;
this.noiseScaleV = 0.1f;
this.flareSize = 0f;
this.flareHeight = 0.1f;
this.flareNoise = 0.3f;
this.weldHeight = 0.1f;
this.weldSpreadTop = 0f;
this.weldSpreadBottom = 0f;
this.breakingChance = 0f;
this.breakingSpot = new Vector2(0.4f, 0.6f);
this.frondCount = 1;
this.frondWidth = 1f;
Keyframe[] keyframeArray5 = new Keyframe[] { new Keyframe(0f, 1f), new Keyframe(1f, 1f) };
this.frondCurve = new AnimationCurve(keyframeArray5);
this.frondRange = new Vector2(0.1f, 1f);
this.frondRotation = 0f;
this.frondCrease = 0f;
}