void Start() { m_seeker = GetComponent <Seeker>(); m_rb = GetComponent <Rigidbody>(); m_arrow.x = 1f; if (GameObject.Find("GM")) { gm = GameObject.Find("GM").GetComponent <GMNet>(); } StartCoroutine(PlayerIn()); GetComponent <Platformer2DUserControl>().setController(this); sceneDist = Camera.main.GetComponent <Camera2DFollow>().getSceneDist(); }
IEnumerator PlayerIn() { yield return(new WaitForSeconds(1)); if (gm == null) { gm = GameObject.Find("GM").GetComponent <GMNet>(); StartCoroutine(PlayerIn()); } else { gm.PlayerIn(gameObject); StartCoroutine(UpdatePath()); StartCoroutine(enemyAlive()); } }
private void Reset() { print("Trying"); m_GM = GameObject.Find("GM"); if (m_GM == null) { toReset = true; return; } GMNet m_GMNet = m_GM.GetComponent <GMNet>(); isTeamParty = m_GMNet.isTeamParty(); toReset = false; gameObject.GetComponent <SpriteRenderer> ().enabled = true; balls = ballsIni = m_GMNet.initStones(); life = lifeIni = m_GMNet.initLife(); //print (balls + "b and l " + life); if (isLocalPlayer) { AfterReset = true; clearTxt(); m_StonesTxt.enabled = true; m_LifeTxt.enabled = true; SetLifeText(life); SetStonesText(balls); m_WinTxt.gameObject.SetActive(false); } ai = GetComponent <EnemyAI> (); if (ai != null && ai.enabled) { GetComponent <Platformer2DUserControl>().enabled = true; } else if (isServer) { GameObject.Find("GM").GetComponent <GMNet> ().PlayerIn(gameObject); } }