void Awake() { if (instance != null) { Destroy(this); } else { instance = this; } }
void Start() { //LineRendererSetup(); freeFly = false; rayToMouse = new Ray(catapult.position, Vector3.zero); catapultToProjectile = new Ray(catapultLine.transform.position, Vector3.zero); maxStretchSqr = maxStretch * maxStretch; GetComponent <Rigidbody2D>().isKinematic = true; dc = GetComponent <DigController>(); ableToMove = true; }
void Start() { digController = DigController.instance; m_GroundCheck = transform.Find("GroundCheck"); m_CeilingCheck = transform.Find("CeilingCheck"); rigidbody2D = GetComponent <Rigidbody2D> (); m_HealthController = GetComponent <HealthController>(); gravity = rigidbody2D.gravityScale; meshGameObject = GetComponentInChildren <MeshRenderer>().gameObject; }
void Start() { // if (connector == null){ // connector = GameObject.Find("ConnectorManager").GetComponent<ConnectorManager>(); // } instance = this; GameObject g = GameObject.Find("ConnectorManager"); if (g == null) { connector.gameObject.SetActive(true); soundManager.gameObject.SetActive(true); GameObject.DontDestroyOnLoad(connector.gameObject); GameObject.DontDestroyOnLoad(soundManager.gameObject); isOnLocalTest = true; } else { connector = g.GetComponent <ConnectorManager>(); soundManager = GameObject.Find("SoundManager").GetComponent <SoundManager>(); } connector.gameController = this; soundManager.PlayBGM("062"); if (uiController == null) { uiController = GameObject.Find("UIController").GetComponent <UIController>(); uiController.SetLoadingScreen(true); } try { playerIdCache = null; if (foreController == null) { Debug.Log("Finding bg: " + GameObject.Find("Foreground")); foreController = GameObject.Find("Foreground").GetComponent <ForegroundController>(); } if (backgroundSprite == null) { Debug.Log("Finding bg: " + GameObject.Find("Background")); backgroundSprite = GameObject.Find("Background").GetComponent <SpriteRenderer>(); } // no ExplosionController assigned if (explosionController == null) { try{ explosionController = GameObject.Find("ExplosionController").GetComponent <ExplosionController>(); } catch (Exception e) { Debug.Log("No explosionController : " + e.ToString()); } } if (mainCamController == null) { mainCamController = GameObject.Find("MainCamera").GetComponent <CameraController>(); mainCamController.UpdateClamp(foreController.bottomLeftPosition, foreController.topRightPosition); } if (minimapCamController == null) { minimapCamController = GameObject.Find("MinimapCamera").GetComponent <CameraController>(); } if (countDownController == null) { countDownController = GameObject.Find("CountDownController").GetComponent <CountDownController>(); } countDownController.ToggleObject(false); // no DigController assigned if (digController == null) { try{ digController = GameObject.Find("DigController").GetComponent <DigController>(); } catch (Exception e) { Debug.Log("No digController : " + e.ToString()); } } foreach (PlayerInfo inf in connector.playerInfos) { // Debug.Log(inf); if (inf.team == 2) { ((FightUIController)uiController).LoadBluePlayerPreview(inf); } else { ((FightUIController)uiController).LoadRedPlayerPreview(inf); } } // if (isOnLocalTest){ // bool res = ConnectHost("127.0.0.1"); // if (res){ // StartMatch(); // // isOnLocalTest = false; // }else{ // Debug.Log(" Cannot simulate login "); // } // } Debug.Log("Fight Scene "); } catch (Exception e) { isOnLocalTest = false; Debug.Log("Not Fight Scene : " + e.ToString()); } isStarted = true; connector.isSceneTransforming = false; Scene tmpScene = SceneManager.GetSceneByName("temp"); if (tmpScene.IsValid()) { SceneManager.UnloadSceneAsync("temp"); } Debug.Log("[GameController] START DONE"); }
void Start() { digController = FindObjectOfType <DigController>(); }