コード例 #1
0
 protected virtual void Move()
 {
     if (moving)
     {
         moveTicker += Time.deltaTime / MOVE_SPEED;
         if (moveTicker >= 1)
         {
             moveTicker = 1;
             currentTile.Enter(this);
             moving = false;
             FinishedMoving();
         }
     }
     if (previousTile != null)
     {
         positionSetter.transform.position = Vector3.Lerp(previousTile.transform.position, currentTile.transform.position, Interpolation.Pow2Out(0, 1, moveTicker));
     }
 }
コード例 #2
0
ファイル: S_Entity.cs プロジェクト: ColourTann/DotGobbler
 public virtual void MoveToTile(S_Tile tile, bool instant)
 {
     if (tile == null || tile==currentTile) return;
     previousTile = currentTile;
     SetTile(tile);
     if (previousTile != null){
         currentDX = currentTile.x - previousTile.x;
         currentDY = currentTile.y - previousTile.y;
     }
     if (instant) {
         moveTicker = 1;
         positionSetter.transform.localPosition = currentTile.transform.localPosition;
         tile.Enter(this);
     }
     else {
         StartMoving();
     }
 }
コード例 #3
0
 public virtual void MoveToTile(S_Tile tile, bool instant)
 {
     if (tile == null || tile == currentTile)
     {
         return;
     }
     previousTile = currentTile;
     SetTile(tile);
     if (previousTile != null)
     {
         currentDX = currentTile.x - previousTile.x;
         currentDY = currentTile.y - previousTile.y;
     }
     if (instant)
     {
         moveTicker = 1;
         positionSetter.transform.localPosition = currentTile.transform.localPosition;
         tile.Enter(this);
     }
     else
     {
         StartMoving();
     }
 }