示例#1
0
/**
 * Tweet cart is the whole script, fit in one tweet, i.e. code length must be <= 280 characters
 *
 * Tigra tweet cart shortcuts:
 *
 * Functions:
 * TIC() is called 60 times per second.
 *
 * Variables:
 * t:  elapsed time in seconds
 * f:  frame counter
 *
 * Aliases:
 * B:  bool
 * F:  float
 * I:  int
 * M:  UnityEngine.Mathf
 * R:  UnityEngine.Random
 * S:  System.String
 * V2: UnityEngine.Vector2
 * V3: UnityEngine.Vector3
 * Z:  Tic80
 *
 * Delegates:
 * CD: circ & circb delegate
 * RD: rect & rectb delegate
 * TD: tri & trib delegate
 *
 * Beautify/minify C# online tool:
 * https://codebeautify.org/csharpviewer
 */
class Tc5 : Z { F x = 96, y = 24, d = .01f; void TIC()
                {
                    cls(16); if (btn(0))
                    {
                        y -= d;
                    }
                    if (btn(1))
                    {
                        y += d;
                    }
                    if (btn(2))
                    {
                        x -= d;
                    }
                    if (btn(3))
                    {
                        x += d;
                    }
                    for (I e = 0; e < 136; e += 2)
                    {
                        for (I b = 0; b < 240; b += 50)
                        {
                            rect(b, e, M.Sin((y * (e * b) / x) + (F)f / 200) * 50, 1, R.Range(6, 10));
                        }
                    }
                }
示例#2
0
        /** Convert from voxel coordinates to world coordinates.
         * (0,0,0) in voxel coordinates is a bottom corner of the bounding box.
         * (1,0,0) is one voxel in the +X direction of that.
         */
        public Int3 VoxelToWorldInt3(Int3 voxelPosition)
        {
            var pos = voxelPosition * Int3.Precision;

            pos = new Int3(Mathf.RoundToInt(pos.x * cellScale.x), Mathf.RoundToInt(pos.y * cellScale.y), Mathf.RoundToInt(pos.z * cellScale.z));
            return(pos + (Int3)voxelOffset);
        }
示例#3
0
 public static float InOut(float k)
 {
     if ((k *= 2f) < 1f)
     {
         return(-0.5f * (Mathf.Sqrt(1f - k * k) - 1));
     }
     return(0.5f * (Mathf.Sqrt(1f - (k -= 2f) * k) + 1f));
 }
示例#4
0
        /// <summary>
        /// Rotates the given Vector2 counterclockwise by the given angle
        /// </summary>
        public static U.Vector2 RotateVector2(U.Vector2 vec, float angle)
        {
            angle = U.Mathf.Deg2Rad * angle;
            var _sinAngle = Mathf.Sin(angle);
            var _cosAngle = Mathf.Cos(angle);

            return(new U.Vector2(_cosAngle * vec.x - _sinAngle * vec.y, _sinAngle * vec.x + _cosAngle * vec.y));
        }
示例#5
0
 public static float InOut(float k)
 {
     if ((k *= 2f) < 1f)
     {
         return(-0.5f * Mathf.Pow(2f, 10f * (k -= 1f)) * Mathf.Sin((k - 0.1f) * (2f * Mathf.PI) / 0.4f));
     }
     return(Mathf.Pow(2f, -10f * (k -= 1f)) * Mathf.Sin((k - 0.1f) * (2f * Mathf.PI) / 0.4f) * 0.5f + 1f);
 }
示例#6
0
 /// <summary>
 /// Performs a linear interpolation between the two colors specified for each color channel independently.
 /// </summary>
 /// <param name="a">The first color to be interpolated between, corresponding to a <paramref name="t"/> value of 0.</param>
 /// <param name="b">The second color to be interpolated between, corresponding to a <paramref name="t"/> value of 1.</param>
 /// <param name="t">The parameter specifying how much each color is weighted by the interpolation.  Typically within the range [0, 1], but does not need to be, and will not be clamped.</param>
 /// <returns>A new color that is the result of the linear interpolation between the two original colors.</returns>
 /// <remarks>
 /// <para>When specifying a <paramref name="t"/> value outside the range [0, 1], the resulting color may no longer be
 /// within the valid range of the color space, even if the two original colors are within the valid range.</para>
 /// </remarks>
 /// <seealso cref="Lerp(ColorCMY, ColorCMY, float)"/>
 public static ColorCMY LerpUnclamped(ColorCMY a, ColorCMY b, float t)
 {
     return(new ColorCMY(
                Math.LerpUnclamped(a.c, b.c, t),
                Math.LerpUnclamped(a.m, b.m, t),
                Math.LerpUnclamped(a.y, b.y, t),
                Math.LerpUnclamped(a.a, b.a, t)));
 }
示例#7
0
        private void OptimizeAtlas()
        {
            for (int atlasIndex = 0; atlasIndex < atlassedMaterials.Count; atlasIndex++)
            {
                var     material = atlassedMaterials[atlasIndex];
                Vector2 usedArea = new Vector2(0, 0);
                for (int atlasElementIndex = 0; atlasElementIndex < material.materialFragments.Count; atlasElementIndex++)
                {
                    if (material.materialFragments[atlasElementIndex].atlasRegion.xMax > usedArea.x)
                    {
                        usedArea.x = material.materialFragments[atlasElementIndex].atlasRegion.xMax;
                    }

                    if (material.materialFragments[atlasElementIndex].atlasRegion.yMax > usedArea.y)
                    {
                        usedArea.y = material.materialFragments[atlasElementIndex].atlasRegion.yMax;
                    }
                }

                //Headless mode ends up with zero usedArea
                if (Mathf.Approximately(usedArea.x, 0f) || Mathf.Approximately(usedArea.y, 0f))
                {
                    material.cropResolution = new Vector2(0.0f, 0.0f);
                    return;
                }

                Vector2 tempResolution = new Vector2(umaGenerator.atlasResolution, umaGenerator.atlasResolution);

                bool done = false;
                while (!done && Mathf.Abs(usedArea.x) > 0.0001)
                {
                    if (tempResolution.x * 0.5f >= usedArea.x)
                    {
                        tempResolution = new Vector2(tempResolution.x * 0.5f, tempResolution.y);
                    }
                    else
                    {
                        done = true;
                    }
                }

                done = false;
                while (!done && Mathf.Abs(usedArea.y) > 0.0001)
                {
                    if (tempResolution.y * 0.5f >= usedArea.y)
                    {
                        tempResolution = new Vector2(tempResolution.x, tempResolution.y * 0.5f);
                    }
                    else
                    {
                        done = true;
                    }
                }

                material.cropResolution = tempResolution;
            }
        }
        /// <summary>
        /// Converts a Vector3 to a Vector3i.
        /// </summary>
        /// <returns>
        /// The vector3i.
        /// </returns>
        /// <param name='inputVector'>
        /// Input Vector3.
        /// </param>
        public static Vector3i Vector3ToVector3i(UnityEngine.Vector3 inputVector)
        {
            int iX, iY, iZ;

            iX = (int)Mathf.Round(inputVector.x);
            iY = (int)Mathf.Round(inputVector.y);
            iZ = (int)Mathf.Round(inputVector.z);
            return(new Vector3i(iX, iY, iZ));
        }
示例#9
0
        internal void CalculateVelocity(Pathfinding.RVO.Simulator.WorkerContext context)
        {
            if (manuallyControlled)
            {
                return;
            }

            if (locked)
            {
                calculatedSpeed       = 0;
                calculatedTargetPoint = position;
                return;
            }

            // Buffer which will be filled up with velocity obstacles (VOs)
            var vos = context.vos;

            vos.Clear();

            GenerateObstacleVOs(vos);
            GenerateNeighbourAgentVOs(vos);

            bool insideAnyVO = BiasDesiredVelocity(vos, ref desiredVelocity, ref desiredTargetPointInVelocitySpace, simulator.symmetryBreakingBias);

            if (!insideAnyVO)
            {
                // Desired velocity can be used directly since it was not inside any velocity obstacle.
                // No need to run optimizer because this will be the global minima.
                // This is also a special case in which we can set the
                // calculated target point to the desired target point
                // instead of calculating a point based on a calculated velocity
                // which is an important difference when the agent is very close
                // to the target point
                // TODO: Not actually guaranteed to be global minima if desiredTargetPointInVelocitySpace.magnitude < desiredSpeed
                // maybe do something different here?
                calculatedTargetPoint = desiredTargetPointInVelocitySpace + position;
                calculatedSpeed       = desiredSpeed;
                if (DebugDraw)
                {
                    Draw.Debug.CrossXZ(FromXZ(calculatedTargetPoint), Color.white);
                }
                return;
            }

            Vector2 result = Vector2.zero;

            result = GradientDescent(vos, currentVelocity, desiredVelocity);

            if (DebugDraw)
            {
                Draw.Debug.CrossXZ(FromXZ(result + position), Color.white);
            }
            //Debug.DrawRay (To3D (position), To3D (result));

            calculatedTargetPoint = position + result;
            calculatedSpeed       = Mathf.Min(result.magnitude, maxSpeed);
        }
示例#10
0
        /** Returns a rect containing the indices of all tiles touching the specified bounds.
         * \param rect Graph space rectangle (in graph space all tiles are on the XZ plane regardless of graph rotation and other transformations, the first tile has a corner at the origin)
         */
        public static IntRect GetTouchingTilesInGraphSpace(this NavmeshBase self, Rect rect)
        {
            // Calculate world bounds of all affected tiles
            var r = new IntRect(Mathf.FloorToInt(rect.xMin / self.TileWorldSizeX), Mathf.FloorToInt(rect.yMin / self.TileWorldSizeZ), Mathf.FloorToInt(rect.xMax / self.TileWorldSizeX), Mathf.FloorToInt(rect.yMax / self.TileWorldSizeZ));

            // Clamp to bounds
            r = IntRect.Intersection(r, new IntRect(0, 0, self.tileXCount - 1, self.tileZCount - 1));
            return(r);
        }
示例#11
0
    private void DrawPendulum()
    {
        //Draw Pendulum
        float deg         = sine * maxDeg;
        float rad         = M.Deg2Rad * deg;
        V3    pundulumPos = new V3(M.Sin(rad * timeScale), -M.Cos(rad * timeScale), 0);

        G.DrawWireSphere(pundulumPos + V3.left * 3, .2f);
        G.DrawLine(V3.zero + V3.left * 3, pundulumPos + V3.left * 3);
    }
示例#12
0
    void basicAttack()
    {
        lastClickedTime = Time.time;
        numberOfClicks++;

        if (numberOfClicks == 1)
        {
            animator.SetBool("basicAttack1", true);
        }
        numberOfClicks = Mathf.Clamp(numberOfClicks, 0, 3);
    }
示例#13
0
        /** Returns a rect containing the indices of all tiles touching the specified bounds */
        public static IntRect GetTouchingTiles(this NavmeshBase self, Bounds bounds)
        {
            bounds = self.transform.InverseTransform(bounds);

            // Calculate world bounds of all affected tiles
            var r = new IntRect(Mathf.FloorToInt(bounds.min.x / self.TileWorldSizeX), Mathf.FloorToInt(bounds.min.z / self.TileWorldSizeZ), Mathf.FloorToInt(bounds.max.x / self.TileWorldSizeX), Mathf.FloorToInt(bounds.max.z / self.TileWorldSizeZ));

            // Clamp to bounds
            r = IntRect.Intersection(r, new IntRect(0, 0, self.tileXCount - 1, self.tileZCount - 1));
            return(r);
        }
示例#14
0
 /// <summary>
 /// Modeled after the piecewise circular function
 /// y = (1/2)(1 - Math.Sqrt(1 - 4x^2))           ; [0, 0.5)
 /// y = (1/2)(Math.Sqrt(-(2x - 3)*(2x - 1)) + 1) ; [0.5, 1]
 /// </summary>
 static public float CircularEaseInOut(float p)
 {
     if (p < 0.5f)
     {
         return(0.5f * (1 - Math.Sqrt(1 - 4 * (p * p))));
     }
     else
     {
         return(0.5f * (Math.Sqrt(-((2 * p) - 3) * ((2 * p) - 1)) + 1));
     }
 }
示例#15
0
 /// <summary>
 /// Modeled after the piecewise circular function
 /// y = (1/2)(1 - Math.Sqrt(1 - 4x^2))           ; [0, 0.5)
 /// y = (1/2)(Math.Sqrt(-(2x - 3)*(2x - 1)) + 1) ; [0.5, 1]
 /// </summary>
 static public float CircularEaseInOut(float p)
 {
     if (p < 0.5f)
     {
         return(0.5f * (1.0f - Math.Sqrt(1.0f - 4.0f * (p * p))));
     }
     else
     {
         return(0.5f * (Math.Sqrt(-((2.0f * p) - 3.0f) * ((2.0f * p) - 1.0f)) + 1.0f));
     }
 }
示例#16
0
 void TIC()
 {
     cls(); for (F i = 0; i < m.Length; i++)
     {
         if (f % 10 == 0)
         {
             c++;
         }
         c = c == 0?1:c; print(m[(I)i], o + i * 6, 64 + M.Sin(i / 2 + f / M.PI / 4) * 16, c);
     }
 }
示例#17
0
 /// <summary>
 /// Modeled after the piecewise exponentially-damped sine wave:
 /// y = (1/2)*sin(13pi/2*(2*x))*Math.Pow(2, 10 * ((2*x) - 1))      ; [0,0.5)
 /// y = (1/2)*(sin(-13pi/2*((2x-1)+1))*Math.Pow(2,-10(2*x-1)) + 2) ; [0.5, 1]
 /// </summary>
 static public float ElasticEaseInOut(float p)
 {
     if (p < 0.5f)
     {
         return(0.5f * Math.Sin(13 * HALFPI * (2 * p)) * Math.Pow(2, 10 * ((2 * p) - 1)));
     }
     else
     {
         return(0.5f * (Math.Sin(-13 * HALFPI * ((2 * p - 1) + 1)) * Math.Pow(2, -10 * (2 * p - 1)) + 2));
     }
 }
示例#18
0
 /// <summary>
 /// Modeled after the piecewise exponentially-damped sine wave:
 /// y = (1/2)*sin(13pi/2*(2*x))*Math.Pow(2, 10 * ((2*x) - 1))      ; [0,0.5)
 /// y = (1/2)*(sin(-13pi/2*((2x-1)+1))*Math.Pow(2,-10(2*x-1)) + 2) ; [0.5, 1]
 /// </summary>
 static public float ElasticEaseInOut(float p)
 {
     if (p < 0.5f)
     {
         return(0.5f * Math.Sin(13.0f * HALFPI * (2.0f * p)) * Math.Pow(2.0f, 10.0f * ((2.0f * p) - 1.0f)));
     }
     else
     {
         return(0.5f * (Math.Sin(-13.0f * HALFPI * ((2.0f * p - 1.0f) + 1.0f)) * Math.Pow(2.0f, -10.0f * (2.0f * p - 1)) + 2.0f));
     }
 }
示例#19
0
 private void DrawPlatforms()
 {
     if (!showAnims)
     {
         return;
     }
     G.color = C.white;
     G.DrawWireCube(V3.right * 2 + V3.up * M.Sin(radians * M.PI) + V3.up * -.25f, new V3(1, .5f, 0));
     G.DrawWireCube(V3.right * 3 + V3.up * M.Sin(radians * M.PI / 2) + V3.up * -.25f, new V3(1, .5f, 0));
     G.DrawWireCube(V3.right * 4 + V3.up * M.Sin(radians * M.PI / 2) * .5f + V3.up * -.25f, new V3(1, .5f, 0));
 }
示例#20
0
 static public int constructor(IntPtr l)
 {
     try {
         UnityEngine.Mathf o;
         o = new UnityEngine.Mathf();
         pushValue(l, o);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
	static public int constructor(IntPtr l) {
		try {
			UnityEngine.Mathf o;
			o=new UnityEngine.Mathf();
			pushValue(l,true);
			pushValue(l,o);
			return 2;
		}
		catch(Exception e) {
			return error(l,e);
		}
	}
示例#22
0
 public static float Out(float k)
 {
     if (k == 0)
     {
         return(0);
     }
     if (k == 1)
     {
         return(1);
     }
     return(Mathf.Pow(2f, -10f * k) * Mathf.Sin((k - 0.1f) * (2f * Mathf.PI) / 0.4f) + 1f);
 }
示例#23
0
 public static float In(float k)
 {
     if (k == 0)
     {
         return(0);
     }
     if (k == 1)
     {
         return(1);
     }
     return(-Mathf.Pow(2f, 10f * (k -= 1f)) * Mathf.Sin((k - 0.1f) * (2f * Mathf.PI) / 0.4f));
 }
示例#24
0
        public Voxelize(float ch, float cs, float walkableClimb, float walkableHeight, float maxSlope, float maxEdgeLength)
        {
            cellSize      = cs;
            cellHeight    = ch;
            this.maxSlope = maxSlope;

            cellScale = new Vector3(cellSize, cellHeight, cellSize);

            voxelWalkableHeight = (uint)(walkableHeight / cellHeight);
            voxelWalkableClimb  = Mathf.RoundToInt(walkableClimb / cellHeight);
            this.maxEdgeLength  = maxEdgeLength;
        }
示例#25
0
        /** Evaluate gradient and value of the cost function at velocity p */
        Vector2 EvaluateGradient(VOBuffer vos, Vector2 p, out float value)
        {
            Vector2 gradient = Vector2.zero;

            value = 0;

            // Avoid other agents
            for (int i = 0; i < vos.length; i++)
            {
                float w;
                var   grad = vos.buffer[i].ScaledGradient(p, out w);
                if (w > value)
                {
                    value    = w;
                    gradient = grad;
                }
            }

            // Move closer to the desired velocity
            var dirToDesiredVelocity  = desiredVelocity - p;
            var distToDesiredVelocity = dirToDesiredVelocity.magnitude;

            if (distToDesiredVelocity > 0.0001f)
            {
                gradient += dirToDesiredVelocity * (DesiredVelocityWeight / distToDesiredVelocity);
                value    += distToDesiredVelocity * DesiredVelocityWeight;
            }

            // Prefer speeds lower or equal to the desired speed
            // and avoid speeds greater than the max speed
            var sqrSpeed = p.sqrMagnitude;

            if (sqrSpeed > desiredSpeed * desiredSpeed)
            {
                var speed = Mathf.Sqrt(sqrSpeed);

                if (speed > maxSpeed)
                {
                    const float MaxSpeedWeight = 3;
                    value    += MaxSpeedWeight * (speed - maxSpeed);
                    gradient -= MaxSpeedWeight * (p / speed);
                }

                // Scale needs to be strictly greater than DesiredVelocityWeight
                // otherwise the agent will not prefer the desired speed over
                // the maximum speed
                float scale = 2 * DesiredVelocityWeight;
                value    += scale * (speed - desiredSpeed);
                gradient -= scale * (p / speed);
            }

            return(gradient);
        }
示例#26
0
        void GenerateObstacleVOs(VOBuffer vos)
        {
            var range = maxSpeed * obstacleTimeHorizon;

            // Iterate through all obstacles that we might need to avoid
            for (int i = 0; i < simulator.obstacles.Count; i++)
            {
                var obstacle = simulator.obstacles[i];
                var vertex   = obstacle;
                // Iterate through all edges (defined by vertex and vertex.dir) in the obstacle
                do
                {
                    // Ignore the edge if the agent should not collide with it
                    if (vertex.ignore || (vertex.layer & collidesWith) == 0)
                    {
                        vertex = vertex.next;
                        continue;
                    }

                    // Start and end points of the current segment
                    float elevation1, elevation2;
                    var   p1 = To2D(vertex.position, out elevation1);
                    var   p2 = To2D(vertex.next.position, out elevation2);

                    Vector2 dir = (p2 - p1).normalized;

                    // Signed distance from the line (not segment, lines are infinite)
                    // TODO: Can be optimized
                    float dist = VO.SignedDistanceFromLine(p1, dir, position);

                    if (dist >= -0.01f && dist < range)
                    {
                        float factorAlongSegment = Vector2.Dot(position - p1, p2 - p1) / (p2 - p1).sqrMagnitude;

                        // Calculate the elevation (y) coordinate of the point on the segment closest to the agent
                        var segmentY = Mathf.Lerp(elevation1, elevation2, factorAlongSegment);

                        // Calculate distance from the segment (not line)
                        var sqrDistToSegment = (Vector2.Lerp(p1, p2, factorAlongSegment) - position).sqrMagnitude;

                        // Ignore the segment if it is too far away
                        // or the agent is too high up (or too far down) on the elevation axis (usually y axis) to avoid it.
                        // If the XY plane is used then all elevation checks are disabled
                        if (sqrDistToSegment < range * range && (simulator.movementPlane == MovementPlane.XY || (elevationCoordinate <= segmentY + vertex.height && elevationCoordinate + height >= segmentY)))
                        {
                            vos.Add(VO.SegmentObstacle(p2 - position, p1 - position, Vector2.zero, radius * 0.01f, 1f / ObstacleTimeHorizon, 1f / simulator.DeltaTime));
                        }
                    }

                    vertex = vertex.next;
                } while (vertex != obstacle && vertex != null && vertex.next != null);
            }
        }
示例#27
0
    private void DrawGraph()
    {
        //Draw Graph of the curves
        G.color = C.white;
        V3 offset = V3.down * 2 + V3.right * -1;

        G.DrawRay(offset + V3.up * .5f, V3.down * 1);
        G.DrawRay(offset + V3.down * .5f, V3.right * 2);

        G.color = C.gray;
        G.DrawRay(offset + V3.up * .5f, V3.right * 2);
        G.DrawRay(offset, V3.right * 2);

        G.DrawRay(offset + V3.up * .5f + V3.right * M.Repeat(radians / M.PI, 2), V3.down * 1);

        //Draw Sine
        G.color = C.red;
        offset  = V3.down * 2 + V3.right * -1;
        V3 last = new V3(0, 0, 0) + offset;

        for (int i = 1; i <= 360; i++)
        {
            V3 point = new V3((float)i / 180, M.Sin(M.Deg2Rad * i) * .5f, 0) + offset;

            G.DrawLine(last, point);
            last = point;
        }
        //Draw Cosine
        G.color = C.blue;
        offset  = V3.down * 2 + V3.right * -1;
        last    = new V3(0, .5f, 0) + offset;
        for (int i = 1; i <= 360; i++)
        {
            V3 point = new V3((float)i / 180, M.Cos(M.Deg2Rad * i) * .5f, 0) + offset;

            G.DrawLine(last, point);
            last = point;
        }
        //Draw Tangent
        if (showTan)
        {
            G.color = C.yellow;
            offset  = V3.down * 2 + V3.right * -1;
            last    = new V3(0, .5f, 0) + offset;
            for (int i = 1; i <= 360; i++)
            {
                V3 point = new V3((float)i / 180, M.Tan(M.Deg2Rad * i) * .5f, 0) + offset;

                G.DrawLine(last, point);
                last = point;
            }
        }
    }
示例#28
0
    /// <summary>
    /// Gets the final point score.
    ///
    /// Note: if the reach bou is not 0, the topest player will get it.
    ///       if more than 1 player has the same topest score, let the one who is the nearest EKaze.Ton be topest.
    /// </summary>

    public static List <PlayerTenbouChangeInfo> GetPointScore(List <Player> playerList, ref int reachBou)
    {
        List <Player> playerList_Sort = new List <Player>(playerList);

        playerList_Sort.Sort(SortPlayer);

        // topest player
        int topestPlayerIndex = 0;

        //马: 20-10 (20,10,-10,-20)
        int   ShunMa     = 10;
        int   BackTenbou = GameSettings.Back_Tenbou;
        float Base       = 1000f;
        int   TopBonus   = Math.FloorToInt((BackTenbou - GameSettings.Init_Tenbou) / Base * playerList.Count); //20pt


        if (reachBou > 0)
        {
            playerList_Sort[topestPlayerIndex].increaseTenbou(reachBou * GameSettings.Reach_Cost);
            reachBou = 0;
        }

        // calculate points
        List <PlayerTenbouChangeInfo> resultPointList = new List <PlayerTenbouChangeInfo>();
        int    totalPoint = 0;
        int    bonus      = 0;
        Player player;

        for (int i = 0; i < playerList_Sort.Count; i++)
        {
            player = playerList_Sort[i];

            bonus = (i == topestPlayerIndex)? TopBonus : 0;

            PlayerTenbouChangeInfo ptci = new PlayerTenbouChangeInfo();
            ptci.playerKaze = player.JiKaze;
            ptci.current    = player.Tenbou;
            ptci.changed    = Math.FloorToInt((player.Tenbou - BackTenbou) / Base + ((2 - i) * ShunMa) + bonus);

            resultPointList.Add(ptci);

            totalPoint += ptci.changed;
        }

        // adjust
        if (totalPoint != 0)
        {
            resultPointList[topestPlayerIndex].changed -= totalPoint;
        }

        return(resultPointList);
    }
示例#29
0
 /// <summary>
 /// Modeled after the piecewise overshooting cubic function:
 /// y = (1/2)*((2x)^3-(2x)*sin(2*x*pi))           ; [0, 0.5)
 /// y = (1/2)*(1-((1-x)^3-(1-x)*sin((1-x)*pi))+1) ; [0.5, 1]
 /// </summary>
 static public float BackEaseInOut(float p)
 {
     if (p < 0.5f)
     {
         float f = 2 * p;
         return(0.5f * (f * f * f - f * Math.Sin(f * PI)));
     }
     else
     {
         float f = (1 - (2 * p - 1));
         return(0.5f * (1 - (f * f * f - f * Math.Sin(f * PI))) + 0.5f);
     }
 }
示例#30
0
 public static float LerpBackwardUnclamped(float a, float b, float t)
 {
     a = Mathf.Repeat(a, 1f);
     b = Mathf.Repeat(b, 1f);
     if (a >= b)
     {
         return(Math.LerpUnclamped(a, b, t));
     }
     else
     {
         return(Mathf.Repeat(Math.LerpUnclamped(a + 1f, b, t), 1f));
     }
 }
示例#31
0
 static public int constructor(IntPtr l)
 {
     try {
         UnityEngine.Mathf o;
         o = new UnityEngine.Mathf();
         pushValue(l, o);
         return(1);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
示例#32
0
 public static int constructor(IntPtr l)
 {
     try {
         UnityEngine.Mathf o;
         o=new UnityEngine.Mathf();
         pushValue(l,o);
         return 1;
     }
     catch(Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return 0;
     }
 }