public override void AttachEditorComponents(Entity entity, Main main) { ModelAlpha model = new ModelAlpha(); model.Filename.Value = "AlphaModels\\light"; model.Color.Value = this.Color; model.Serialize = false; model.Scale.Value = new Vector3(1, 1, -1); model.Add(new Binding <Matrix>(model.Transform, entity.Get <Transform>().Matrix)); entity.Add("EditorModel", model); model.Add(new Binding <bool>(model.Enabled, Editor.EditorModelsVisible)); VoxelAttachable.AttachEditorComponents(entity, main); ModelAlpha offsetModel = new ModelAlpha(); offsetModel.Filename.Value = "AlphaModels\\cone"; offsetModel.Add(new Binding <Vector3>(offsetModel.Color, model.Color)); CameraStop cameraStop = entity.Get <CameraStop>(); offsetModel.Add(new Binding <bool>(offsetModel.Enabled, () => entity.EditorSelected && cameraStop.Offset != 0 && Editor.EditorModelsVisible, entity.EditorSelected, cameraStop.Offset, Editor.EditorModelsVisible)); offsetModel.Add(new Binding <Vector3, float>(offsetModel.Scale, x => new Vector3(1, 1, x), cameraStop.Offset)); offsetModel.Add(new Binding <Matrix>(offsetModel.Transform, model.Transform)); offsetModel.Serialize = false; entity.Add("EditorModel3", offsetModel); EntityConnectable.AttachEditorComponents(entity, "Next", cameraStop.Next); }
public override void AttachEditorComponents(Entity entity, Main main) { base.AttachEditorComponents(entity, main); Scriptlike.AttachEditorComponents(entity, main, this.Color); EntityConnectable.AttachEditorComponents(entity, "Target", entity.Get <Setter>().Target); }
public override void AttachEditorComponents(Entity entity, Main main) { base.AttachEditorComponents(entity, main); VoxelAttachable.AttachEditorComponents(entity, main, entity.Get <Model>().Color); EntityConnectable.AttachEditorComponents(entity, "Target", entity.Get <VoxelFill>().Target); }
public override void AttachEditorComponents(Entity entity, Main main) { base.AttachEditorComponents(entity, main); Scriptlike.AttachEditorComponents(entity, main, this.Color); EntityConnectable.AttachEditorComponents(entity, "Input1Target", entity.Get <LogicGate>().Input1Target); EntityConnectable.AttachEditorComponents(entity, "Input2Target", entity.Get <LogicGate>().Input2Target); }
private static void attachEditorComponents(Entity entity, Main main, bool directional) { Transform transform = entity.Get <Transform>(); Components.Joint joint = entity.Get <Components.Joint>(); EntityConnectable.AttachEditorComponents(entity, "Parent", joint.Parent); if (directional) { ModelAlpha model = new ModelAlpha(); model.Filename.Value = "AlphaModels\\cone"; model.Serialize = false; model.Add(new Binding <bool>(model.Enabled, Editor.EditorModelsVisible)); entity.Add("DirectionModel", model); Transform mapTransform = entity.Get <Transform>("MapTransform"); model.Add(new Binding <Matrix>(model.Transform, delegate() { Matrix m = Matrix.Identity; m.Translation = transform.Position; if (joint.Direction == Direction.None) { m.Forward = m.Right = m.Up = Vector3.Zero; } else { Vector3 normal = Vector3.TransformNormal(joint.Direction.Value.GetVector(), mapTransform.Matrix); m.Forward = -normal; if (normal.Equals(Vector3.Up)) { m.Right = Vector3.Left; } else if (normal.Equals(Vector3.Down)) { m.Right = Vector3.Right; } else { m.Right = Vector3.Normalize(Vector3.Cross(normal, Vector3.Down)); } m.Up = -Vector3.Cross(normal, m.Left); } return(m); }, transform.Matrix, mapTransform.Matrix, joint.Direction)); } }
public override void AttachEditorComponents(Entity entity, Main main) { Transform transform = entity.Get <Transform>(); Zone zone = entity.Get <Zone>(); EntityConnectable.AttachEditorComponents(entity, "ConnectedEntities", zone.ConnectedEntities); ModelAlpha model = new ModelAlpha(); model.Filename.Value = "AlphaModels\\sphere"; model.Color.Value = this.Color; model.Scale.Value = new Vector3(0.5f); model.Serialize = false; entity.Add("EditorModel", model); model.Add(new Binding <bool>(model.Enabled, Editor.EditorModelsVisible)); model.Add(new Binding <Matrix, Vector3>(model.Transform, x => Matrix.CreateTranslation(x), transform.Position)); Property <Vector3> corner1 = new Property <Vector3> { Value = zone.BoundingBox.Value.Min }; Property <Vector3> corner2 = new Property <Vector3> { Value = zone.BoundingBox.Value.Max }; entity.Add(new Binding <BoundingBox>(zone.BoundingBox, delegate() { Vector3 a = corner1, b = corner2; return(new BoundingBox(new Vector3(Math.Min(a.X, b.X), Math.Min(a.Y, b.Y), Math.Min(a.Z, b.Z)), new Vector3(Math.Max(a.X, b.X), Math.Max(a.Y, b.Y), Math.Max(a.Z, b.Z)))); }, corner1, corner2)); Transform cornerTransform1 = this.addCornerModel(entity, entity.EditorSelected); cornerTransform1.Add(new TwoWayBinding <Vector3, Vector3> ( corner1, x => Vector3.Transform(x, Matrix.Invert(transform.Matrix)), new[] { transform.Matrix }, cornerTransform1.Position, x => Vector3.Transform(x, transform.Matrix), new[] { transform.Matrix } )); Transform cornerTransform2 = this.addCornerModel(entity, entity.EditorSelected); cornerTransform2.Add(new TwoWayBinding <Vector3, Vector3> ( corner2, x => Vector3.Transform(x, Matrix.Invert(transform.Matrix)), new[] { transform.Matrix }, cornerTransform2.Position, x => Vector3.Transform(x, transform.Matrix), new[] { transform.Matrix } )); ModelAlpha box = new ModelAlpha(); box.Filename.Value = "AlphaModels\\box"; box.Color.Value = new Vector3(this.Color.X, this.Color.Y, this.Color.Z); box.Alpha.Value = 0.125f; box.Serialize = false; box.DrawOrder.Value = 11; // In front of water box.DisableCulling.Value = true; entity.Add(box); box.Add(new Binding <Matrix>(box.Transform, delegate() { BoundingBox b = zone.BoundingBox; return(Matrix.CreateScale(b.Max - b.Min) * Matrix.CreateTranslation((b.Min + b.Max) * 0.5f) * transform.Matrix); }, zone.BoundingBox, transform.Matrix)); box.Add(new Binding <bool>(box.Enabled, entity.EditorSelected)); box.Add(new Binding <BoundingBox>(box.BoundingBox, zone.BoundingBox)); box.CullBoundingBox.Value = false; }
public override void AttachEditorComponents(Entity entity, Main main) { base.AttachEditorComponents(entity, main); EntityConnectable.AttachEditorComponents(entity, "Targets", entity.Get <Rotator>().Targets); }