ive been tryed for months , and i did turn around that rpoblem to fix the things i had to fix but this time i cant , here the situation …
i want that when the player press the action button on the keyboard , it activate the script in part 1 , and do the same changes in part 2 , wich mean i mean i want that in the script part 2 , the variable launch turn true when the variable act is true on part 1
part1 script
using UnityEngine;
using System.Collections;
public class part1 : MonoBehaviour
{
public bool act = false;
private int delay = 0;
public int MaxTime = 0;
private bool maxed = false;
private bool changer = false;
private Material material;
public Renderer target;
public Material[] Cond = new Material[2];
void Start()
{
Transform curTransform;
curTransform = gameObject.GetComponent<Transform>();
curTransform = gameObject.transform;
}
// Update is called once per frame
void Update ()
{
if (maxed == false)
{
if (delay < MaxTime)
{
delay++;
}
else if (delay >= MaxTime)
{
delay = 0;
maxed = true;
}
}
else if (maxed == true)
{
if(Input.GetKeyDown(KeyCode.Space))
{
changer = false;
}
}
if (changer == false)
{
changer = true;
if (act == false)
{
target.renderer.material = Cond[0];
act = true;
maxed = false;
}
else if (act == true)
{
target.renderer.material = Cond[1];
act = false;
maxed = false;
}
}
}
}
part 2 script
using UnityEngine;
using System.Collections;
public class part2 : MonoBehaviour
{
public bool launch = false;
private Material material;
public Renderer target;
public Material[] Cond = new Material[2];
// Update is called once per frame
void Update ()
{
if (launch == false)
{
target.renderer.material = Cond[0];
//launch = true;
}
if (launch == true)
{
target.renderer.material = Cond[1];
//launch = false;
}
}
}
i just want to know , in a simple way how to turn launch at true , whitout doign some transform things or getcam and things i ended up in tutorials since those months who never worked … and so many people sent me that page (http://unity3d.com/support/documentation/ScriptReference/GameObject.GetComponent.html) … look im french , i can deal with english … but with things in this age i still cant do it … and its the 30 tiem i get this page … i just want an answer not this page anymore
thank you