protected void FixedUpdate() { this.baseAnchor = new RopeAnchor(this.baseEntity.transform.position, 0f); this.targetAnchor = new RopeAnchor(this.endEntity.transform.position, 0f); this.popAnchors_(); this.updateCollider_(); this.updateRendering_(); this.updateJoint_(); }
public RopeInstanceEditor(RopeAnchor item) { InitializeComponent(); this.item = item; xInput.Value = item.X; yInput.Value = item.Y; ufBox.Checked = item.ParentRope.uf; if (item.ParentRope.ladder) { ladderBox.Checked = true; } else { ladderBox.Checked = false; } pathLabel.Text = HaCreatorStateManager.CreateItemDescription(item); }
public RopeInstanceEditor(RopeAnchor item) { InitializeComponent(); this.item = item; xInput.Value = item.X; yInput.Value = item.Y; ufBox.Checked = item.ParentRope.uf; if (item.ParentRope.ladder) { ladderBox.Checked = true; } else { ladderBox.Checked = false; } pathLabel.Text = HaCreatorStateManager.CreateItemDescription(item, "\r\n"); }
void Update() { mouseRay = Camera.main.ScreenPointToRay(Input.mousePosition); if (Input.GetMouseButtonDown(0)) { hit = Physics2D.Raycast(mouseRay.origin, mouseRay.direction, 100, layer); if (hit) { Debug.Log("Hit" + hit.collider.gameObject.ToString()); anchor = hit.collider.GetComponent <RopeAnchor>(); anchor.Dragged(); } } if (Input.GetMouseButtonUp(0) && anchor != null) { anchor.Release(); } Debug.DrawLine(mouseRay.origin, mouseRay.direction * 100 + mouseRay.origin); }
public RopeInstanceEditor(RopeAnchor item) { InitializeComponent(); this.item = item; styleManager.ManagerStyle = UserSettings.applicationStyle; xInput.Value = item.X; yInput.Value = item.Y; ufBox.Checked = item.ParentRope.uf; if (item.ParentRope.ladder) { ropeBox.Checked = false; ladderBox.Checked = true; } else { ropeBox.Checked = true; ladderBox.Checked = false; } pathLabel.Text = Editor.CreateItemDescription(item, "\r\n"); }
private void addAnchor_(RopeAnchor anc) { this.anchors_.Insert(this.anchors_.Count - 1, anc); }
public void PlaceObject() { lock (Board.ParentControl) { if (state == MouseState.StaticObjectAdding || state == MouseState.RandomTiles) // tiles, obj { List <UndoRedoAction> undoPipe = new List <UndoRedoAction>(); currAddedObj.OnItemPlaced(undoPipe); Board.UndoRedoMan.AddUndoBatch(undoPipe); ReleaseItem(currAddedObj); if (currAddedObj is LayeredItem) { int highestZ = 0; foreach (LayeredItem item in Board.BoardItems.TileObjs) { if (item.Z > highestZ) { highestZ = item.Z; } } currAddedObj.Z = highestZ; Board.BoardItems.Sort(); } if (state == MouseState.StaticObjectAdding) { BoardItem boardItem = currAddedInfo.CreateInstance(Board.SelectedLayer, Board, X + currAddedInfo.Origin.X - currAddedInfo.Image.Width / 2, Y + currAddedInfo.Origin.Y - currAddedInfo.Image.Height / 2, 50, false); currAddedObj = boardItem; } else { BoardItem boardItem = tileRandomList[NextInt32(tileRandomList.Length)].CreateInstance(Board.SelectedLayer, Board, X + currAddedInfo.Origin.X - currAddedInfo.Image.Width / 2, Y + currAddedInfo.Origin.Y - currAddedInfo.Image.Height / 2, 50, false); currAddedObj = boardItem; } Board.BoardItems.Add(currAddedObj, false); BindItem(currAddedObj, new Microsoft.Xna.Framework.Point(currAddedInfo.Origin.X - currAddedInfo.Image.Width / 2, currAddedInfo.Origin.Y - currAddedInfo.Image.Height / 2)); } else if (state == MouseState.Chairs) // Chair { Board.UndoRedoMan.AddUndoBatch(new List <UndoRedoAction> { UndoRedoManager.ItemAdded(currAddedObj) }); ReleaseItem(currAddedObj); currAddedObj = new Chair(Board, X, Y); Board.BoardItems.Add(currAddedObj, false); BindItem(currAddedObj, new Microsoft.Xna.Framework.Point()); } else if (state == MouseState.Ropes) // Ropes { int count = BoundItems.Count; RopeAnchor anchor = (RopeAnchor)BoundItems.Keys.ElementAt(0); ReleaseItem(anchor); if (count == 1) { Board.UndoRedoMan.AddUndoBatch(new List <UndoRedoAction> { UndoRedoManager.RopeAdded(anchor.ParentRope) }); CreateRope(); } } else if (state == MouseState.Tooltip) // Tooltip { int count = BoundItems.Count; ToolTipDot dot = (ToolTipDot)BoundItems.Keys.ElementAt(0); ReleaseItem(dot); if (count == 1) { List <UndoRedoAction> undoPipe = new List <UndoRedoAction>(); dot.ParentTooltip.OnItemPlaced(undoPipe); Board.UndoRedoMan.AddUndoBatch(undoPipe); CreateTooltip(); } } else if (state == MouseState.Clock) // Clock { int count = BoundItems.Count; List <BoardItem> items = BoundItems.Keys.ToList(); Clock clock = null; foreach (BoardItem item in items) { if (item is Clock) { clock = (Clock)item; } } foreach (BoardItem item in items) { ReleaseItem(item); } List <UndoRedoAction> undoPipe = new List <UndoRedoAction>(); clock.OnItemPlaced(undoPipe); Board.UndoRedoMan.AddUndoBatch(undoPipe); CreateClock(); } } }
// Use this for initialization void Start() { // null if the parent of this RopeSection is another RopeSection. this.ropeAnchor = this.gameObject.transform.parent.gameObject.GetComponent <RopeAnchor>(); }