So lets say I am on example[3] I want to iterate to example[2] and only when a certain condition is met it will count down to array [2] but if I met a different condition it will count up to example[4] this is what I want to do so I can have 360 degrees coverage by my main camera on my player . help? I will post if I manage to solve my self
using UnityEngine;
using System.Collections;
public class CameraController : MonoBehaviour
{
public GameObject player;
private Vector3 offset;
Vector3[] bawb = new Vector3[4];
void Start()
{
offset = transform.position - player.transform.position;
bawb[1] = new Vector3(10, 10, 10);
bawb[2] = new Vector3(20, 20, 20);
bawb[3] = new Vector3(30, 30, 30);
bawb[4] = new Vector3(40, 40, 40);
//camera positions(^ are test vectors)
}
void Update()
{
if (Input.GetKeyDown("q"))
{
//condition to interate a array number up
}
else
{
if (Input.GetKeyDown("e"))
{
//condition to interate a number down
}
}
}
void LateUpdate()
{
transform.position = player.transform.position + offset;
//subtracting vectors to get preferd camera angle(no touchy >:( )
}
}