// Use this for initialization void Start() { head = GameObject.Find("head").GetComponent <Snake_head>(); btUp = GameObject.Find("ButtonUp").GetComponent <Button>(); btUp.onClick.AddListener(MoveUp); btDown = GameObject.Find("ButtonDown").GetComponent <Button>(); btDown.onClick.AddListener(MoveDown); btLeft = GameObject.Find("ButtonLeft").GetComponent <Button>(); btLeft.onClick.AddListener(MoveLeft); btRight = GameObject.Find("ButtonRight").GetComponent <Button>(); btRight.onClick.AddListener(MoveRight); btAttack = GameObject.Find("ButtonAttack").GetComponent <Button>(); btAttack.onClick.AddListener(Attack); btSupAttack = GameObject.Find("ButtonSupperAttack").GetComponent <Button>(); btSupAttack.onClick.AddListener(SupperAttack); btShield = GameObject.Find("ButtonShield").GetComponent <Button>(); btShield.onClick.AddListener(Shield); btAddHealth = GameObject.Find("ButtonAddHealth").GetComponent <Button>(); btAddHealth.onClick.AddListener(AddHealth); btMagnet = GameObject.Find("ButtonMagnet").GetComponent <Button>(); btMagnet.onClick.AddListener(Magnet); //disBtSupAttack = GameObject.Find("ButtonMagnet").GetComponent<Button>(); }
// Use this for initialization void Start() { //Debug.Log("start"); cflag++; if (instance == null) { instance = this; } InitGame(); animator = GetComponent <Animator> (); t = (GameObject)Instantiate(tPrefab, new Vector2(transform.position.x - 0.5f, transform.position.y), Quaternion.identity); Invoke("Move", initSpeed); //UpdateHealthBar (); }