/** * Moves the player piece to the target tile */ public void MovePiece() { //this.transform.position = this.curTile.transform.position; if (this.curTile != this.TargetTile) { UrTile lastTile = this.curTile; this.curTile = this.curTile.GetNext(this.Owner.ID); transform.LookAt(this.curTile.transform); StartCoroutine(this.MovementCoroutine(this.transform.position, this.curTile.transform.position, 0.5f)); if (lastTile.CurrentPiece == null) { if (curTile.CurrentPiece == null) { this.anim.PlayAnim("Hop"); } else { this.anim.PlayAnim("HopOver"); } } else { if (curTile.CurrentPiece == null) { this.anim.PlayAnim("HopOff"); } else { this.anim.PlayAnim("HopOffOver"); } } } else { if (curTile.CurrentPiece != null) { this.anim.PlayAnim("Take Piece"); } this.curTile.ClearTile(); //Setting up position on new tile. this.curTile = this.TargetTile; this.curTile.CurrentPiece = this; this.curTile.ActivateTile(); //Letting listeners know the move has terminated. foreach (PieceObserver p_ob in Observers) { p_ob.PieceMoved(this); } } }
//SETUP=================================================================== private void Start() { this.anim = GetComponentInChildren <PlayAnimation>(); this.anim.AnimationFinished += AnimFin; this.startTile = this.curTile; this.startPosition = this.transform.position; this.EndPosition = this.EndTile.transform.position; CanMove = false; MoveDistance = 0; }
public SafeSpace(UrTile Tile) { this.Tile = Tile; this.Anim = Tile.GetComponentInChildren <PlayAnimation>(); this.Sound = Tile.GetComponentInChildren <AudioPlayer>(); }
public GoalTile(UrTile Tile) { this.Anim = Tile.GetComponentInChildren <PlayAnimation>(); this.Tile = Tile; }
/** * Increases the player score and moves the piece to the end tile */ public void Score() { this.curTile = this.EndTile; this.transform.position = this.EndPosition; this.Owner.Score++; }
/** * Sends the stone back to its starting wrack */ public void SendBack() { this.anim.PlayAnim("Sink"); this.curTile = this.startTile; this.TargetTile = this.startTile; }
public void MoveFromStart() { this.anim.PlayAnim("Sink"); this.curTile = this.curTile.GetNext(this.Owner.ID); }