// Update is called once per frame void Update() { if (PhotonNetwork.isMasterClient) { if (uStationary.CurrentState != UnitStationary.AttackState.ATTACKFIRST) { uStationary.U2UMState(UnitStationary.AttackState.ATTACKFIRST); } } if (PhotonNetwork.isMasterClient && towerInfo.Dead) { //PhotonNetwork.Destroy(transform.FindChild("TowerTop").gameObject); } }
void Awake() { towerInfo = GetComponent <Unit>(); towerInfo.Init("Tower", "Tower", tag, 1, 3000.0, 0, 0, 100, 2, 1f, 0f, 30, 2, 0, 0, 500, 0, 0, 0, 0, 0, 150, 0, 300, 0); uStationary = GetComponent <UnitStationary>(); uStationary.U2UMState(UnitStationary.AttackState.ATTACKFIRST); towerTransform = gameObject.transform; towerTop = towerTransform.FindChild("TowerTop").transform.FindChild("TowerShooter"); firePosition = towerTop.FindChild("FirePosition"); backgroundTexture = new Texture2D(1, 1, TextureFormat.RGB24, false); backgroundTexture.SetPixel(0, 0, Color.black); backgroundTexture.Apply(); healthTexture = new Texture2D(1, 1, TextureFormat.RGB24, false); healthTexture.SetPixel(0, 0, Color.green); healthTexture.Apply(); }