void Start() { ROFL.GetComponent <UILabel> ().text = "Rate of Fire: " + (gameObject.GetComponent <TurretControl> ().TimeBetweenShotsInSec * 100).ToString(); HPDealtL.GetComponent <UILabel> ().text = "HP Dealt on Hit: " + gameObject.GetComponent <TurretControl> ().HPOnHit.ToString(); HitPercentL.GetComponent <UILabel> ().text = "Hit Percentage: " + (gameObject.GetComponent <TurretControl> ().HitPercentage * 100).ToString() + "%"; RangeL.GetComponent <UILabel> ().text = "Attack Range: " + (gameObject.GetComponent <TurretControl> ().Range * 100).ToString() + "M"; TypeL.GetComponent <UILabel> ().text = "Projectile Type: " + gameObject.GetComponent <TurretControl> ().ProjectileType.ToString(); NameL.GetComponent <UILabel> ().text = gameObject.GetComponent <TurretControl> ().TowerType.ToString(); RotationL.GetComponent <UILabel> ().text = "Rotation Speed: " + gameObject.GetComponent <TurretControl> ().RotationSpeed.ToString(); NGUITools.SetActive(TD, false); }
/// <summary> /// 指定色のグリッドエリアの落下を開始 /// ※RigitBodyのFreezePosition(y)を解除 /// </summary> /// <param name="color"></param> public void StartFall(DataBase.COLOR color) { List <Grid> list = null; // 判定するリストが何色か判定 switch (color) { case DataBase.COLOR.RED: list = reds; break; case DataBase.COLOR.BLUE: list = blues; break; case DataBase.COLOR.GREEN: list = greens; break; case DataBase.COLOR.YELLOW: list = yellows; break; } // リストのnull判定 if (list == null) { return; } // 落下処理 foreach (var it in list) { Transform parent = it.transform.parent; TypeL typeL = parent.GetComponent <TypeL>(); if (typeL) { //Positionのyのみ解除 RigidbodyConstraints mask = RigidbodyConstraints.FreezeRotation | RigidbodyConstraints.FreezePositionX | RigidbodyConstraints.FreezePositionZ; //マスクの割り当て typeL.SetConstraints(mask); return; } } }
/// <summary> /// グリッドのResetZoneの衝突 /// </summary> /// <param name="other"></param> private void HitGrid(Collider other) { //親オブジェクト var parent = other.GetComponent <Grid>().gameObject.transform.parent; //親オブジェクトに付いているTypeL取得 TypeL typeL = parent.GetComponent <TypeL>(); if (typeL) { // All Freeze! RigidbodyConstraints mask = RigidbodyConstraints.FreezeAll; typeL.SetConstraints(mask); typeL.ResetPosition(); typeL.StartRevival(); } }