コード例 #1
0
        public float GetEfficiency(string techStackName, double ut,
                                   bool useTime = true, bool useHealth = true, bool usePressure = true, bool useTechStack = true)
        {
            float experience = 1;

            if (isWorking && (!useTechStack || abilities.TryGetValue(techStackName, out experience)))
            {
                if (!useTechStack)
                {
                    experience = 1;
                }
                var efficiency = baseEfficiency * EfficiencyExperienceMultiplier(this.experience) * EfficiencyAbilityMultiplier(experience);

                var timeMultiplier = useTime
                    ? efficiencyTimeCurve?.Evaluate((float)(ut - lastWorkTime) / 300) ?? 1f
                    : 1f;

                var healthMultiplier = useHealth
                    ? efficiencyHealthCurve?.Evaluate(health) ?? 1f
                    : 1f;

                var pressureMultiplier = usePressure
                    ? efficiencyPressureCurve?.Evaluate(pressure) ?? 1f
                    : 1f;

                return(efficiency * timeMultiplier * healthMultiplier * pressureMultiplier);
                // return efficiency;
            }
            else
            {
                return(0);
            }
        }
コード例 #2
0
        public static async UniTask Animate(float durationSecs, AnimationCurve curve, Action <float> onTick)
        {
            float startTime = Time.time;
            float time      = 0;

            while (time < 1f)
            {
                time = (Time.time - startTime) / durationSecs;
                float t = Mathf.Clamp01(time);
                t = curve?.Evaluate(t) ?? t;
                onTick(t);

                await UniTask.Yield();
            }
        }
コード例 #3
0
    /// <summary>
    /// Evaluates the noise at a given input value based on the properties.
    /// </summary>
    public float Evaluate(Vector2 domain)
    {
        var scaled  = frequency * domain + new Vector2(offset, offset);
        var perlin  = Mathf.PerlinNoise(scaled.x, scaled.y);
        var banded  = horizontalBands?.Evaluate(domain.y) ?? 1;
        var percent = Mathf.InverseLerp(0, 1, banded * perlin);
        var value   = Mathf.Lerp(minimum, maximum, percent);

        if (continuous)
        {
            return(value);
        }
        else
        {
            return(value >= 0.5f ? 1 : 0);
        }
    }
コード例 #4
0
    // Update is called once per frame
    void Update()
    {
        if (isTriggered)
        {
            textKeyTimer += Time.unscaledDeltaTime;
            if (textKeyTimer > textKeyThreshold && !isReachedEndOfMessage)
            {
                textKeyTimer -= textKeyThreshold;
                charCount++;

                if (!isReachedEndOfMessage && charCount >= charThreshold)
                {
                    isReachedEndOfMessage = true;
                }
                else
                {
                    displayString += contentString[charCount];
                }
            }

            if (isReachedEndOfMessage)
            {
                fadeOutTimer += Time.unscaledDeltaTime;

                this.transform.localScale = new Vector3(startScale.x * xScaleCurve.Evaluate(fadeOutTimer / fadeOutThreshold), startScale.y * yScaleCurve.Evaluate(fadeOutTimer / fadeOutThreshold), startScale.z);
                if (fadeOutTimer > fadeOutThreshold)
                {
                    isReachedEndOfMessage     = false;
                    isTriggered               = false;
                    this.transform.localScale = new Vector3(0f, 0f, 0f);
                    textBack.fadeOutBlack();
                }
            }
        }

        if (txtMesh.text.GetHashCode() != displayString.GetHashCode())
        {
            txtMesh.text = displayString;
        }
    }
コード例 #5
0
ファイル: ImprovedTrail.cs プロジェクト: suspendmode/seaunity
    /// <summary>
    /// Update the mesh, creating triangles based on our points and the camera's orientation.
    /// </summary>

    void UpdateMesh()
    {
        // It takes 2 vertices per point in order to draw it
        int pointCount  = mPoints.Count;
        int vertexCount = pointCount << 2;

#if TRIANGLE_STRIP
        int indexCount = vertexCount;
#else
        int indexCount = (pointCount - 1) * 6;
#endif

        Vector3[] vertices = new Vector3[vertexCount];
        Vector2[] uvs      = new Vector2[vertexCount];
        Color[]   cols     = new Color[vertexCount];
        int[]     indices  = new int[indexCount];

        for (int i = 0; i < pointCount; ++i)
        {
            Point p = mPoints[i];

            // Calculate the combined cross product
            Vector3 cross = (i + 1 < pointCount) ? (p.cross + mPoints[i + 1].cross) * 0.5f : p.cross;

            float time = 1.0f - p.life;
            cross *= 0.5f * sizeCurve.Evaluate(time);

            int i0 = i << 1;
            int i1 = i0 + 1;

            vertices[i0] = p.pos + cross;
            vertices[i1] = p.pos - cross;

            float y = 1.0f - p.life;
            uvs[i0] = new Vector2(0f, y);
            uvs[i1] = new Vector2(1f, y);

            Color c = p.col;
            c.a     *= p.alpha * alphaCurve.Evaluate(time);
            cols[i0] = c;
            cols[i1] = c;

#if TRIANGLE_STRIP
            indices[i0] = i0;
            indices[i1] = i1;
#endif
        }

#if !TRIANGLE_STRIP
        // Calculate the indices
        for (int i = 0, index = 0; index < indexCount; i += 2)
        {
            indices[index++] = i;
            indices[index++] = i + 2;
            indices[index++] = i + 1;

            indices[index++] = i + 1;
            indices[index++] = i + 2;
            indices[index++] = i + 3;
        }
#endif
        // Update the mesh
        mMesh.Clear();
        mMesh.vertices = vertices;
        mMesh.uv       = uvs;
        mMesh.colors   = cols;

        // NOTE: Triangle strip approach seems to connect the last triangle with the first. Unity bug?
#if TRIANGLE_STRIP
        mMesh.SetTriangleStrip(indices, 0);
#else
        mMesh.triangles = indices;
#endif
        mMesh.RecalculateBounds();

        // Cleanup so Unity crashes less
        vertices = null;
        uvs      = null;
        cols     = null;
        indices  = null;
    }
