void Awake() { gameStartScript = battleGameStartObject.GetComponent<BattleGameStartScript>(); messageObject = GameObject.Find("Message").GetComponent<Text>(); //マスターサーバーへ接続 Debug.Log("マスターサーバーへ接続します"); sendMessage("CONNECT SERVER"); PhotonNetwork.ConnectUsingSettings("v0.1"); }
// Use this for initialization void Start() { gameStartObj = GameObject.Find("GameStartObj"); if (gameStartObj != null) { if (gameStartObj.GetComponent<BattleGameStartScript>() != null) { battleGameStartScript = gameStartObj.GetComponent<BattleGameStartScript>(); } if (gameStartObj.GetComponent<NewGameStartScript>() != null) { gameStartScript = gameStartObj.GetComponent<NewGameStartScript>(); } } gameTopObj = GameObject.Find("GameTopManager"); if (gameTopObj != null) { gameTopScript = gameTopObj.GetComponent<GameTopScript>(); } }
void Start() { battleEnemyScript = this.gameObject.GetComponent <BattleEnemyScript>(); GameObject gameStartObj = GameObject.Find("GameStartObj"); battleGameStartScript = gameStartObj.GetComponent<BattleGameStartScript>(); }
// Use this for initialization void Start() { this.gameObject.GetComponent<Rigidbody2D>().isKinematic = true; GameObject obj = GameObject.Find("GameStartObj"); gameStartScript = obj.GetComponent<BattleGameStartScript>(); updateDefaultSettings(); sr = this.gameObject.GetComponent<SpriteRenderer>(); canvasObject = GameObject.Find("Canvas"); if (!photonView.isMine) { //scriptを削除 if (this.gameObject.GetComponent<BattleCharaScript>() != null) { BattleCharaScript bcs = this.gameObject.GetComponent<BattleCharaScript>(); Destroy(bcs); } charaDefaultPositionX = this.gameObject.transform.localPosition.x; string charaNumberStringDefault = this.gameObject.name; string charaNumberString = charaNumberStringDefault.Replace("Character", ""); charaNumberString = charaNumberString.Replace("(Clone)", ""); Debug.Log("CHARA NUMBER STRING:" + charaNumberString); enemyCharaNumber = int.Parse(charaNumberString); enemyProgressObject = GameObject.Find("ProgressEnemy"); enemyProgressObject.GetComponent<Image>().sprite = Resources.Load <Sprite> ("Image/Character/Chara" + charaNumberString.ToString() + "/head"); //キャラの位置をずらす this.gameObject.transform.localPosition = new Vector3(2.1f, -8.05f, -1f); if (enemyCharaNumber == 3) { this.gameObject.transform.localScale = new Vector3(-0.0026f, 0.0026f, 0.0026f); } else if (enemyCharaNumber == 4) { this.gameObject.transform.localScale = new Vector3(-0.0018f, 0.0018f, 0.0018f); } else { this.gameObject.transform.localScale = new Vector3(-0.0018f, 0.0018f, 0.0018f); } this.gameObject.GetComponent<Rigidbody2D>().isKinematic = false; int charaNumber = gameStartScript.charaNumber; if (charaNumber.ToString() == charaNumberString) { isSameCharacter = true; //オブジェクトにマテリアルを追加 Material glayMaterial = (Material) Resources.Load("Material/GlayMaterial"); enemyProgressObject.GetComponent<Image>().material = glayMaterial; } //Canvasの子要素として登録する enemyProgressObject.transform.SetParent (canvasObject.transform, false); } else { this.gameObject.GetComponent<Rigidbody2D>().isKinematic = false; } //photon network networkPlayerScript = this.gameObject.GetComponent <NetworkPlayerScript>(); }
// Use this for initialization void Start() { GameObject obj = GameObject.Find("GameStartObj"); gameStartScript = obj.GetComponent<BattleGameStartScript>(); updateDefaultSettings(); sr = this.gameObject.GetComponent<SpriteRenderer>(); charaDefaultPositionX = this.gameObject.transform.localPosition.x; progressObject = GameObject.Find("ProgressChara"); GameObject hpObject1 = GameObject.Find("item_heart1"); GameObject hpObject2 = GameObject.Find("item_heart2"); GameObject hpObject3 = GameObject.Find("item_heart3"); hpObject.Add(hpObject1); hpObject.Add(hpObject2); hpObject.Add(hpObject3); //photon network networkPlayerScript = this.gameObject.GetComponent <NetworkPlayerScript>(); }