private void CalculateInitialSourceInstancePositionGameObjectValues(UcSourceInstance sourceInstance) { sourceInstance.PropertyChanged += this.SourceInstance_PropertyChanged; sourceInstance.ExodusSourceInstanceGameObject.Width = sourceInstance.Width * this._pixelToUnityUnitScale; sourceInstance.ExodusSourceInstanceGameObject.Height = sourceInstance.Height * this._pixelToUnityUnitScale; sourceInstance.ExodusSourceInstanceGameObject.Depth = 0.5f; sourceInstance.ExodusSourceInstanceGameObject.X = (sourceInstance.X * this._pixelToUnityUnitScale) + (sourceInstance.ExodusSourceInstanceGameObject.Width / 2) + (this.ExodusWallGameObject.X - this.ExodusWallGameObject.Width / 2); sourceInstance.ExodusSourceInstanceGameObject.Y = (this.ExodusWallGameObject.Y * 2) - (sourceInstance.ExodusSourceInstanceGameObject.Height / 2) - (sourceInstance.Y * this._pixelToUnityUnitScale); sourceInstance.ExodusSourceInstanceGameObject.Z = 29.5f; }
private void SourceInstance_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) { UcSourceInstance sourceInstance = sender as UcSourceInstance; if (sourceInstance == null) { return; } switch (e.PropertyName.ToLowerInvariant()) { case "x": sourceInstance.ExodusSourceInstanceGameObject.X = (sourceInstance.X * this._pixelToUnityUnitScale) + (sourceInstance.ExodusSourceInstanceGameObject.Width / 2) + (this.ExodusWallGameObject.X - this.ExodusWallGameObject.Width / 2); break; case "y": sourceInstance.ExodusSourceInstanceGameObject.Y = (this.ExodusWallGameObject.Y * 2) - (sourceInstance.ExodusSourceInstanceGameObject.Height / 2) - (sourceInstance.Y * this._pixelToUnityUnitScale); break; case "z": sourceInstance.ExodusSourceInstanceGameObject.Z = 29f; break; case "width": sourceInstance.ExodusSourceInstanceGameObject.Width = sourceInstance.Width * this._pixelToUnityUnitScale; sourceInstance.ExodusSourceInstanceGameObject.X = (sourceInstance.X * this._pixelToUnityUnitScale) + (sourceInstance.ExodusSourceInstanceGameObject.Width / 2) + (this.ExodusWallGameObject.X - this.ExodusWallGameObject.Width / 2); break; case "height": sourceInstance.ExodusSourceInstanceGameObject.Height = sourceInstance.Height * this._pixelToUnityUnitScale; sourceInstance.ExodusSourceInstanceGameObject.Y = (this.ExodusWallGameObject.Y * 2) - (sourceInstance.ExodusSourceInstanceGameObject.Height / 2) - (sourceInstance.Y * this._pixelToUnityUnitScale); break; case "depth": sourceInstance.ExodusSourceInstanceGameObject.Depth = 0.2f; break; } }