コード例 #6
0
    public IEnumerator PlayerMovement(int amount, bool forward, bool activateTile)
    {
        Transform t = curPlayer.obj.transform;
        Vector3   startPos,
                  startPoint,
                  nextPoint,
                  nextPos,
                  diff;
        Quaternion targetRotation;
        float      time   = 0;
        int        passes = 0;

        while (passes < amount)
        {
            startPos   = t.position;
            startPoint = levelTiles[curPlayer.curPage][curPlayer.curPageTile].transform.position;
            // Check transition between pages
            #region Page Transition
            if (forward && curPlayer.curPageTile + 1 >= levelTiles[curPlayer.curPage].Length)
            {
                yield return(matchCamera.ToLevelView(CAMERA_FOCUS_SPEED));

                HideAllPlayers();
                yield return(book.OpenNextPage());

                curPage++;
                players[curIndex].curPage++;
                players[curIndex].curPageTile = 0;
                DisplayPagePlayers(curPage);
                t.position = levelTiles[curPlayer.curPage][curPlayer.curPageTile].transform.position - (startPoint - startPos);
                yield return(matchCamera.RedirectTo(curPlayer.obj.transform, CAMERA_FOCUS_SPEED));

                if (players.Length > 1 && curPage > minigameIndex && !playedMinigames[minigameIndex])
                {
                    pendingMinigame = true;
                }
            }
            else if (!forward && curPlayer.curPageTile == 0)
            {
                yield return(matchCamera.ToLevelView(CAMERA_FOCUS_SPEED));

                HideAllPlayers();
                yield return(book.OpenPreviousPage());

                curPage--;
                players[curIndex].curPage--;
                players[curIndex].curPageTile = levelTiles[curPlayer.curPage].Length - 1;
                DisplayPagePlayers(curPage);
                t.position = levelTiles[curPlayer.curPage][curPlayer.curPageTile].transform.position - (startPoint - startPos);
                yield return(matchCamera.RedirectTo(curPlayer.obj.transform, CAMERA_FOCUS_SPEED));
            }
            #endregion
            else
            {
                curPlayer.obj.SetBool("walk", true);
                nextPoint      = levelTiles[curPlayer.curPage][curPlayer.curPageTile + (forward ? 1 : -1)].transform.position;
                nextPos        = nextPoint - (startPoint - startPos);
                diff           = nextPos - startPos;
                targetRotation = Quaternion.LookRotation(diff);
                time           = 0;
                while (time < MOVEMENT_TIME)
                {
                    time      += Time.deltaTime;
                    t.rotation = Quaternion.Slerp(t.rotation, targetRotation, Time.deltaTime * 5);
                    t.position = startPos + diff * movementCurve.Evaluate(time / MOVEMENT_TIME);
                    yield return(null);
                }
                t.position = nextPos;
                players[curIndex].curPageTile += forward ? 1 : -1;
                curPlayer.obj.SetBool("walk", false);
            }
            passes++;
        }
        // Executes current tile action
        if (activateTile)
        {
            levelTiles[curPlayer.curPage][curPlayer.curPageTile].Action();
        }
    }
コード例 #7
0
ファイル: FuzzyMoviment.cs プロジェクト: Jvbs19/FuzzyLogic
 public void FuzzifyVelocidade(float inputValue)
 {
     Dicionario_Velocidade["Baixa"] = Velocidade_Baixa.Evaluate(inputValue);
     Dicionario_Velocidade["Media"] = Velocidade_Media.Evaluate(inputValue);
     Dicionario_Velocidade["Alta"]  = Velocidade_Alta.Evaluate(inputValue);
 }
コード例 #8
0
    /// <summary>
    ///  Method to curve text along a Unity animation curve.
    /// </summary>
    /// <param name="textComponent"></param>
    /// <returns></returns>
    IEnumerator WarpText()
    {
        VertexCurve.preWrapMode  = WrapMode.Clamp;
        VertexCurve.postWrapMode = WrapMode.Clamp;

        //Mesh mesh = m_TextComponent.textInfo.meshInfo[0].mesh;

        Vector3[] vertices;
        Matrix4x4 matrix;

        m_TextComponent.havePropertiesChanged = true; // Need to force the TextMeshPro Object to be updated.
        CurveScale *= 10;
        float          old_CurveScale = CurveScale;
        AnimationCurve old_curve      = CopyAnimationCurve(VertexCurve);

        while (true)
        {
            if (!m_TextComponent.havePropertiesChanged && old_CurveScale == CurveScale && old_curve.keys[1].value == VertexCurve.keys[1].value)
            {
                yield return(null);

                continue;
            }

            old_CurveScale = CurveScale;
            old_curve      = CopyAnimationCurve(VertexCurve);

            m_TextComponent.ForceMeshUpdate(); // Generate the mesh and populate the textInfo with data we can use and manipulate.

            TMP_TextInfo textInfo       = m_TextComponent.textInfo;
            int          characterCount = textInfo.characterCount;


            if (characterCount == 0)
            {
                continue;
            }

            //vertices = textInfo.meshInfo[0].vertices;
            //int lastVertexIndex = textInfo.characterInfo[characterCount - 1].vertexIndex;

            float boundsMinX = m_TextComponent.textInfo.meshInfo[0].mesh.bounds.min.x;
            float boundsMaxX = m_TextComponent.textInfo.meshInfo[0].mesh.bounds.max.x;



            for (int i = 0; i < characterCount; i++)
            {
                if (!textInfo.characterInfo[i].isVisible)
                {
                    continue;
                }

                int vertexIndex = textInfo.characterInfo[i].vertexIndex;

                // Get the index of the mesh used by this character.
                int materialIndex = textInfo.characterInfo[i].materialReferenceIndex;

                vertices = textInfo.meshInfo[materialIndex].vertices;

                // Compute the baseline mid point for each character
                Vector3 offsetToMidBaseline = new Vector2((vertices[vertexIndex + 0].x + vertices[vertexIndex + 2].x) / 2, textInfo.characterInfo[i].baseLine);
                //float offsetY = VertexCurve.Evaluate((float)i / characterCount + loopCount / 50f); // Random.Range(-0.25f, 0.25f);

                // Apply offset to adjust our pivot point.
                vertices[vertexIndex + 0] += -offsetToMidBaseline;
                vertices[vertexIndex + 1] += -offsetToMidBaseline;
                vertices[vertexIndex + 2] += -offsetToMidBaseline;
                vertices[vertexIndex + 3] += -offsetToMidBaseline;

                // Compute the angle of rotation for each character based on the animation curve
                float x0 = (offsetToMidBaseline.x - boundsMinX) / (boundsMaxX - boundsMinX); // Character's position relative to the bounds of the mesh.
                float x1 = x0 + 0.0001f;
                float y0 = VertexCurve.Evaluate(x0) * CurveScale;
                float y1 = VertexCurve.Evaluate(x1) * CurveScale;

                Vector3 horizontal = new Vector3(1, 0, 0);
                //Vector3 normal = new Vector3(-(y1 - y0), (x1 * (boundsMaxX - boundsMinX) + boundsMinX) - offsetToMidBaseline.x, 0);
                Vector3 tangent = new Vector3(x1 * (boundsMaxX - boundsMinX) + boundsMinX, y1) - new Vector3(offsetToMidBaseline.x, y0);

                float   dot   = Mathf.Acos(Vector3.Dot(horizontal, tangent.normalized)) * 57.2957795f;
                Vector3 cross = Vector3.Cross(horizontal, tangent);
                float   angle = cross.z > 0 ? dot : 360 - dot;

                matrix = Matrix4x4.TRS(new Vector3(0, y0, 0), Quaternion.Euler(0, 0, angle), Vector3.one);

                vertices[vertexIndex + 0] = matrix.MultiplyPoint3x4(vertices[vertexIndex + 0]);
                vertices[vertexIndex + 1] = matrix.MultiplyPoint3x4(vertices[vertexIndex + 1]);
                vertices[vertexIndex + 2] = matrix.MultiplyPoint3x4(vertices[vertexIndex + 2]);
                vertices[vertexIndex + 3] = matrix.MultiplyPoint3x4(vertices[vertexIndex + 3]);

                vertices[vertexIndex + 0] += offsetToMidBaseline;
                vertices[vertexIndex + 1] += offsetToMidBaseline;
                vertices[vertexIndex + 2] += offsetToMidBaseline;
                vertices[vertexIndex + 3] += offsetToMidBaseline;
            }


            // Upload the mesh with the revised information
            m_TextComponent.UpdateVertexData();

            yield return(new WaitForSeconds(0.025f));
        }
    }
