Skip to content

Commit

Permalink
231103
Browse files Browse the repository at this point in the history
  • Loading branch information
Tynab committed Nov 2, 2023
1 parent 9492cd0 commit 27986d3
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 30 deletions.
39 changes: 15 additions & 24 deletions Assets/Scenes/MainScene.unity
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
FaceUp: 0
Top: 0
IsDeckPile: 0
Values: 0
Row: 0
Expand Down Expand Up @@ -567,7 +566,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
FaceUp: 0
Top: 0
IsDeckPile: 0
Values: 0
Row: 0
Expand Down Expand Up @@ -745,7 +743,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
FaceUp: 0
Top: 0
IsDeckPile: 0
Values: 0
Row: 0
Expand Down Expand Up @@ -1003,7 +1000,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
FaceUp: 0
Top: 0
IsDeckPile: 0
Values: 0
Row: 0
Expand Down Expand Up @@ -1575,7 +1571,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
FaceUp: 0
Top: 0
IsDeckPile: 0
Values: 0
Row: 0
Expand Down Expand Up @@ -1802,7 +1797,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
FaceUp: 0
Top: 0
IsDeckPile: 0
Values: 0
Row: 0
Expand Down Expand Up @@ -2193,7 +2187,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
FaceUp: 0
Top: 0
IsDeckPile: 0
Values: 0
Row: 0
Expand Down Expand Up @@ -2385,7 +2378,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
FaceUp: 0
Top: 0
IsDeckPile: 0
Values: 0
Row: 0
Expand Down Expand Up @@ -2564,7 +2556,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
FaceUp: 0
Top: 0
IsDeckPile: 0
Values: 0
Row: 0
Expand Down Expand Up @@ -2890,7 +2881,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
FaceUp: 0
Top: 0
IsDeckPile: 0
Values: 0
Row: 0
Expand Down Expand Up @@ -3208,19 +3198,6 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 5ad4bb91b1709e9498cd0eb2d5bf75a6, type: 3}
m_Name:
m_EditorClassIdentifier:
PosTops:
- {fileID: 230371216}
- {fileID: 1212278198}
- {fileID: 1035028800}
- {fileID: 454662471}
PosBots:
- {fileID: 1324752376}
- {fileID: 1198939758}
- {fileID: 975406505}
- {fileID: 1963198422}
- {fileID: 1226310186}
- {fileID: 600562791}
- {fileID: 34188331}
FaceCard:
- {fileID: 21300000, guid: 134a6822c050bd04cba592c934a6f6ed, type: 3}
- {fileID: 21300000, guid: a80d2f70c6c99b3409009708bf638888, type: 3}
Expand Down Expand Up @@ -3274,11 +3251,26 @@ MonoBehaviour:
- {fileID: 21300000, guid: a196b3727a318cd40a33fdffdcab4684, type: 3}
- {fileID: 21300000, guid: dec6ce0b4d3e4534c966419cf09c8bd8, type: 3}
- {fileID: 21300000, guid: c3c730b1616a25f4db823c33bc7481ff, type: 3}
PosTops:
- {fileID: 230371216}
- {fileID: 1212278198}
- {fileID: 1035028800}
- {fileID: 454662471}
PosBots:
- {fileID: 1324752376}
- {fileID: 1198939758}
- {fileID: 975406505}
- {fileID: 1963198422}
- {fileID: 1226310186}
- {fileID: 600562791}
- {fileID: 34188331}
CardPrefab: {fileID: 8949091621847208831, guid: e47e610d005bb014f978fe27600fb47f, type: 3}
DeckButton: {fileID: 2065622092}
TripsOnDisplay: []
DeckCard: []
DisCardPile: []
_emptyPos: {fileID: 21300000, guid: dad99cc115f7ec143b4dec916337800f, type: 3}
_cardSleeve: {fileID: 21300000, guid: 4e91445daa38b914b8cafafc0c273166, type: 3}
--- !u!4 &1618202105
Transform:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -3634,7 +3626,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
FaceUp: 0
Top: 0
IsDeckPile: 0
Values: 0
Row: 0
Expand Down
23 changes: 17 additions & 6 deletions Assets/Script/ManagerCard.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using UnityEngine.Assertions;
using static System.Linq.Enumerable;
using static UnityEngine.Quaternion;
using static UnityEngine.GameObject;

public sealed class ManagerCard : MonoBehaviour
{
Expand Down Expand Up @@ -34,6 +36,9 @@ public sealed class ManagerCard : MonoBehaviour
private int _trips;
private int _tripsRemainder;

[SerializeField] private Sprite _emptyPos;
[SerializeField] private Sprite _cardSleeve;

private void Start() => Bots = new List<string>[] { _bot0, _bot1, _bot2, _bot3, _bot4, _bot5, _bot6 };

public void DealCard()
Expand Down Expand Up @@ -82,28 +87,33 @@ public IEnumerator DealFromDeck()
{
TripsOnDisplay.Clear();

var xPos = 6f;
var zPos = 0f;
var xSet = 6f;
var zSet = 0f;

foreach (var item in DeckTrips[_deckLocation])
{
yield return new WaitForSeconds(0.03f);

TripsOnDisplay.Add(item);

var newTopCard = Instantiate(CardPrefab, new Vector3(DeckButton.transform.position.x + xPos, DeckButton.transform.position.y, DeckButton.transform.position.z + zPos), identity, DeckButton.transform);
var newTopCard = Instantiate(CardPrefab, new Vector3(DeckButton.transform.position.x + xSet, DeckButton.transform.position.y, DeckButton.transform.position.z + zSet), identity, DeckButton.transform);

newTopCard.name = item;

var s = newTopCard.GetComponent<Selectable>();

s.FaceUp = true;
s.IsDeckPile = true;
xPos += 1f;
zPos -= 0.1f;
xSet += 1f;
zSet -= 0.1f;
}

_deckLocation++;

if (_deckLocation >= _trips)
{
Find("DeckCard").GetComponent<SpriteRenderer>().sprite = _emptyPos;
}
}
else
{
Expand Down Expand Up @@ -169,7 +179,7 @@ private void SortDeckIntoTrips()
{
_trips = DeckCard.Count / 3;
_tripsRemainder = DeckCard.Count % 3;
DeckTrips.Clear();
//DeckTrips.Clear();

var index = 0;

Expand All @@ -190,6 +200,7 @@ private void SortDeckIntoTrips()

private void RestackTopDeck()
{
Find("DeckCard").GetComponent<SpriteRenderer>().sprite = _cardSleeve;
DeckCard.Clear();
DeckCard.AddRange(DisCardPile);
DisCardPile.Clear();
Expand Down

0 comments on commit 27986d3

Please sign in to comment.