private void Start() { Instance = this; inventory_chessman_num = new int[] { 0, 0, 0, 0, 0, 0 }; inventory_chessman_total_num = new int[] { 0, 0, 0, 0, 0, 0 }; bgm = GetComponents <AudioSource>(); }
void OnTriggerStay2D(Collider2D col1) { if (col1 == RobotCollider || col1 == ProfCollider) { if (!pressed && Math.Abs(col1.transform.position.x - Button.transform.position.x) < 0.3) { pressed = true; col1.gameObject.transform.Translate(0, 0.15f, 0); ButtonManagerScript.ButtonChange(buttonName, pressed); } } }
private void Update() { if (pressed && translateButton < 15) { Button.transform.Translate(0, -0.015f, 0); translateButton++; } else if (!pressed && translateButton > 0) { Button.transform.Translate(0, 0.015f, 0); translateButton--; } if (pressedOld != pressed) { pressedOld = pressed; ButtonManagerScript.ButtonChange(name, pressed); } }
private void Update() { if (groupe == 1) { allPressed = ButtonManagerScript.stateButtonMulti1(); } else if (groupe == 2) { allPressed = ButtonManagerScript.stateButtonMulti2(); } if (allPressed) { pressed = true; } if (pressed && translateButton < 15) { Button.transform.Translate(0, -0.015f, 0); translateButton++; } if (allPressed) { return; } else if (!pressed && translateButton > 0) { Button.transform.Translate(0, 0.015f, 0); translateButton--; } if (pressedOld != pressed) { pressedOld = pressed; ButtonManagerScript.ButtonChange(name, pressed); } }
// Use this for initialization void Start() { original = transform.position; mg = GameObject.FindGameObjectWithTag("ButtonManager").GetComponent <ButtonManagerScript>(); gameObject.GetComponent <Button>().onClick.AddListener(Press); }
// Set color, initalize shortcuts private void Start() { gameObject.GetComponent <Renderer>().material.SetColor("_Color", Color.gray); ButtonManager = GameObject.Find("ButtonManager").GetComponent <ButtonManagerScript>(); SelectorManager = GameObject.Find("Plane").GetComponent <SelectorManagerScript>(); }