コード例 #9
0
 void Start()
 {
     height         = startHeight = idle.Evaluate(0);
     eyeStartHeight = eyes.position;
 }
コード例 #10
0
 // Update is called once per frame
 void Update()
 {
     //if isReadAfterDelay is true, then we start moving the object.
     if (isReadyAfterDelay == true)
     {
         //linearly interpolate the position from current "_transform.position" to our "objStartPosition" by our curve(using Curve.Evaluate(time)
         _transform.position = Vector3.Lerp(_transform.position, objStartPosition, aCurve.Evaluate(step));
         //increase our step by moveSpeed var times Time.deltaTime.
         step += moveSpeed * Time.deltaTime;
         //if we want this AnimationCurveMover component destroyed when the move is over set to true.
         if (destroyAfterMove)
         {
             //if it was set to true & next if the "step" is greater to / equal to 1, then move is done.
             if (step >= 1)
             {
                 //if we wanted to be notified via the console when it was done moving then "showDebugInfo" would have to be ticked in the inspector.
                 if (showDebugInfo)
                 {
                     //debugs commented out for release.
                     Debug.Log("Destroying/Removing Script Component");
                 }
                 //destroy after move was selected, and we are done, so destroy this component.
                 Destroy(this);
             }
         }
         //else if we are NOT destroying after move (we can reset it and it will loop through the above move again... never really use it in this way, but it is an
         //option..
         else
         {
             //if move is finished(i.e. step is greater/equal to 1)
             if (step >= 1)
             {
                 //set step back to zero
                 step = 0;
                 //transform.translate the object back to the "slideFromDistance"(position)
                 _transform.Translate(slideFromDistance);
                 //repeat
             }
         }
     }
 }
コード例 #11
0
    void CreateShape()
    {
        vertices = new Vector3[(xSize + 1) * (zSize + 1)];     //3 squares has 4 verts

        for (int i = 0, z = 0; z <= zSize; z++)                //Assign verts to position on grid
        {
            for (int x = 0; x <= xSize; x++)
            {
                float y = GetNoiseSample(x + xLocation, z + zLocation);

                // ymult = 3
                vertices [i] = new Vector3(x, ycurv.Evaluate(y) * ymult, z);                       //each vert gets it's location, xyz

                //vertices [i] = new Vector3 (x, y * ymult, z);

                //vertices [i] = new Vector3 (x, y, z);

                i++;
            }
        }

        triangles = new int[xSize * zSize * 6]; //each quad * amount of points in two tris

        int vert = 0;                           //linking verts with triangles
        int tris = 0;

        for (int z = 0; z < zSize; z++)
        {
            for (int x = 0; x < xSize; x++)
            {
                triangles[tris + 0] = vert + 0;
                triangles[tris + 1] = vert + xSize + 1;
                triangles[tris + 2] = vert + 1;
                triangles[tris + 3] = vert + 1;
                triangles[tris + 4] = vert + xSize + 1;
                triangles[tris + 5] = vert + xSize + 2;

                vert++;
                tris += 6;
            }
            vert++;              //stops the end of rows from linking
        }


        uvs = new Vector2[vertices.Length];
        for (int i = 0, z = 0; z <= zSize; z++)
        {
            for (int x = 0; x <= xSize; x++)
            {
                uvs[i] = new Vector2((float)x / xSize, (float)z / zSize);
                i++;
            }
        }

        colors = new Color[vertices.Length];
        for (int i = 0, z = 0; z <= zSize; z++)
        {
            for (int x = 0; x <= xSize; x++)
            {
                float height = Mathf.InverseLerp(minTerrainHeight, maxTerrianHeight * ymult, vertices[i].y);
                colors[i] = gradient.Evaluate(height);
                i++;
            }
        }
    }
