コード例 #1
0
ファイル: PlayerStone.cs プロジェクト: LilWilmer/RGoU
    /**
     * 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);
            }
        }
    }
コード例 #2
0
ファイル: PlayerStone.cs プロジェクト: LilWilmer/RGoU
    //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;
    }
コード例 #3
0
ファイル: UrTile.cs プロジェクト: LilWilmer/RGoU
 public SafeSpace(UrTile Tile)
 {
     this.Tile  = Tile;
     this.Anim  = Tile.GetComponentInChildren <PlayAnimation>();
     this.Sound = Tile.GetComponentInChildren <AudioPlayer>();
 }
コード例 #4
0
ファイル: UrTile.cs プロジェクト: LilWilmer/RGoU
 public GoalTile(UrTile Tile)
 {
     this.Anim = Tile.GetComponentInChildren <PlayAnimation>();
     this.Tile = Tile;
 }
コード例 #5
0
ファイル: PlayerStone.cs プロジェクト: LilWilmer/RGoU
 /**
  * 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++;
 }
コード例 #6
0
ファイル: PlayerStone.cs プロジェクト: LilWilmer/RGoU
 /**
  * Sends the stone back to its starting wrack
  */
 public void SendBack()
 {
     this.anim.PlayAnim("Sink");
     this.curTile    = this.startTile;
     this.TargetTile = this.startTile;
 }
コード例 #7
0
ファイル: PlayerStone.cs プロジェクト: LilWilmer/RGoU
 public void MoveFromStart()
 {
     this.anim.PlayAnim("Sink");
     this.curTile = this.curTile.GetNext(this.Owner.ID);
 }