This task ended up being a bit harder than I had initially anticipated it to be. I thought it would be easy where I would simply add some motions and some art, but I had to work through some of the legacy code to get there. I had to redo how the transition worked, so it moved from a timed state to being controlled by the transition. I then had to add the slot machine, and because of the motions, I had to change how some of the slots worked. Now, instead of just instantiating objects, I also have to parent them and change their local rotation. It took a lot of testing to make it work which ate up a lot of time, and testing was difficult because I had to wait through minigames while testing.
For the motions, I added a spining around a planet (not that much motion for the Drexel Ride) and a bob up and down (which should add motion to the drexel ride).
Here is the bobbing code.
using UnityEngine;
using System.Collections;
public class UpAndDown : MonoBehaviour {
/// <summary>
/// This Script will make the camera bob up and down.
/// </summary>
private bool goUp = true;
public float maxUp = 10f;
private float maxDown;
public float changeSpeed = 1f;
private Rigidbody RB;
// Use this for initialization
void Start ()
{
maxDown = transform.localPosition.y;
maxUp += maxDown;
RB = GetComponent<Rigidbody>();
}
// Update is called once per frame
void Update ()
{
if (goUp)
{
RB.velocity = (changeSpeed * transform.up);
}
else
{
RB.velocity = (changeSpeed * transform.up * -1);
}
if (transform.localPosition.y > maxUp) goUp = false;
if (transform.localPosition.y < maxDown) goUp = true;
}
}
This is how the transition works now. It will rotate you around a small planet and charge you into a circus. Once inside the screen is black. If you have to choose new minigames, it will stop you half way so you can choose the next games.
(6 hours)
Positives
I got what I wanted to get done done.
Negatives
It turned out to be harder than I thought and I spent a lot of time debugging.
No comments:
Post a Comment