コード例 #12
0
    public static MeshData GenerateTerrainMesh(float[,] noiseMap, float heightMultiplier, AnimationCurve heightCurve, int levelOfDetail)
    {
        int height = noiseMap.GetLength(0);
        int width  = noiseMap.GetLength(1);

        // For centering mesh
        float topLeftX = (width - 1) / -2.0f;
        float topLeftZ = (height - 1) / 2.0f;

        // If levelOfDeteail is 0 then change to 1 else multiplie by 2
        // This is because we dont get stuck in infinity loop
        int detailIncrement = (levelOfDetail == 0) ? 1 : levelOfDetail * 2;

        int      verticesPerLine = (width - 1) / detailIncrement + 1;
        MeshData meshData        = new MeshData(verticesPerLine, verticesPerLine);
        int      vertexIndex     = 0;

        for (int i = 0; i < height; i += detailIncrement)
        {
            for (int j = 0; j < width; j += detailIncrement)
            {
                // Height Curve gives us coresponding value based on passed value
                meshData.vertices[vertexIndex] = new Vector3(topLeftX + j, noiseMap[i, j] * heightCurve.Evaluate(noiseMap[i, j]) * heightMultiplier, topLeftZ - i);
                meshData.UVMaps[vertexIndex]   = new Vector2(j / (float)width, i / (float)height);

                if (j < width - 1 && i < height - 1)
                {
                    meshData.AddTringle(vertexIndex, vertexIndex + verticesPerLine + 1, vertexIndex + verticesPerLine);
                    meshData.AddTringle(vertexIndex + verticesPerLine + 1, vertexIndex, vertexIndex + 1);
                }

                vertexIndex++;
            }
        }

        return(meshData);
    }
コード例 #13
0
    /// <summary>
    /// handles adjusting deltaMovement if we are going up a slope.
    /// </summary>
    /// <returns><c>true</c>, if horizontal slope was handled, <c>false</c> otherwise.</returns>
    /// <param name="deltaMovement">Delta movement.</param>
    /// <param name="angle">Angle.</param>
    bool handleHorizontalSlope(ref Vector3 deltaMovement, float angle)
    {
        // disregard 90 degree angles (walls)
        if (Mathf.RoundToInt(angle) == 90)
        {
            return(false);
        }

        // if we can walk on slopes and our angle is small enough we need to move up
        if (angle < slopeLimit)
        {
            // we only need to adjust the deltaMovement if we are not jumping
            // TODO: this uses a magic number which isn't ideal! The alternative is to have the user pass in if there is a jump this frame
            if (deltaMovement.y < jumpingThreshold)
            {
                // apply the slopeModifier to slow our movement up the slope
                var slopeModifier = slopeSpeedMultiplier.Evaluate(angle);
                deltaMovement.x *= slopeModifier;

                // we dont set collisions on the sides for this since a slope is not technically a side collision.
                // smooth y movement when we climb. we make the y movement equivalent to the actual y location that corresponds
                // to our new x location using our good friend Pythagoras
                deltaMovement.y = Mathf.Abs(Mathf.Tan(angle * Mathf.Deg2Rad) * deltaMovement.x);
                var isGoingRight = deltaMovement.x > 0;

                // safety check. we fire a ray in the direction of movement just in case the diagonal we calculated above ends up
                // going through a wall. if the ray hits, we back off the horizontal movement to stay in bounds.
                var          ray = isGoingRight ? _raycastOrigins.bottomRight : _raycastOrigins.bottomLeft;
                RaycastHit2D raycastHit;
                if (collisionState.wasGroundedLastFrame)
                {
                    raycastHit = Physics2D.Raycast(ray, deltaMovement.normalized, deltaMovement.magnitude, platformMask);
                }
                else
                {
                    raycastHit = Physics2D.Raycast(ray, deltaMovement.normalized, deltaMovement.magnitude, platformMask & ~oneWayPlatformMask);
                }

                if (raycastHit)
                {
                    // we crossed an edge when using Pythagoras calculation, so we set the actual delta movement to the ray hit location
                    deltaMovement = (Vector3)raycastHit.point - ray;
                    if (isGoingRight)
                    {
                        deltaMovement.x -= _skinWidth;
                    }
                    else
                    {
                        deltaMovement.x += _skinWidth;
                    }
                }

                _isGoingUpSlope      = true;
                collisionState.below = true;
            }
        }
        else         // too steep. get out of here
        {
            deltaMovement.x = 0;
        }

        return(true);
    }
コード例 #14
0
    private IEnumerator CancelSwitchCoroutine()
    {
        audioEffects.PlayEffect("Thud");

        StopCoroutine(laneSwitchCoroutine);

        isSwitchingLane    = false;
        isCancellingSwitch = true;
        canCancelSwitch    = false;

        // Disable collisions with the lane they were trying to switch to.
        collideableLanes.Clear();
        collideableLanes.Add(currentLane);

        Vector3    cancelPosition = playerObject.transform.localPosition;
        Quaternion cancelRotation = playerObject.transform.localRotation;

        float f = 0;

        while (f < 1)
        {
            f += Time.deltaTime / cancelSwitchDuration;
            f  = Mathf.Clamp01(f);

            playerObject.transform.localPosition = Vector3.Lerp(cancelPosition, playerPositionOffset, cancelSwitchPositionCurve.Evaluate(f));
            playerObject.transform.localRotation = Quaternion.SlerpUnclamped(Quaternion.identity, cancelRotation, cancelSwitchRotationCurve.Evaluate(f));

            yield return(null);
        }

        isCancellingSwitch = false;
    }
コード例 #15
0
    private IEnumerator SwitchLaneCoroutine(int direction)
    {
        int currentLaneIndex = laneManager.GetLaneIndex(currentLane);
        int newLaneIndex     = currentLaneIndex + direction;

        if (!laneManager.LaneExists(newLaneIndex))
        {
            yield break;
        }

        isSwitchingLane = true;
        canCancelSwitch = true;

        Lane oldLane = currentLane;
        Lane newLane = laneManager.GetLane(newLaneIndex);

        collideableLanes.Add(newLane);

        float f = 0;

        while (f < 1)
        {
            f += Time.deltaTime / laneSwitchDuration;
            f  = Mathf.Clamp01(f);

            playerObject.transform.position = Vector3.Lerp(oldLane.transform.position, newLane.transform.position, laneSwitchPositionCurve.Evaluate(f)) + playerPositionOffset;

            Quaternion directionToNewLane = Quaternion.LookRotation(newLane.transform.position - oldLane.transform.position);
            playerObject.transform.localRotation = Quaternion.Slerp(Quaternion.identity, directionToNewLane, laneSwitchRotationCurve.Evaluate(f));

            // There is a cutoff for when a switch can be cancelled. This is because it looks weird when a 99% complete switch is cancelled.
            if (f > cancelSwitchCutoff)
            {
                canCancelSwitch = false;
            }

            yield return(null);
        }

        collideableLanes.Remove(oldLane);

        currentLane = newLane;

        playerObject.transform.SetParent(currentLane.transform, true);
        playerObject.transform.localPosition = playerPositionOffset; // This line is necessary because worldPositionStays very occasionally doesn't work correctly, and the player jumps to a position that doesn't match their world position. I haven't yet figured out why this happens.

        isSwitchingLane = false;
    }
