private void DestroySkin() { if (this.currentSkin != null) { this.currentSkin.Destroy(this); this.currentSkin = null; } }
private void DestroySkin() { if (!Object.op_Inequality((Object)this.currentSkin, (Object)null)) { return; } this.currentSkin.Destroy(this); this.currentSkin = (ConstructionSkin)null; }
public void ChangeSkin(GameObjectRef prefab) { bool flag1 = this.lastGrade != this.grade; this.lastGrade = this.grade; if (flag1) { if (Object.op_Equality((Object)this.currentSkin, (Object)null)) { this.UpdatePlaceholder(false); } else { this.DestroySkin(); } this.currentSkin = (ConstructionSkin)this.gameManager.CreatePrefab(prefab.resourcePath, ((Component)this).get_transform(), true).GetComponent <ConstructionSkin>(); Model component = (Model)((Component)this.currentSkin).GetComponent <Model>(); this.SetModel(component); Assert.IsTrue(Object.op_Equality((Object)this.model, (Object)component), "Didn't manage to set model successfully!"); } if (this.isServer) { this.modelState = this.currentSkin.DetermineConditionalModelState(this); } bool flag2 = this.lastModelState != this.modelState; this.lastModelState = this.modelState; if (flag1 | flag2 || this.forceSkinRefresh) { this.currentSkin.Refresh(this); this.forceSkinRefresh = false; } if (!this.isServer) { return; } if (flag1) { this.RefreshNeighbours(true); } if (!flag2) { return; } this.SendNetworkUpdate(BasePlayer.NetworkQueue.Update); }
public void ChangeSkin(GameObjectRef prefab) { bool flag = this.lastGrade != this.grade; this.lastGrade = this.grade; if (flag) { if (this.currentSkin != null) { this.DestroySkin(); } else { this.UpdatePlaceholder(false); } GameObject gameObject = base.gameManager.CreatePrefab(prefab.resourcePath, base.transform, true); this.currentSkin = gameObject.GetComponent <ConstructionSkin>(); Model component = this.currentSkin.GetComponent <Model>(); base.SetModel(component); Assert.IsTrue(this.model == component, "Didn't manage to set model successfully!"); } if (base.isServer) { this.modelState = this.currentSkin.DetermineConditionalModelState(this); } bool flag1 = this.lastModelState != this.modelState; this.lastModelState = this.modelState; if (flag | flag1 || this.forceSkinRefresh) { this.currentSkin.Refresh(this); this.forceSkinRefresh = false; } if (base.isServer) { if (flag) { this.RefreshNeighbours(true); } if (flag1) { base.SendNetworkUpdate(BasePlayer.NetworkQueue.Update); } } }
public void ChangeSkin(GameObjectRef prefab) { bool flag = lastGrade != grade; lastGrade = grade; if (flag) { if (currentSkin == null) { UpdatePlaceholder(false); } else { DestroySkin(); } GameObject gameObject = base.gameManager.CreatePrefab(prefab.resourcePath, base.transform); currentSkin = gameObject.GetComponent <ConstructionSkin>(); Model component = currentSkin.GetComponent <Model>(); SetModel(component); Assert.IsTrue(model == component, "Didn't manage to set model successfully!"); } if (base.isServer) { modelState = currentSkin.DetermineConditionalModelState(this); } bool flag2 = lastModelState != modelState; lastModelState = modelState; if (flag || flag2 || forceSkinRefresh) { currentSkin.Refresh(this); forceSkinRefresh = false; } if (base.isServer) { if (flag) { RefreshNeighbours(true); } if (flag2) { SendNetworkUpdate(); } } }