I'm using unity3D, so my queue is made up of GameObjects, there are 7 GameObjects queued next to each other and my purpose with this code is that with every click of the user - " SimpleMove Function "- the objects move forward, except the last one, it must assume the last position.
In Unity it is possible to associate GameObjects with the interface, so consider the two arrays already full at the beginning.
I would like help in understanding and developing the logic in the "SimpleMove Function" that makes this move. Thanks
using UnityEngine;
using System.Collections;
public class StairsController : MonoBehaviour {
public GameObject[] degrau;
Vector3[] positionArray = new Vector3[7];
private int i = 6;
private int a = 6;
// Use this for initialization
void Start () {
positionArray [i-6] = degrau[a-6].transform.position;
Debug.Log (positionArray [i-6]);
positionArray [i-5] = degrau[a-5].transform.position;
Debug.Log (positionArray [i-5]);
positionArray [i-4] = degrau[a-4].transform.position;
Debug.Log (positionArray [i-4]);
positionArray [i-3] = degrau[a-3].transform.position;
Debug.Log (positionArray [i-3]);
positionArray [i-2] = degrau[a-2].transform.position;
Debug.Log (positionArray [i-2]);
positionArray [i-1] = degrau[a-1].transform.position;
Debug.Log (positionArray [i-1]);
positionArray [i] = degrau[a].transform.position;
Debug.Log (positionArray [i]);
}
public void SimpleMov (){
degrau [a].transform.position = positionArray [i - 1];
}
}