コード例 #16
0
    public static MeshData GenerateTerrainMesh(float[,] heightMap, float heightMultiplier, AnimationCurve _heightCurve, int levelOfDetail)
    {
        AnimationCurve heightCurve = new AnimationCurve(_heightCurve.keys);

        int meshSimplificationIncrement = (levelOfDetail == 0)?1:levelOfDetail * 2;

        int borderedSize         = heightMap.GetLength(0);
        int meshSize             = borderedSize - 2 * meshSimplificationIncrement;
        int meshSizeUnsimplified = borderedSize - 2;

        float topLeftX = (meshSizeUnsimplified - 1) / -2f;
        float topLeftZ = (meshSizeUnsimplified - 1) / 2f;


        int verticesPerLine = (meshSize - 1) / meshSimplificationIncrement + 1;

        MeshData meshData = new MeshData(verticesPerLine);

        int[,] vertexIndicesMap = new int[borderedSize, borderedSize];
        int meshVertexIndex   = 0;
        int borderVertexIndex = -1;

        for (int y = 0; y < borderedSize; y += meshSimplificationIncrement)
        {
            for (int x = 0; x < borderedSize; x += meshSimplificationIncrement)
            {
                bool isBorderVertex = y == 0 || y == borderedSize - 1 || x == 0 || x == borderedSize - 1;

                if (isBorderVertex)
                {
                    vertexIndicesMap [x, y] = borderVertexIndex;
                    borderVertexIndex--;
                }
                else
                {
                    vertexIndicesMap [x, y] = meshVertexIndex;
                    meshVertexIndex++;
                }
            }
        }

        for (int y = 0; y < borderedSize; y += meshSimplificationIncrement)
        {
            for (int x = 0; x < borderedSize; x += meshSimplificationIncrement)
            {
                int     vertexIndex    = vertexIndicesMap [x, y];
                Vector2 percent        = new Vector2((x - meshSimplificationIncrement) / (float)meshSize, (y - meshSimplificationIncrement) / (float)meshSize);
                float   height         = heightCurve.Evaluate(heightMap [x, y]) * heightMultiplier;
                Vector3 vertexPosition = new Vector3(topLeftX + percent.x * meshSizeUnsimplified, height, topLeftZ - percent.y * meshSizeUnsimplified);

                meshData.AddVertex(vertexPosition, percent, vertexIndex);

                if (x < borderedSize - 1 && y < borderedSize - 1)
                {
                    int a = vertexIndicesMap [x, y];
                    int b = vertexIndicesMap [x + meshSimplificationIncrement, y];
                    int c = vertexIndicesMap [x, y + meshSimplificationIncrement];
                    int d = vertexIndicesMap [x + meshSimplificationIncrement, y + meshSimplificationIncrement];
                    meshData.AddTriangle(a, d, c);
                    meshData.AddTriangle(d, a, b);
                }

                vertexIndex++;
            }
        }

        return(meshData);
    }
コード例 #17
0
ファイル: OscInput.cs プロジェクト: softpunch/Mirage
        float CalculateTargetValue(float inputValue)
        {
            var p = _inputCurve.Evaluate(inputValue);

            return(BasicMath.Lerp(_outputValue0, _outputValue1, p));
        }
コード例 #18
0
        void Update()
        {
            Vector3 translation = Vector3.zero;

            #if ENABLE_LEGACY_INPUT_MANAGER
            // Exit Sample
            if (Input.GetKey(KeyCode.Escape))
            {
                Application.Quit();
                #if UNITY_EDITOR
                UnityEditor.EditorApplication.isPlaying = false;
                #endif
            }
            // Hide and lock cursor when right mouse button pressed
            if (Input.GetMouseButtonDown(1))
            {
                Cursor.lockState = CursorLockMode.Locked;
            }

            // Unlock and show cursor when right mouse button released
            if (Input.GetMouseButtonUp(1))
            {
                Cursor.visible   = true;
                Cursor.lockState = CursorLockMode.None;
            }

            // Rotation
            if (Input.GetMouseButton(1))
            {
                var mouseMovement = new Vector2(Input.GetAxis("Mouse X"), Input.GetAxis("Mouse Y") * (invertY ? 1 : -1));

                var mouseSensitivityFactor = mouseSensitivityCurve.Evaluate(mouseMovement.magnitude);

                m_TargetCameraState.yaw   += mouseMovement.x * mouseSensitivityFactor;
                m_TargetCameraState.pitch += mouseMovement.y * mouseSensitivityFactor;
            }

            // Translation
            translation = GetInputTranslationDirection() * Time.deltaTime;

            // Speed up movement when shift key held
            if (Input.GetKey(KeyCode.LeftShift))
            {
                translation *= 10.0f;
            }

            // Modify movement by a boost factor (defined in Inspector and modified in play mode through the mouse scroll wheel)
            boost       += Input.mouseScrollDelta.y * 0.2f;
            translation *= Mathf.Pow(2.0f, boost);
            #elif USE_INPUT_SYSTEM
            // TODO: make the new input system work
            #endif

            m_TargetCameraState.Translate(translation);

            // Framerate-independent interpolation
            // Calculate the lerp amount, such that we get 99% of the way to our target in the specified time
            var positionLerpPct = 1f - Mathf.Exp((Mathf.Log(1f - 0.99f) / positionLerpTime) * Time.deltaTime);
            var rotationLerpPct = 1f - Mathf.Exp((Mathf.Log(1f - 0.99f) / rotationLerpTime) * Time.deltaTime);
            m_InterpolatingCameraState.LerpTowards(m_TargetCameraState, positionLerpPct, rotationLerpPct);

            m_InterpolatingCameraState.UpdateTransform(transform);
        }
