// When the Animation get's manipulated, it need's to reset when the game restarts and here it recreate the beginning private void CreateElevateAnim() { float firstFloorKeyframeTime = 0.3f / 2.3f; _elevateClip.ClearCurves(); AnimationCurve curve = AnimationCurve.Constant(0, firstFloorKeyframeTime * 2, 0); Keyframe firstKeyframe = new Keyframe(0, 0); Keyframe firstFloorKeyframe = new Keyframe(firstFloorKeyframeTime, -0.3f); curve.AddKey(firstKeyframe); curve.AddKey(firstFloorKeyframe); _elevateClip.SetCurve("", typeof(Transform), "localPosition.y", curve); AnimationEvent firstWork = new AnimationEvent(); firstWork.functionName = "Work"; firstWork.time = firstFloorKeyframeTime; firstWork.intParameter = 0; _elevateClip.AddEvent(firstWork); _workEvents.Add(firstWork); _storeCoins = new AnimationEvent(); _storeCoins.functionName = "StoreCoins"; _storeCoins.time = firstFloorKeyframeTime * 2; _elevateClip.AddEvent(_storeCoins); }
public void UpdateFromConverter(PlayerStatusConverter converter) { switch (converter.style) { case CurveStyle.Instantly: speed = converter.intendedSpeed; rotationSpeed = converter.intendedRotationalSpeed; speedCurve = AnimationCurve.Constant(0f, 1f, speed); rotationalSpeedCurve = AnimationCurve.Constant(0f, 1f, rotationSpeed); break; case CurveStyle.Linear: ResetTimer(); speedCurve = AnimationCurve.Linear(0f, speed, converter.time, converter.intendedSpeed); rotationalSpeedCurve = AnimationCurve.Linear(0f, rotationSpeed, converter.time, converter.intendedRotationalSpeed); break; case CurveStyle.EaseInOut: ResetTimer(); speedCurve = AnimationCurve.EaseInOut(0f, speed, converter.time, converter.intendedSpeed); rotationalSpeedCurve = AnimationCurve.EaseInOut(0f, rotationSpeed, converter.time, converter.intendedRotationalSpeed); break; } }
// Update is called once per frame void stage1() { AnimationClip ac = new AnimationClip(); ac.legacy = true; Keyframe[] ax = new Keyframe[3]; Keyframe[] az = new Keyframe[3]; Keyframe[] ar = new Keyframe[3]; ax[0] = new Keyframe(8, 24); az[0] = new Keyframe(8, 24); ar[0] = new Keyframe(8, 75); ax[1] = new Keyframe(10, 22.8f); az[1] = new Keyframe(10, 18.5f); ar[1] = new Keyframe(10, 100); ax[2] = new Keyframe(15, 22.8f); az[2] = new Keyframe(15, 18.5f); ar[2] = new Keyframe(15, 100); AnimationCurve cx = new AnimationCurve(ax); AnimationCurve cz = new AnimationCurve(az); AnimationCurve cr = new AnimationCurve(ar); ac.SetCurve("", typeof(Transform), "localPosition.x", cx); ac.SetCurve("", typeof(Transform), "localPosition.y", AnimationCurve.Constant(0, 10, gameObject.transform.position.y)); ac.SetCurve("", typeof(Transform), "localPosition.z", cz); ac.SetCurve("", typeof(Transform), "localEulerAngles.y", cr); a.AddClip(ac, "stage1"); }
public void CheckAnimationClipAndDenseClipHaveSameData() { var clip = new AnimationClip(); var constantCurve = AnimationCurve.Constant(0.0f, 1.0f, 0.0f); clip.SetCurve("", typeof(Transform), "m_LocalPosition.x", constantCurve); clip.SetCurve("", typeof(Transform), "m_LocalPosition.y", constantCurve); clip.SetCurve("", typeof(Transform), "m_LocalPosition.z", constantCurve); clip.SetCurve("", typeof(Transform), "m_LocalRotation.x", constantCurve); clip.SetCurve("", typeof(Transform), "m_LocalRotation.y", constantCurve); clip.SetCurve("", typeof(Transform), "m_LocalRotation.z", constantCurve); clip.SetCurve("", typeof(Transform), "m_LocalRotation.w", constantCurve); clip.SetCurve("", typeof(Transform), "m_LocalScale.x", constantCurve); clip.SetCurve("", typeof(Transform), "m_LocalScale.y", constantCurve); clip.SetCurve("", typeof(Transform), "m_LocalScale.z", constantCurve); clip.SetCurve("Child1", typeof(Transform), "m_LocalPosition.x", constantCurve); clip.SetCurve("Child1", typeof(Transform), "m_LocalPosition.y", constantCurve); clip.SetCurve("Child1", typeof(Transform), "m_LocalPosition.z", constantCurve); clip.SetCurve("Child1", typeof(Transform), "m_LocalRotation.x", constantCurve); clip.SetCurve("Child1", typeof(Transform), "m_LocalRotation.y", constantCurve); clip.SetCurve("Child1", typeof(Transform), "m_LocalRotation.z", constantCurve); clip.SetCurve("Child1", typeof(Transform), "m_LocalRotation.w", constantCurve); clip.SetCurve("Child2", typeof(Transform), "m_LocalPosition.x", constantCurve); clip.SetCurve("Child2", typeof(Transform), "m_LocalPosition.y", constantCurve); clip.SetCurve("Child2", typeof(Transform), "m_LocalPosition.z", constantCurve); var denseClip = ClipBuilder.AnimationClipToDenseClip(clip); var frameCount = (int)(clip.length * clip.frameRate); Assert.That(denseClip.Value.SampleRate, Is.EqualTo(clip.frameRate)); Assert.That(denseClip.Value.FrameCount, Is.EqualTo(frameCount)); ref var bindings = ref denseClip.Value.Bindings;
// When a new Floor get's spawned, the Operator need to adjust his animation and create new events private void ExpandAnimation(int floorCount) { floorCount -= 2; // we only need the unlocked floors - the first floor float firstFloorKeyframeTime = 0.3f / 2.3f; AnimationCurve curve = AnimationCurve.Constant(0, floorCount + firstFloorKeyframeTime, 0); Keyframe floorKeyframe = new Keyframe(floorCount, floorCount * -2.0f - 0.3f); curve.AddKey(floorKeyframe); curve.RemoveKey(curve.keys.Length - 1); Keyframe endKeyframe = new Keyframe(floorCount * 2, 0); curve.AddKey(endKeyframe); _elevateClip.SetCurve("", typeof(Transform), "localPosition.y", curve); AnimationEvent work = new AnimationEvent(); work.functionName = "Work"; work.time = floorKeyframe.time; work.intParameter = floorCount; _elevateClip.AddEvent(work); _workEvents.Add(work); RemoveEventFromAnimation("StoreCoins"); _storeCoins.time = floorCount * 2; _elevateClip.AddEvent(_storeCoins); }
private static void CharacterModel_UpdateOverlays(On.RoR2.CharacterModel.orig_UpdateOverlays orig, CharacterModel self) { orig(self); if (self) { if (self.body && self.body.HasBuff(Charm)) { var isCharmed = self.body.GetComponent <IsCharmed>(); if (isCharmed && !isCharmed.Overlay) { TemporaryOverlay overlay = self.gameObject.AddComponent <TemporaryOverlay>(); overlay.duration = float.PositiveInfinity; overlay.alphaCurve = AnimationCurve.Constant(0f, 0f, 0.54f); overlay.animateShaderAlpha = true; overlay.destroyComponentOnEnd = true; overlay.originalMaterial = assetBundle.LoadAsset <Material>("Assets/Textures/Materials/Overlays/Charmed.mat"); overlay.AddToCharacerModel(self); isCharmed.Overlay = overlay; } else { return; } } } }
static void RemapTransparencyCurves(MaterialDescription description, AnimationClip[] clips) { // For some reason, Opacity is never animated, we have to use TransparencyFactor and TransparentColor for (int i = 0; i < clips.Length; i++) { bool foundTransparencyCurve = false; AnimationCurve curve; if (description.TryGetAnimationCurve(clips[i].name, "TransparencyFactor", out curve)) { ConvertKeys(curve, ConvertFloatOneMinus); clips[i].SetCurve("", typeof(Material), "_BaseColor.a", curve); foundTransparencyCurve = true; } else if (description.TryGetAnimationCurve(clips[i].name, "TransparentColor.x", out curve)) { ConvertKeys(curve, ConvertFloatOneMinus); clips[i].SetCurve("", typeof(Material), "_BaseColor.a", curve); foundTransparencyCurve = true; } if (foundTransparencyCurve && !description.HasAnimationCurveInClip(clips[i].name, "DiffuseColor")) { Vector4 diffuseColor; description.TryGetProperty("DiffuseColor", out diffuseColor); clips[i].SetCurve("", typeof(Material), "_BaseColor.r", AnimationCurve.Constant(0.0f, 1.0f, diffuseColor.x)); clips[i].SetCurve("", typeof(Material), "_BaseColor.g", AnimationCurve.Constant(0.0f, 1.0f, diffuseColor.y)); clips[i].SetCurve("", typeof(Material), "_BaseColor.b", AnimationCurve.Constant(0.0f, 1.0f, diffuseColor.z)); } } }
public AnimationClip GetAnimationClipFromKeyFrames(List <DataStructs.Keyframe> keyframes) { var animClip = new AnimationClip(); var previousCurve = AnimationCurve.Constant(0, 0, 0); animClip.SetCurve("", typeof(Transform), "localPosition.x", previousCurve); //todo : CalculateFrameTime, SetAll3Curves. for (int i = 1; i < keyframes.Count; i++) { var curvX = AnimationCurve.Linear(previousCurve.keys[0].time, keyframes[i - 1].position.x, i, keyframes[i].position.x); animClip.SetCurve("", typeof(Transform), "localPosition.x", curvX); previousCurve = curvX; } return(animClip); }
public void order(Animation a, float x, float z, float alpha) { AnimationClip ac = new AnimationClip(); ac.legacy = true; //Gira AnimationCurve rot = AnimationCurve.EaseInOut(alpha + 30f, gameObject.transform.eulerAngles.y, alpha + 30.5f, goTo(x, z)); //Eventos de animación de caminar AnimationEvent cWalk = new AnimationEvent(); cWalk.time = alpha + 30.5f; cWalk.functionName = "walkCycle"; ac.AddEvent(cWalk); cWalk = new AnimationEvent(); cWalk.time = alpha + 36f; cWalk.functionName = "walkCycle"; ac.AddEvent(cWalk); //camina AnimationCurve xgap = AnimationCurve.EaseInOut(alpha + 30.5f, gameObject.transform.position.x, alpha + 36f, x); AnimationCurve zgap = AnimationCurve.EaseInOut(alpha + 30.5f, gameObject.transform.position.z, alpha + 36f, z); ac.SetCurve("", typeof(Transform), "localPosition.x", xgap); ac.SetCurve("", typeof(Transform), "localPosition.y", AnimationCurve.Constant(30, 50, gameObject.transform.localPosition.y)); ac.SetCurve("", typeof(Transform), "localPosition.z", zgap); ac.SetCurve("", typeof(Transform), "localEulerAngles.y", rot); a.AddClip(ac, "order"); a.Play("order"); }
void TemplateFadeOut() { // Set Gradient to Fade In White Gradient g = new Gradient(); GradientColorKey[] gck = new GradientColorKey[2]; gck[0].color = Color.white; gck[0].time = 0f; gck[1].color = Color.white; gck[1].time = 1f; GradientAlphaKey[] gak = new GradientAlphaKey[2]; gak[0].alpha = 1f; gak[0].time = 0f; gak[1].alpha = 0f; gak[1].time = 1f; g.SetKeys(gck, gak); colorOverLifeTime = g; sizeOverLifeTime = AnimationCurve.Constant(0f, 1f, 1f); mixMode = MixMode.Multiply; activationMode = ActivationMode.Manual; enableRaycastTarget = false; onFinishedEvent = new UnityEvent(); UnityEditor.Events.UnityEventTools.AddPersistentListener(onFinishedEvent, () => { gameObject.SetActive(false); }); }
void Update() { if (update) { var lr = GetComponent <LineRenderer>(); if (!lr) { return; } update = false; Vector3[] positions = new Vector3[segments]; lr.positionCount = segments; lr.widthCurve = AnimationCurve.Constant(0, 1, fill ? radius : thickness); for (int i = 0; i < segments; i++) { var angle = i * (360f / (float)segments); positions[i] = new Vector3(Mathf.Sin(angle * Mathf.Deg2Rad), Mathf.Cos(angle * Mathf.Deg2Rad)); positions[i] *= radius - (fill ? radius : thickness) / 2f; } lr.SetPositions(positions); } }
public void UpdateFromConverter(CameraStatusConverter converter) { hasTarget = converter.willHaveTarget; hasOrientation = converter.willHaveOrientation; currentTarget = converter.nextTarget; currentOrientation = converter.nextOrientation; focusDelta = converter.intendedFocusDelta; toTargetMaxDelta = converter.toTargetMaxSpeed * Time.deltaTime; cameraMaxDelta = converter.cameraMaxSpeed * Time.deltaTime; switch (converter.sizeStyle) { case CurveStyle.Instantly: size = converter.intendedSize; sizeCurve = AnimationCurve.Constant(0f, 1f, size); break; case CurveStyle.Linear: ResetTimer(); sizeCurve = AnimationCurve.Linear(0f, size, converter.time, converter.intendedSize); break; case CurveStyle.EaseInOut: ResetTimer(); sizeCurve = AnimationCurve.EaseInOut(0f, size, converter.time, converter.intendedSize); break; } }
void SetIK(GameObject target) { var vrik = target.AddComponent <VRIK>(); // 同期オブジェクト群 var syncObjects = _synchronizer.TargetTransforms; if (_config.IsVrMode) { //VRモードのとき vrik.solver.spine.headTarget = VrHeadTarget; vrik.solver.rightArm.target = VrRightHandTarget; vrik.solver.leftArm.target = VrLeftHandTarget; } else { //ARモードのとき vrik.solver.spine.headTarget = syncObjects[HumanBodyBones.Head]; vrik.solver.rightArm.target = syncObjects[HumanBodyBones.RightHand]; vrik.solver.leftArm.target = syncObjects[HumanBodyBones.LeftHand]; } vrik.solver.rightArm.stretchCurve = AnimationCurve.Constant(0, 10, 0); vrik.solver.leftArm.stretchCurve = AnimationCurve.Constant(0, 10, 0); vrik.solver.rightLeg.target = syncObjects[HumanBodyBones.RightFoot]; vrik.solver.leftLeg.target = syncObjects[HumanBodyBones.LeftFoot]; vrik.solver.locomotion.footDistance = 0.2f; vrik.solver.rightLeg.swivelOffset = -25; vrik.solver.leftLeg.swivelOffset = 25; }
private static AnimationClip BlendShapeClip(EditorCurveBinding binding) { var clip = new AnimationClip(); AnimationUtility.SetEditorCurve(clip, binding, AnimationCurve.Constant(0f, 1 / 60f, 100f)); return(clip); }
public static GameObject CreateDefaultTextObject() { var textPrefab = PrefabAPI.InstantiateClone(Resources.Load <GameObject>("prefabs/effects/DamageRejected"), "DeathMessageAboveCorpse_DefaultTextObjectChild"); textPrefab.name = "DeathMessageAboveCorpse_DefaultTextObject"; UnityEngine.Object.Destroy(textPrefab.GetComponent <EffectComponent>()); textPrefab.GetComponent <ObjectScaleCurve>().overallCurve = AnimationCurve.Constant(0f, 1f, 1f); UnityEngine.Object.Destroy(textPrefab.GetComponent <VelocityRandomOnStart>()); UnityEngine.Object.Destroy(textPrefab.GetComponent <ConstantForce>()); UnityEngine.Object.Destroy(textPrefab.GetComponent <Rigidbody>()); UnityEngine.Object.Destroy(textPrefab.transform.Find("TextMeshPro").gameObject.GetComponent <ScaleSpriteByCamDistance>()); textPrefab.AddComponent <NetworkIdentity>(); DeathMessageLocator deathMessageLocator = textPrefab.AddComponent <DeathMessageLocator>(); deathMessageLocator.textMeshPro = textPrefab.transform.Find("TextMeshPro").gameObject.GetComponent <TextMeshPro>(); deathMessageLocator.textMeshPro.fontSize = fontSize; deathMessageLocator.languageTextMeshController = textPrefab.transform.Find("TextMeshPro").gameObject.GetComponent <LanguageTextMeshController>(); deathMessageLocator.destroyOnTimer = textPrefab.GetComponent <DestroyOnTimer>(); textPrefab.GetComponent <DestroyOnTimer>().duration = cfgDuration.Value > 0 ? cfgDuration.Value : 360000; PrefabAPI.RegisterNetworkPrefab(textPrefab); defaultTextObject = textPrefab; return(textPrefab); }
public void DrawTrajectory(LineRenderer lineRenderer, List <TrajectoryPoint> points, float angleSpread) { lineRenderer.positionCount = points.Count; lineRenderer.widthMultiplier = 0.5f; for (int i = 0; i < points.Count; i++) { TrajectoryPoint point = points[i]; lineRenderer.SetPosition(i, point.Point); } if (angleSpread > 0 && points.Count > 0) { Vector2 supVector = Quaternion.Euler(0, 0, angleSpread) * (Vector2.up * Vector2.Distance(points[0].Point, points[1].Point)); lineRenderer.widthMultiplier = 1f; lineRenderer.widthCurve = AnimationCurve.Linear(0f, lineRenderer.widthMultiplier * 0f, 1f, lineRenderer.widthMultiplier * Mathf.Abs(supVector.x) / CustomPhysic.getInstance().Timestep); } else { lineRenderer.widthCurve = AnimationCurve.Constant(0f, 1f, lineRenderer.widthMultiplier * .5f); } }
public void crumble(Animation a) { AnimationClip ac = new AnimationClip(); ac.legacy = true; //se derrumba la torre AnimationCurve und = AnimationCurve.EaseInOut(10f, 2f, 15f, -2f); //el siguiente algoritmo me lo inventé a último minuto para hacer que la torre caiga más chevere //lmao, no sirvió /*int max = 10; * Keyframe[] ax = new Keyframe[max]; * Keyframe[] az = new Keyframe[max]; * float frac = 10f; * for (int kneel = 0; kneel < max; kneel++) * { * float x = Random.Range(-0.05f, 0.05f); * float z = Random.Range(-0.05f, 0.05f); * ax[kneel] = new Keyframe(frac, gameObject.transform.position.x + x); * az[kneel] = new Keyframe(frac, gameObject.transform.position.z + z); * frac += 5 / max; * }*/ ac.SetCurve("", typeof(Transform), "localPosition.x", AnimationCurve.Constant(10, 15, gameObject.transform.localPosition.x)); //ac.SetCurve("",typeof(Transform),"localPosition.x",new AnimationCurve(ax)); ac.SetCurve("", typeof(Transform), "localPosition.y", und); ac.SetCurve("", typeof(Transform), "localPosition.z", AnimationCurve.Constant(10, 15, gameObject.transform.localPosition.z)); //ac.SetCurve("",typeof(Transform),"localPosition.z",new AnimationCurve(az)); a.AddClip(ac, "crumble"); a.Play("crumble"); }
public void ResetBrushSettings() { _brushAnimationCurve = new AnimationCurve(); _brushAnimationCurve.AddKey(0f, 0); _brushAnimationCurve.AddKey(0.5f, 0.5f); _brushAnimationCurve.AddKey(1f, 0); _brushBezierVertexCount = 8; _brushEmissionReactOnAudio = false; _brushEmissionBandBuffer = 0; _brushEmissionEnabled = false; _brushEmissionThreshold = 0.1f; _brushEmissionFrequencyType = AudioFrequencyType.Band; _brushScaleReactOnAudio = false; _brushScaleBandBuffer = 0; _brushScaleMultiplier = 1; _brushScaleThreshold = 0.1f; _brushScaleFrequencyType = AudioFrequencyType.Band; _brushKochEnabled = false; _brushTrailSpeedMinMax = Vector2.one; _brushTrailTimeMinMax = Vector2.one; _brushTrailWidthMinMax = new Vector2(0.1f, 0.1f); _brushTrailEnabled = false; _brushUseBezierCurves = false; _brushStartGeneration = new List <StartGen> { new StartGen() { Guid = Guid.NewGuid().ToString("N"), Scale = 1, Outwards = false } }; _brushDegree = 0; _brushScale = 0; _brushNumberStart = 0; _brushStepSize = 0; _brushMaxIterations = 0; _brushUseLerping = false; _brushLerpFrequencyType = AudioFrequencyType.Band; _brushLerpAudioBand = 0; _brushSpeedMinMax = Vector2.one; _brushLerpInterpolationCurve = AnimationCurve.Constant(0, 1, 1); _brushRepeat = false; _brushInvert = false; _brushUseScaling = false; _brushScalePhylloFrequencyType = AudioFrequencyType.Band; _brushScaleAudioBand = 0; _brushScaleMinMax = Vector2.one; _brushUseScaleCurve = false; _brushScaleInterpolationCurve = AnimationCurve.Constant(0, 1, 1); _brushInterpolationSpeed = 0; }
public void Init(PlayerStatus status) { ResetTimer(); speed = status.speed; rotationSpeed = status.rotationSpeed; speedCurve = AnimationCurve.Constant(0f, 1f, speed); rotationalSpeedCurve = AnimationCurve.Constant(0f, 1f, rotationSpeed); }
public void ConstantCurve_Reduction_ProducesZeroError() { var curve = AnimationCurve.Constant(0, 1, 2); var reducedCurve = new AnimationCurve(curve.keys); float error = AnimationCurveReducer.ReduceWithMaximumAbsoluteError(reducedCurve, 2.0f); Assert.Zero(error); Assert.AreEqual(curve.length, reducedCurve.length); Assert.AreEqual(curve.keys[0], reducedCurve.keys[0]); Assert.AreEqual(curve.keys[1], reducedCurve.keys[1]); }
private void Awake() { points = 0; if (curve == null) { curve = AnimationCurve.Constant(0, 1, 1); } _updatedWatchers = RootProvider.root.GetComponentsInChildren <IOnScoreUpdatedWatcher>(true); }
private void UpdateRopeRenderer() { RopeRenderer.enabled = !ReferenceEquals(Attached, null); if (RopeRenderer.enabled) { Vector3 craneAnchoredPos = transform.position + (Vector3)RopeJoin.anchor; Vector3 boxAnchoredPos = Attached.transform.position + Attached.transform.rotation * (Vector3)RopeJoin.connectedAnchor; RopeRenderer.widthCurve = AnimationCurve.Constant(0, 1, 0.1f); RopeRenderer.SetPositions(new Vector3[] { craneAnchoredPos, boxAnchoredPos }); } }
private static AnimationClip NothingClip() { var nsk = new AnimationClip(); AnimationUtility.SetEditorCurve(nsk, new EditorCurveBinding { path = "_ignored", propertyName = "m_IsActive", type = typeof(GameObject) }, AnimationCurve.Constant(0f, 0f, 0f)); return(nsk); }
private void RegisterLocalRotation(ref AnimationClip clip, Transform transform, string path) { if (transform == null) { return; } Vector3 euler = transform.localEulerAngles; clip.SetCurve(path, typeof(Transform), "localEulerAngles.x", AnimationCurve.Constant(0f, 0.01f, euler.x)); clip.SetCurve(path, typeof(Transform), "localEulerAngles.y", AnimationCurve.Constant(0f, 0.01f, euler.y)); clip.SetCurve(path, typeof(Transform), "localEulerAngles.z", AnimationCurve.Constant(0f, 0.01f, euler.z)); }
public void Toggle(Transform[] items) { var itemsName = string.Join(" ", items.Select(item => item.name)); var layer = NewLayer( $"{MethodBase.GetCurrentMethod().Name} {itemsName}"); //var scene = new Grid(layer.stateMachine); var toggle = NewBoolParameter(layer.name); AnimationClip TogglingClip(bool active) { var clip = NewClip($"{layer.name}_{active}"); foreach (var item in items) { AnimationUtility.SetEditorCurve( clip, EditorCurveBinding.DiscreteCurve( Path(item), typeof(GameObject), "m_IsActive"), AnimationCurve.Constant(0, 1, active ? 1 : 0)); } return(clip); } // states ChildAnimatorState entry = New.State("Entry"); ChildAnimatorState shown = New.State("Shown", TogglingClip(true)); ChildAnimatorState hidden = New.State("Hidden", TogglingClip(false)); // position states entry.position = layer.stateMachine.GetEntryPosition() - Grid.down; shown.position = entry.position - Grid.down - 0.5f * Grid.left; hidden.position = entry.position - Grid.down - 0.5f * Grid.right; layer.stateMachine.SetExitPosition(entry.position - 2 * Grid.down); layer.stateMachine.states = Util.Array(entry, shown, hidden); var showWhen = Util.Array(New.BoolCondition(toggle, true)); var hideWhen = Util.Array(New.BoolCondition(toggle, false)); // transitions entry.state.transitions = Util.Array( New.Transition(shown.state, showWhen), New.Transition(hidden.state, hideWhen)); shown.state.transitions = Util.Array(New.Transition(conditions: hideWhen)); hidden.state.transitions = Util.Array(New.Transition(conditions: showWhen)); }
public void LoadBrushes() { // Load the textures; var arr = new List <Brush>(); var hashes = new List <Hash128>(); int idx = 1; Texture2D t = null; Brush brush = null; // Load builtin brushes from editor resources do { brush = (Brush)EditorGUIUtility.Load(EditorResources.brushesPath + "builtin_brush_" + idx + ".brush"); if (brush != null && brush.m_Mask != null) { brush.readOnly = true; arr.Add(brush); hashes.Add(brush.thumbnail.imageContentsHash); } idx++; }while (brush); // Load user created brushes from the Assets/Gizmos folder idx = 0; do { t = EditorGUIUtility.FindTexture("brush_" + idx + ".png"); if (t) { Brush b = Brush.CreateInstance(t, AnimationCurve.Constant(0, 1, 1), Brush.kMaxRadiusScale, true); arr.Add(b); hashes.Add(b.thumbnail.imageContentsHash); } idx++; }while (t); // Load .brush files foreach (string assetPath in AssetDatabase.FindAssets($"t:{typeof(Brush).Name}")) { var b = AssetDatabase.LoadAssetAtPath(AssetDatabase.GUIDToAssetPath(assetPath), typeof(Brush)) as Brush; if (b != null && b.texture != null) { arr.Add(b); hashes.Add(b.thumbnail.imageContentsHash); } } m_BrushList = arr.ToArray(); m_BrushHashes = hashes.ToArray(); }
public void Init(CameraStatus status) { ResetTimer(); focusDelta = status.focusDelta; size = status.size; hasTarget = status.hasTarget; hasOrientation = status.hasOrientation; currentTarget = status.currentTarget; currentOrientation = status.currentOrientation; toTargetMaxDelta = 0.1f; cameraMaxDelta = 999f; sizeCurve = AnimationCurve.Constant(0f, 1f, size); }
private void Awake() { _speed = startSpeed; _groundedWatchers = RootProvider.root.GetComponentsInChildren <IOnBlockGroundedWatcher>(); _nearGroundWatchers = RootProvider.root.GetComponentsInChildren <IOnBlockNearGroundWatcher>(); _quickLandWatchers = RootProvider.root.GetComponentsInChildren <IOnQuickLandStartedWatcher>(); if (speedCurve == null) { speedCurve = AnimationCurve.Constant(0, 1, 1); } }
private void RegisterLocalPose(ref AnimationClip clip, Pose pose, string path) { Vector3 euler = pose.rotation.eulerAngles; clip.SetCurve(path, typeof(Transform), "localEulerAngles.x", AnimationCurve.Constant(0f, 0.01f, euler.x)); clip.SetCurve(path, typeof(Transform), "localEulerAngles.y", AnimationCurve.Constant(0f, 0.01f, euler.y)); clip.SetCurve(path, typeof(Transform), "localEulerAngles.z", AnimationCurve.Constant(0f, 0.01f, euler.z)); Vector3 pos = pose.position; clip.SetCurve(path, typeof(Transform), "localPosition.x", AnimationCurve.Constant(0f, 0.01f, pos.x)); clip.SetCurve(path, typeof(Transform), "localPosition.y", AnimationCurve.Constant(0f, 0.01f, pos.y)); clip.SetCurve(path, typeof(Transform), "localPosition.z", AnimationCurve.Constant(0f, 0.01f, pos.z)); }
private void Reset() { //Ao ser resetado, o transform de movimento torna-se o transform ao qual o component está anexado movementTransform = transform; hitbox = GetComponentInChildren <Collider2D>(); accelerationCurve = AnimationCurve.Constant(0, 1, 1); inset = 0.1F; MaxSpeed = 10; Motor = null; horizontalRaycasts = 3; verticalRaycasts = 3; MotorConfig = GetComponentInChildren <MotorConfig>(); InputProvider = GetComponentInChildren <InputProvider>(); }