ParticleMove

This controls all of the various movement types for particles shooting at Frothy Bird. The physics engine is not generally used in this game, as everything needed to be precisely moved and timed. Each particle is assigned a movement type that is selected from the switch statement, and that particle has all of the required parameters to make the particle move as planned with the script below.

public float particleSpeed; //the speed of particles (will have a mutliplier applied later)

public MovementType.choose myMovementType;

//Terms used for various movement types public Vector3 originVector; public Vector3 finalVector; [HideInInspector] public float linearSlope; [HideInInspector] public float linearIntercept; public Vector3 parabolaVertex; //The (h,k) in x = a(y - k)^2 + h. Entered in the Unity Editor. [HideInInspector] float parabolaFactor; // The a in x = a(y - k)^2 + h public float sineAmplitude; //Will be adjusted in inspector as needed. public float sinePeriodFactor; //Will be adjusted in inspector as needed. [HideInInspector] public float startTime; //Time when class started running. [HideInInspector] public float distanceAlongCurve; //The calculated distance along a curve. Always assume z is constant. [HideInInspector] public Vector3 nextLocation; //The location the object will move to during this update cycle. [HideInInspector] public float distanceThisCycle; //The distance to travel in one update cycle. [HideInInspector] public float nextX; [HideInInspector] public float nextY; [HideInInspector] public float nextZ; [HideInInspector] public float deltaX; //The change in X for this one update cycle. [HideInInspector] public float deltaY; //The change in Y for this one update cycle. [HideInInspector] public int xSign; //The direction x unity of the direction we will be travelling in the x-direction [HideInInspector] public int ySign; //Same as above, but for y [HideInInspector] public bool xIsDone; //x-coordinate has been achieved; [HideInInspector] public bool yIsDone; //y-coordinate has been achieved; private Vector3 hoverPoint; public bool particleHover; private bool doneHovering; private float hoverTime; private float elapsedHoverTime; private GameObject blobCore; private List<Vector3> blobDeltas = new List<Vector3>(); private bool linkedMovement; //Indicates that this particle's movement is tied to another particle and not independent at the time. [HideInInspector] public bool ballBounced; //This particle has bounced. Useful to find when the core ball of the blob has bounced as well. [HideInInspector] public bool particleSettled; //Particle is settled on the ground. public float settleTime; //How long the particle will remain settled (on the ground) public float timeSettledSoFar; public bool doneSettling; private float figure8focus; private float figure8vertShift; private float theta; private float radius; private bool orbitStarted; private bool orbitComplete; private bool onePassComplete; //Have completed one full pass of an orbit, so ready to launch at Frothy private GameObject leadParticle; //If a movement type (e.g. linear double) needs to follow a lead particle, this is its lead.

private Vector3 bigStartingSize; private Vector3 finalShrinkScale; //What size the particle will be after shrinking --- when it hits frothy's mouth.

private List<Vector3> zigZagPositions = new List<Vector3> (); //Contains all positions to be used for zig zag public static float biggestZigDistance; //Note that biggestZigDistance is reset to zero at each level transition. This is the biggest zig 1 and 2 combo yet in the level. private int zigCounter; //Counts which segment of the zig we are on (index of zigZagPositions)