コード例 #19
0
    void Update()
    {
        float deltaTime = Time.deltaTime;

        //操作handleShootTextGroup中移动
        for (int i = 0; i < handleShootTextGroup.Count; i++)
        {
            ShootTextComponent shootTextComponent = handleShootTextGroup[i];

            Vector3 shootTextCreatPosition = Vector3.zero;
            shootTextCreatPosition    = shootTextComponent.cacheTranform.GetComponent <Collider>().bounds.center + (((Vector3.up * shootTextComponent.cacheTranform.GetComponent <Collider>().bounds.size.y) * 0.5f));
            shootTextCreatPosition.x += (float)shootTextComponent.initializedHorizontalPositionOffset;
            shootTextCreatPosition.y += (float)shootTextComponent.initializedVerticalPositionOffset;

            Vector2 anchors = ShootTextCamera.WorldToViewportPoint(shootTextCreatPosition);                                                                           //飘字初始锚点位置
            Vector2 changeAnchoredPosition = new Vector2((float)(anchors.x + shootTextComponent.xMoveOffeset), (float)(anchors.y + shootTextComponent.yMoveOffeset)); //飘字这一帧所在位置

            //设定锚点
            shootTextComponent.rectTransform.anchorMax = anchors;
            shootTextComponent.rectTransform.anchorMin = anchors;
            //设置相对坐标
            shootTextComponent.rectTransform.anchoredPosition = changeAnchoredPosition;

            if (shootTextComponent.delayMoveTime <= Time.time)//允许移动操作
            {
                shootTextComponent.isMove = true;
            }

            //处理近大远小
            double objectHigh = ModelInScreenHigh(shootTextComponent.cacheTranform);
            double scale      = (objectHigh / 100) * shootTextScaleFactor;

            shootTextComponent.ChangeScale(scale);
            double xMoveOffeset = horizontalMoveSpeed * deltaTime * objectHigh;
            double yMoveOffeset = verticalMoveSpeed * deltaTime * objectHigh;

            if (shootTextComponent.isMove == true)//处理位置信息
            {
                switch (shootTextComponent.moveType)
                {
                case TextMoveType.None:
                    break;

                case TextMoveType.Up:
                {
                    shootTextComponent.yMoveOffeset += yMoveOffeset;
                }
                break;

                case TextMoveType.Down:
                {
                    shootTextComponent.yMoveOffeset -= yMoveOffeset;
                }
                break;

                case TextMoveType.Left:
                {
                    shootTextComponent.xMoveOffeset -= xMoveOffeset;
                }
                break;

                case TextMoveType.Right:
                {
                    shootTextComponent.xMoveOffeset += xMoveOffeset;
                }
                break;

                case TextMoveType.LeftUp:
                {
                    shootTextComponent.xMoveOffeset -= xMoveOffeset;
                    shootTextComponent.yMoveOffeset += yMoveOffeset;
                }
                break;

                case TextMoveType.LeftDown:
                {
                    shootTextComponent.xMoveOffeset -= xMoveOffeset;
                    shootTextComponent.yMoveOffeset -= yMoveOffeset;
                }
                break;

                case TextMoveType.RightUp:
                {
                    shootTextComponent.xMoveOffeset += xMoveOffeset;
                    shootTextComponent.yMoveOffeset += yMoveOffeset;
                }
                break;

                case TextMoveType.RightDown:
                {
                    shootTextComponent.xMoveOffeset += xMoveOffeset;
                    shootTextComponent.yMoveOffeset -= yMoveOffeset;
                }
                break;

                case TextMoveType.LeftParabola:
                {
                    float parabola = shootParabolaCure.Evaluate((float)(shootTextComponent.fadeCurveTime / moveLifeTime));
                    shootTextComponent.xMoveOffeset -= xMoveOffeset;
                    shootTextComponent.yMoveOffeset += yMoveOffeset + parabola;
                }
                break;

                case TextMoveType.RightParabola:
                {
                    float parabola = shootParabolaCure.Evaluate((float)(shootTextComponent.fadeCurveTime / moveLifeTime));
                    shootTextComponent.xMoveOffeset += xMoveOffeset;
                    shootTextComponent.yMoveOffeset += yMoveOffeset + parabola;
                }
                break;

                default:
                    break;
                }
            }

            //处理渐隐
            if (shootTextComponent.isMove == true)
            {
                shootTextComponent.fadeCurveTime += deltaTime;
                float alpha = shootTextCure.Evaluate((float)(shootTextComponent.fadeCurveTime));
                shootTextComponent.ChangeAlpha(alpha);
            }
            else
            {
                shootTextComponent.ChangeAlpha(1);
            }

            //处理删除对应的飘字
            if (shootTextComponent.isMove == true && shootTextComponent.canvasGroup.alpha <= 0)
            {
                waitDestoryGroup.Add(shootTextComponent);
            }
        }

        //是否加速
        isAccelerate = waitShootTextGroup.Count >= accelerateThresholdValue ? true : false;
        if (isAccelerate)
        {
            updateCreatTime = updateCreatTime / accelerateFactor;
        }
        else
        {
            updateCreatTime = updateCreatDefualtTime;
        }

        //创建
        if ((updateCreatTempTime -= deltaTime) <= 0)
        {
            updateCreatTempTime = updateCreatTime;
            if (waitShootTextGroup.Count > 0)
            {
                GameObject tempObj = InstanceShootText(waitShootTextGroup.Dequeue());
                tempObj.transform.SetParent(ShootTextCanvas, false);
            }
        }

        //删除已经完全消失飘字
        for (int i = 0; i < waitDestoryGroup.Count; i++)
        {
            handleShootTextGroup.Remove(waitDestoryGroup[i]);
            Destroy(waitDestoryGroup[i].gameObject);
        }
        waitDestoryGroup.Clear();
    }
コード例 #20
0
    void Update()
    {
        Vector3 growValue = new Vector3(growSpeed, 0, growSpeed) * growSpeedCoef * Time.deltaTime * speedEvolution.Evaluate((transform.localScale.x / 2) / maxRay);

        transform.localScale += growValue;

        if (transform.localScale.x / 2 >= maxRay)
        {
            Destroy(gameObject);
        }

        foreach (MeshRenderer r in renderers)
        {
            Material m = r.material;

            m.SetFloat("_Refraction", Mathf.Clamp(m.GetFloat("_Refraction") - Time.deltaTime * FxHideSpeed * 100, 0, 100));
            m.SetFloat("_Transparancy", Mathf.Clamp01(m.GetFloat("_Transparancy") - Time.deltaTime * FxHideSpeed));
        }
    }
コード例 #21
0
ファイル: FuzzyMoviment.cs プロジェクト: Jvbs19/FuzzyLogic
 public void FuzzifyDistancia(float inputValue)
 {
     Dicionario_Distancia["Baixa"] = Distancia_Baixa.Evaluate(inputValue);
     Dicionario_Distancia["Media"] = Distancia_Media.Evaluate(inputValue);
     Dicionario_Distancia["Alta"]  = Distancia_Alta.Evaluate(inputValue);
 }
