public void PostUpdate() { return; if (posBox == null) { posBox = new MonklandUI.QuickDisplayBox() { area = new Rect(pos.x, pos.y, 10, 10), color = new Color(0, 0, 1, 0.2f), roomID = owner.owner.room.abstractRoom.index }; MonklandUI.AddDisplayBox(posBox); } if (targetBox == null) { targetBox = new MonklandUI.QuickDisplayBox() { area = new Rect(pos.x, pos.y, 10, 10), color = new Color(1, 0, 0, 0.2f), roomID = owner.owner.room.abstractRoom.index }; MonklandUI.AddDisplayBox(targetBox); } patch_BodyPart patchPart = this as BodyPart as patch_BodyPart; posBox.area.position = pos; targetBox.area.position = patchPart.targetPos; lastPos = pos; pos = patchPart.targetPos; patchPart.lastLerpPos = pos; pos = Vector2.Lerp(patchPart.lastLerpPos, patchPart.targetPos, 0.3f); patchPart.lastLerpPos = pos; posBox.area.position = pos; targetBox.area.position = patchPart.targetPos; }
public void PostUpdate() { if (targetPos == Vector2.zero) { return; } if (posBox == null) { posBox = new MonklandUI.QuickDisplayBox() { area = new Rect(pos.x, pos.y, 10, 10), color = new Color(0, 0, 1, 0.2f), roomID = owner.room.abstractRoom.index }; MonklandUI.AddDisplayBox(posBox); } if (targetBox == null) { targetBox = new MonklandUI.QuickDisplayBox() { area = new Rect(pos.x, pos.y, 10, 10), color = new Color(1, 0, 0, 0.2f), roomID = owner.room.abstractRoom.index }; MonklandUI.AddDisplayBox(targetBox); } Vector2 newPos = Vector2.Lerp(lastLerpPos, targetPos, 0.3f); lastLastPos = lastPos; lastPos = lastLerpPos; pos = newPos; lastLerpPos = newPos; posBox.area.position = newPos; targetBox.area.position = targetPos; }