Пример #1
0
    public void MakeMove()
    {
        Tiles oldTileVal = CurrentSpace.Value;

        CurrentSpace.Value = IconSelector.Current;
        if (board.board.IsBoardValid())
        {
            if (oldTileVal == CurrentSpace.Value)
            {
                CurrentSpace.Direction = (Dir)
                                         (((int)CurrentSpace.Direction + 90) % 360);
                //Debug.Log ("Dir changed! new dir is:");
                //Debug.Log (CurrentSpace.Direction);
                var rotation = new Vector3(0, (float)-90, 0);
                CurrentTile.transform.Rotate(rotation);
            }
            else
            {
                var newTile = IconSelector.CreateTile(IconSelector.Current);
                CurrentTile = newTile;
                //CurrentSpace.Direction = IconSelector.CurrentSelectDir;
                newTile.transform.parent        = this.transform;
                newTile.transform.localPosition = Vector3.zero;
            }

            board.board.UpdateWater();
            if (clip)
            {
                GetComponent <AudioSource>().PlayOneShot(clip);
            }
        }
        else
        {
            if (failClip)
            {
                GetComponent <AudioSource>().PlayOneShot(failClip);
            }
            CurrentSpace.Value = oldTileVal;
        }
    }