コード例 #22
0
 private void Awake()
 {
     lightSource           = GetComponent <Light>();
     lightSource.intensity = LightCurve.Evaluate(0);
 }
コード例 #23
0
 protected override float ComputeProgress(float baseProgress)
 {
     return(m_AnimationCurve.Evaluate(baseProgress));
 }
コード例 #24
0
ファイル: ArchedText.cs プロジェクト: provencesl/Prototype
    void UpdateCurveMesh()
    {
        textComponent.ForceMeshUpdate();

        TMP_TextInfo textInfo       = textComponent.textInfo;
        int          characterCount = textInfo.characterCount;

        if (characterCount == 0)
        {
            return;
        }

        Vector3 baseline                = new Vector3();
        Vector3 prevAngleDirection      = new Vector3();
        Vector3 prevOffsetToMidBaseline = new Vector3();

        Vector3[] vertices;
        Matrix4x4 matrix;
        float     defaultBaseLine = 0;
        float     maxBaseLine     = float.MinValue;
        float     minBaseLine     = float.MaxValue;
        bool      isFirst         = true;

        for (int i = 0; i < characterCount; i++)
        {
            if (!textInfo.characterInfo[i].isVisible)
            {
                continue;
            }

            int vertexIndex = textInfo.characterInfo[i].vertexIndex;

            int materialIndex = textInfo.characterInfo[i].materialReferenceIndex;
            vertices = textInfo.meshInfo[materialIndex].vertices;

            //文字の真ん中の点と文字の基準となるベースラインの高さを取得
            Vector3 offsetToMidBaseline = new Vector2((vertices[vertexIndex + 0].x + vertices[vertexIndex + 2].x) / 2, textInfo.characterInfo[i].baseLine);

            //文字の中央の下が原点となるように頂点を移動(これから回転と移動をさせるため)
            vertices[vertexIndex + 0] += -offsetToMidBaseline;
            vertices[vertexIndex + 1] += -offsetToMidBaseline;
            vertices[vertexIndex + 2] += -offsetToMidBaseline;
            vertices[vertexIndex + 3] += -offsetToMidBaseline;

            //曲線の傾き(agnle)の計算
            float   x0             = (float)(i + 1) / (characterCount + 1);
            float   x1             = x0 + 0.0001f;
            float   y0             = vertexCurve.Evaluate(x0);
            float   y1             = vertexCurve.Evaluate(x1);
            Vector3 horizontal     = new Vector3(1, 0, 0);
            Vector3 tangent        = new Vector3(0.0001f, (y1 - y0));
            Vector3 angleDirection = tangent.normalized;
            float   angle          = Mathf.Acos(Vector3.Dot(horizontal, angleDirection)) * Mathf.Rad2Deg;
            Vector3 cross          = Vector3.Cross(horizontal, tangent);
            angle = cross.z > 0 ? angle : 360 - angle;

            //angle回転させた頂点位置の計算
            matrix = Matrix4x4.Rotate(Quaternion.Euler(0, 0, angle));
            vertices[vertexIndex + 0] = matrix.MultiplyPoint3x4(vertices[vertexIndex + 0]);
            vertices[vertexIndex + 1] = matrix.MultiplyPoint3x4(vertices[vertexIndex + 1]);
            vertices[vertexIndex + 2] = matrix.MultiplyPoint3x4(vertices[vertexIndex + 2]);
            vertices[vertexIndex + 3] = matrix.MultiplyPoint3x4(vertices[vertexIndex + 3]);

            //文字間の計算
            float characterSpace;
            if (isFirst)
            {
                baseline        = offsetToMidBaseline;
                defaultBaseLine = baseline.y;
                characterSpace  = 0;
                isFirst         = false;
            }
            else
            {
                characterSpace = (offsetToMidBaseline - prevOffsetToMidBaseline).magnitude;
            }
            prevOffsetToMidBaseline = offsetToMidBaseline;

            //文字位置を計算して移動
            baseline = baseline + (angleDirection + prevAngleDirection).normalized * characterSpace;
            vertices[vertexIndex + 0] += baseline;
            vertices[vertexIndex + 1] += baseline;
            vertices[vertexIndex + 2] += baseline;
            vertices[vertexIndex + 3] += baseline;

            prevAngleDirection = angleDirection;

            minBaseLine = Mathf.Min(minBaseLine, baseline.y);
            maxBaseLine = Mathf.Max(maxBaseLine, baseline.y);
        }

        //揃えの計算
        if (hAlignment != TextAlignment.Left || vAlignment != TextVAlignment.Base)
        {
            float hOffset = 0;
            if (hAlignment == TextAlignment.Center)
            {
                hOffset = (prevOffsetToMidBaseline.x - baseline.x) * 0.5f;
            }
            else if (hAlignment == TextAlignment.Right)
            {
                hOffset = (prevOffsetToMidBaseline.x - baseline.x);
            }

            float vOffset = 0;
            if (vAlignment == TextVAlignment.Bottom)
            {
                vOffset = defaultBaseLine - minBaseLine;
            }
            else if (vAlignment == TextVAlignment.Top)
            {
                vOffset = defaultBaseLine - maxBaseLine;
            }

            Vector3 alignOffset = new Vector3(hOffset, vOffset, 0);

            for (int i = 0; i < characterCount; i++)
            {
                if (!textInfo.characterInfo[i].isVisible)
                {
                    continue;
                }

                int vertexIndex   = textInfo.characterInfo[i].vertexIndex;
                int materialIndex = textInfo.characterInfo[i].materialReferenceIndex;
                vertices = textInfo.meshInfo[materialIndex].vertices;

                vertices[vertexIndex + 0] += alignOffset;
                vertices[vertexIndex + 1] += alignOffset;
                vertices[vertexIndex + 2] += alignOffset;
                vertices[vertexIndex + 3] += alignOffset;
            }
        }

        textComponent.UpdateVertexData();
    }
コード例 #25
0
 private void Update()
 {
     if (!isShakingPaused)
     {
         if (isShaking)
         {
             shakeTime += Time.deltaTime;
             if (shakeTime < shakeDuration)
             {
                 camTransform.localPosition = originalLocalPosition + ((Random.insideUnitSphere * shakeStrength) * shakeDecayRate.Evaluate(shakeTime / shakeDuration));
             }
             else
             {
                 isShaking = false;
                 camTransform.localPosition = originalLocalPosition;
             }
         }
     }
 }
