public void OnEndDrag(PointerEventData e) { //タイルの取得 var tile = GameObject.FindGameObjectsWithTag("Tile") .Where(x => RectTransformUtility.RectangleContainsScreenPoint(x.GetComponent <RectTransform>(), e.position) == true && x.GetComponent <ETile>().isAttachable == true) .Select(x => x.GetComponent <ETile>()) .FirstOrDefault(); //タイル外 if (tile == null) { rectTransform.position = oldPosition; return; } //他キャラクターの取得 var otherTile = GameObject.FindGameObjectsWithTag("Edit/Character") .Where(x => x.GetComponent <ECharacterIcon>().vect2D == tile.vect) .FirstOrDefault(); //既にいる if (otherTile != null) { rectTransform.position = oldPosition; return; } rectTransform.position = CSTransform.CopyVector3(tile.GetComponent <RectTransform>().position); oldPosition = CSTransform.CopyVector3(rectTransform.position); vect2D = tile.vect; }
//タイルの上に移動 void SetPositionOnTile() { var tilePosition = BattleStage.Instance.GetTile(positionArray).transform.position; CSTransform.SetX(transform, tilePosition.x); CSTransform.SetZ(transform, tilePosition.z); }
//タイルの上に移動 void SetPositionOnTile() { var tilePosition = BBattleStage.Instance.GetTileXAndZPosition(positionArray); CSTransform.SetX(transform, tilePosition.x); CSTransform.SetZ(transform, tilePosition.y); }
protected double TransformX(double source) { if (CSTransform == null) { return(0); } return(CSTransform.Transform(new Point(source, 0)).X + AxisShift); }
protected double TransformY(double source) { if (CSTransform == null) { return(0); } return(CSTransform.Transform(new Point(0, source)).Y + AxisShift); }
//攻撃時カメラ追従 void OnDraggingInAttackMode(DragInfo dragInfo) { if (activeCharacter.IsNowAction() == false) { return; } //x方向 var moveVect = GetMoveDirection(dragInfo.delta); CSTransform.SetX(transform, transform.position.x - moveVect.x); CSTransform.SetZ(transform, transform.position.z - moveVect.y); }
void Update() { // 自分自身の座標に、targetの座標に相対座標を足した値を設定する CSTransform.SetX(transform, target.position.x + offset.x); }
void Clamp() { CSTransform.SetX(transform, Mathf.Clamp(transform.position.x, -x, x)); }
private void TestDrawALine(DrawingContext drawingContext) { drawingContext.DrawLine(new Pen(new SolidColorBrush(Colors.Red), 1), CSTransform.Transform(new Point(0, 0)), CSTransform.Transform(new Point(80, 50))); }
public void OnDrag(PointerEventData e) { rectTransform.position = CSTransform.CopyVector3(e.position); }
public void OnBeginDrag(PointerEventData e) { rectTransform.position = CSTransform.CopyVector3(e.position); //obj.SetAsFirstSibling(); }
// Use this for initialization void Start() { vect2D = new IntVect2D(IntVect2D.nullNumber, IntVect2D.nullNumber); rectTransform = GetComponent <RectTransform>(); oldPosition = CSTransform.CopyVector3(rectTransform.position); }