this is supposed to spawn different characters and set the z axis and some bools from another script. for some reason its not changing the value of the bool, does anyone know why?
public dimension_counter dimcount;
private GameObject firstperson;
private GameObject thirdperson;
private GameObject twod;
private GameObject fperson;
private GameObject tperson;
private GameObject td;
Vector3 zaxis;
// Use this for initialization
private void Awake()
{
firstperson = Resources.Load(“firstpersonplayer”) as GameObject;
thirdperson = Resources.Load(“thirdpersonplayer”) as GameObject;
twod = Resources.Load(“player”) as GameObject;
dimcount = GameObject.Find(“dimensionmanager”).GetComponent<dimension_counter>();
}
void Start () {
fperson = GameObject.Find(“firstpersonplayer”);
tperson = GameObject.Find(“thirdpersonplayer”);
td = GameObject.Find(“player”);
}
// Update is called once per frame
void Update () {
if (fperson == null) {
dimcount.firstdimension = false;
}
if (tperson == null)
{
dimcount.seconddimension = false;
}
if (td == null)
{
dimcount.thirddimension = false;
}
if (fperson != null)
{
dimcount.firstdimension = true;
}
if (tperson != null)
{
dimcount.seconddimension = true;
}
if (td != null)
{
dimcount.thirddimension = true;
}
if (Input.GetKeyDown(KeyCode.I) && dimcount.firstdimension == false) {
if (dimcount.thirddimension == true)
{
gameObject.transform.position += new Vector3(0, 0, zaxis.z);
}
Instantiate(firstperson, transform.position, Quaternion.identity);
dimcount.thirddimension = false;
dimcount.seconddimension = false;
dimcount.firstdimension = true;
Destroy(gameObject);
}
if (Input.GetKeyDown(KeyCode.O) && dimcount.seconddimension == false)
{
if (dimcount.thirddimension == true) {
gameObject.transform.position += new Vector3(0,0, zaxis.z);
}
Instantiate(thirdperson, transform.position, Quaternion.identity);
dimcount.thirddimension = false;
dimcount.seconddimension = true;
dimcount.firstdimension = false;
Destroy(gameObject);
}
if (Input.GetKeyDown(KeyCode.P) && dimcount.thirddimension == false)
{
zaxis = gameObject.transform.position;
Instantiate(twod, new Vector3(transform.position.x, transform.position.y,0), Quaternion.identity);
dimcount.thirddimension = true;
dimcount.seconddimension = false;
dimcount.firstdimension = false;
Destroy(gameObject);
}
}