Tag Info

Hot answers tagged

4

Long ago I did the math for different growth functions for an RPG (that I didnĀ“t use in the end). I was playing around with five basic growth curves, as show below. The curves are: Red: Exponential. Grows slowly at the beginning, very fast at the end. Blue: Quadratic. Average growth curve. Black: Linear. Green: Flipped quadratic. Grows more slowly with ...


3

With so many timers, you are better off with setting ExpirationTime for each of your events. When you need to start a "timer" set the events expiration time to "now" + "timer duration". Then add just one timer that will run e.g. each second and check all the "expiration times" and fire events when their time has come.


3

Fly along circular arcs You start at x1, moving in the direction v1 and want to end up at x2 facing in v2, then the shortest path (assuming a finite turning radius, which realistically should be proportional to the square of the velocity) takes you along an arc of radius r1around m1, followed by a straight line segment and then another arc of radius ...


2

To expand on OP's answer: the crucial difference is the use of FindObjectOfType versus FindObjectsOfType. FindObjectOfType returns a single object. FindObjectsOfType returns an array of objects. Linq's OfType extension method requires an enumerable collection (such as an array), which is why you were seeing that error and why switching calls fixed it.


2

Your question is very unclear. You can use prefabs if you copy from them into your sprites instead of referencing. This way sprites you get will be independent from prefabs after creation, so you can change prefabs and sprites will remain as they were made.


2

Add a flag to determine if the player has been stopped. At that point, stop setting the players position to the camera's, and instead some other input. public float speed; public test testing; bool stopped = false; // Use this for initialization void Start () { speed = 10f; testing = Camera.main.GetComponent<test>(); } // Update is called ...


1

You could use a logarithmic function: Example function: double increment = Math.Log(level + 1); Example output: Level 1 increment: 0.693147180559945 Level 2 increment: 1.09861228866811 Level 3 increment: 1.38629436111989 Level 4 increment: 1.6094379124341 Level 5 increment: 1.79175946922805 Level 6 increment: ...


1

I would check your scale. Physics in Unity are designed to work at real life scales (1 unit = 1 meter) If you create a scene that is not to the correct scale, you are going to have a terrible time getting it to look correct. Example: Lets assume your ball is supposed to be a basketball. A standard basketball is 23cm (0.23m) If you build everything to ...


1

This is a selection functionality but you could easily include your own rules. First, it's important that you define a tag for the selection group. In case there are more than one selection group in a scene at a time, there should be more than one tag defined for the groups. SelectionButton.cs using UnityEngine; using System.Collections; public class ...


1

I would add some AI (artificial intelligence) checks. A first thing to do would be to check if the distance to travel, in comparison with the distance to the enemy makes sense to apply the Bezier curves. For example, you could make the weight (i.e.: distance from the end point to the control point of the Bezier curve) depend on the distance travelled and the ...



Only top voted, non community-wiki answers of a minimum length are eligible