コード例 #26
0
ファイル: Jump.cs プロジェクト: TPKai/2D-Platformer
    public override void UpdateAbility(CharacterState characterState, Animator animator, AnimatorStateInfo stateInfo)
    {
        CharacterController2D _controller = characterState.GetCharacterController2D(animator);

        _controller.transform.Translate(Vector2.up * _jumpForce * _speedGraph.Evaluate(stateInfo.normalizedTime) * Time.deltaTime);
    }
コード例 #27
0
        private IEnumerator ToAttackIE(Prop prop)
        {
            bool IsRun = true;

            m_AttackTimer = 0;
            Vector3 startPos = transform.position;
            Vector3 endPos   = prop.transform.position;

            m_AttackLine.SetPosition(0, startPos);
            //抛
            while (IsRun)
            {
                m_AttackTimer += Time.deltaTime;
                float process = m_AttackTimer / m_CastTime;
                if (process >= 1)
                {
                    process = 1;
                    IsRun   = false;
                }
                float   value = m_CastCurve.Evaluate(process);
                Vector2 pos   = Vector3.Lerp(startPos, endPos, value);

                m_AttackLine.SetPosition(1, pos);
                yield return(null);
            }
            if (prop.PropType == PropType.Key)
            {
                EazySoundManager.PlaySound(m_GetKeySound);
            }
            else
            {
                EazySoundManager.PlaySound(m_GetPropSound);
            }
            bool IsRun2 = true;

            m_AttackTimer = 0;
            m_Animator.SetTrigger("Resilience");
            //拉
            while (IsRun2)
            {
                m_AttackTimer += Time.deltaTime;
                float p = m_AttackTimer / m_ResilienceTime;
                if (p >= 1)
                {
                    p      = 1;
                    IsRun2 = false;
                }
                float   value = m_ResilienceCurve.Evaluate(p);
                Vector2 pos   = Vector3.Lerp(endPos, startPos, value);
                m_AttackLine.SetPosition(1, pos);
                prop.transform.position = pos;
                yield return(null);
            }

            //攻击完成,改变地图状态
            if (OnAttackTarget != null)
            {
                OnAttackTarget(prop);
            }
            Destroy(prop.gameObject);
            IsRigibody = false;
            ToIdle();
        }
コード例 #28
0
    private IEnumerator ShakingPicture(Image _pictureToShake)
    {
        float elapsedTime = 0;

        while (elapsedTime < shakingDuration)
        {
            float progression = elapsedTime / shakingDuration;
            _pictureToShake.transform.rotation = Quaternion.Euler(_pictureToShake.rectTransform.rotation.eulerAngles.x, _pictureToShake.rectTransform.rotation.eulerAngles.y, shakingCurve.Evaluate(progression) * shakingForkDegrees);
            _pictureToShake.color = shakingColor.Evaluate(progression);
            elapsedTime          += Time.unscaledDeltaTime;
            yield return(null);
        }

        _pictureToShake.rectTransform.rotation = Quaternion.Euler(_pictureToShake.rectTransform.rotation.eulerAngles.x, _pictureToShake.rectTransform.rotation.eulerAngles.y, 0);
        _pictureToShake.color = shakingColor.Evaluate(0);
    }
コード例 #29
0
 protected float Evaluate(AnimationCurve curve, float fallback)
 {
     return(curve?.Evaluate(ElaspsedTime) ?? fallback);
 }
コード例 #30
0
    void TransformChanger()
    {
        InvertedEffector      = theEffector.Inverted;
        Refinecurve           = theEffector.FallOffCurve;
        EffectorDistance      = theEffector.EffectorDistance;
        EffectorRecoverySpeed = theEffector.EffectorRecoverySpeed;

        for (int i = 0; i < originalObjects.Length; i++)
        {
            float x, y, z;

            Vector3 posstatic = new Vector3(OriginalX [i], OriginalY [i], OriginalZ [i]);
            float   dist      = Vector3.Distance(posstatic, Effector.transform.position);
            normalizedCurve = (dist - rangeSmallest) / (EffectorDistance - rangeSmallest);
            curveValue      = Refinecurve.Evaluate(normalizedCurve);

            if (!UseAsMultiplier)
            {
                x = oriScaleX [i] + ScaleX * curveValue;
                y = oriScaleY [i] + ScaleY * curveValue;
                z = oriScaleZ [i] + ScaleZ * curveValue;
            }
            else
            {
                x = oriScaleX [i] * ScaleX * curveValue;
                y = oriScaleY [i] * ScaleY * curveValue;
                z = oriScaleZ [i] * ScaleZ * curveValue;
            }
            float new_x = x;
            float new_y = y;
            float new_z = z;

            newObjectPos         = new Vector3(new_x, new_y, new_z);
            displacedObjects [i] = newObjectPos;
        }
        if (!InvertedEffector)
        {
            for (int x = 0; x < originalObjects.Length; x++)
            {
                OriginalsPos.Set(OriginalX [x], OriginalY [x], OriginalZ [x]);
                if (Vector3.Distance(OriginalsPos, Effector.transform.position) <= EffectorDistance)
                {
                    movedObjects [x].localScale = Vector3.Lerp(movedObjects [x].transform.localScale, displacedObjects [x], EffectorRecoverySpeed * Time.deltaTime);
                }
                else
                {
                    originalsLerper.Set(oriScaleX [x], oriScaleX [x], oriScaleX [x]);
                    movedObjects [x].localScale = Vector3.Lerp(movedObjects [x].transform.localScale, originalsLerper, EffectorRecoverySpeed * Time.deltaTime);
                }
            }
        }
        else
        {
            for (int x = 0; x < originalObjects.Length; x++)
            {
                OriginalsPos.Set(OriginalX [x], OriginalY [x], OriginalZ [x]);
                if (Vector3.Distance(OriginalsPos, Effector.transform.position) > EffectorDistance)
                {
                    movedObjects [x].localScale = Vector3.Lerp(movedObjects [x].transform.localScale, displacedObjects [x], EffectorRecoverySpeed * Time.deltaTime);
                }
                else
                {
                    originalsLerper.Set(oriScaleX [x], oriScaleX [x], oriScaleX [x]);
                    movedObjects [x].localScale = Vector3.Lerp(movedObjects [x].transform.localScale, originalsLerper, EffectorRecoverySpeed * Time.deltaTime);
                }
            }
        }
    }