18596 changed files with 7180 additions and 1424491 deletions
@ -0,0 +1,6 @@
|
||||
{ |
||||
"version": "1.0", |
||||
"components": [ |
||||
"Microsoft.VisualStudio.Workload.ManagedGame" |
||||
] |
||||
} |
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2 |
||||
guid: 5cebb8a885d4e4a6992c4fcd598b67c8 |
||||
guid: 360b3890406c26c43baf370967271f44 |
||||
folderAsset: yes |
||||
DefaultImporter: |
||||
externalObjects: {} |
@ -0,0 +1,22 @@
|
||||
%YAML 1.1 |
||||
%TAG !u! tag:unity3d.com,2011: |
||||
--- !u!114 &11400000 |
||||
MonoBehaviour: |
||||
m_ObjectHideFlags: 0 |
||||
m_CorrespondingSourceObject: {fileID: 0} |
||||
m_PrefabInstance: {fileID: 0} |
||||
m_PrefabAsset: {fileID: 0} |
||||
m_GameObject: {fileID: 0} |
||||
m_Enabled: 1 |
||||
m_EditorHideFlags: 0 |
||||
m_Script: {fileID: 11500000, guid: 826da03748c454845a5a702d25aaeb8d, type: 3} |
||||
m_Name: Test Card 1 |
||||
m_EditorClassIdentifier: |
||||
cardName: Test Card 1 |
||||
actionDescription: This is the first card |
||||
cardLore: asdfasdfsadf |
||||
currentHealth: 5 |
||||
attackPower: 2 |
||||
manaCost: 2 |
||||
characterSprite: {fileID: 21300000, guid: 27af81e245c71204cb492c7a2ce52a09, type: 3} |
||||
bgSprite: {fileID: 21300000, guid: 95bae3e75408f0b4392f33af0bbd2888, type: 3} |
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2 |
||||
guid: 3f9cc3f14b0454fa7b997b33a99d539f |
||||
guid: 83d3816d4cf3b804a8af50bacc8c2dc8 |
||||
NativeFormatImporter: |
||||
externalObjects: {} |
||||
mainObjectFileID: 11400000 |
@ -0,0 +1,22 @@
|
||||
%YAML 1.1 |
||||
%TAG !u! tag:unity3d.com,2011: |
||||
--- !u!114 &11400000 |
||||
MonoBehaviour: |
||||
m_ObjectHideFlags: 0 |
||||
m_CorrespondingSourceObject: {fileID: 0} |
||||
m_PrefabInstance: {fileID: 0} |
||||
m_PrefabAsset: {fileID: 0} |
||||
m_GameObject: {fileID: 0} |
||||
m_Enabled: 1 |
||||
m_EditorHideFlags: 0 |
||||
m_Script: {fileID: 11500000, guid: 826da03748c454845a5a702d25aaeb8d, type: 3} |
||||
m_Name: Test Card 2 |
||||
m_EditorClassIdentifier: |
||||
cardName: Test Card 2 |
||||
actionDescription: This is the second card |
||||
cardLore: asdfasdfsadf |
||||
currentHealth: 5 |
||||
attackPower: 2 |
||||
manaCost: 2 |
||||
characterSprite: {fileID: 21300000, guid: a6ef78d47a00c1547a3567caa54f2139, type: 3} |
||||
bgSprite: {fileID: 21300000, guid: e3d89e19a761a504ba8b8e785d1a420e, type: 3} |
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2 |
||||
guid: 9d187c8728d2b4c398f45befcacc2827 |
||||
guid: 8c96612953029ed488439c60c7f24a80 |
||||
NativeFormatImporter: |
||||
externalObjects: {} |
||||
mainObjectFileID: 11400000 |
@ -0,0 +1,22 @@
|
||||
%YAML 1.1 |
||||
%TAG !u! tag:unity3d.com,2011: |
||||
--- !u!114 &11400000 |
||||
MonoBehaviour: |
||||
m_ObjectHideFlags: 0 |
||||
m_CorrespondingSourceObject: {fileID: 0} |
||||
m_PrefabInstance: {fileID: 0} |
||||
m_PrefabAsset: {fileID: 0} |
||||
m_GameObject: {fileID: 0} |
||||
m_Enabled: 1 |
||||
m_EditorHideFlags: 0 |
||||
m_Script: {fileID: 11500000, guid: 826da03748c454845a5a702d25aaeb8d, type: 3} |
||||
m_Name: Test Card 3 |
||||
m_EditorClassIdentifier: |
||||
cardName: Test Card 3 |
||||
actionDescription: This is the third card |
||||
cardLore: asdfasdfsadf |
||||
currentHealth: 5 |
||||
attackPower: 2 |
||||
manaCost: 2 |
||||
characterSprite: {fileID: 21300000, guid: 676c030a4bee5194ea2ae557ce40c306, type: 3} |
||||
bgSprite: {fileID: 21300000, guid: 051b6f6c81b57ac4a9ef7f65b46ae866, type: 3} |
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2 |
||||
guid: 103b0616690034ca1a309e958ed431fc |
||||
guid: c8d911c43d3e0ac4eb2183ecadd3741b |
||||
NativeFormatImporter: |
||||
externalObjects: {} |
||||
mainObjectFileID: 11400000 |
@ -0,0 +1,22 @@
|
||||
%YAML 1.1 |
||||
%TAG !u! tag:unity3d.com,2011: |
||||
--- !u!114 &11400000 |
||||
MonoBehaviour: |
||||
m_ObjectHideFlags: 0 |
||||
m_CorrespondingSourceObject: {fileID: 0} |
||||
m_PrefabInstance: {fileID: 0} |
||||
m_PrefabAsset: {fileID: 0} |
||||
m_GameObject: {fileID: 0} |
||||
m_Enabled: 1 |
||||
m_EditorHideFlags: 0 |
||||
m_Script: {fileID: 11500000, guid: 826da03748c454845a5a702d25aaeb8d, type: 3} |
||||
m_Name: Troll |
||||
m_EditorClassIdentifier: |
||||
cardName: Troll |
||||
actionDescription: Trolls attack on ground |
||||
cardLore: Billy Goat, Billy Goat |
||||
currentHealth: 5 |
||||
attackPower: 3 |
||||
manaCost: 3 |
||||
characterSprite: {fileID: 21300000, guid: 5331cc8d1c56ea6429cc8c39616550f6, type: 3} |
||||
bgSprite: {fileID: 21300000, guid: 051b6f6c81b57ac4a9ef7f65b46ae866, type: 3} |
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2 |
||||
guid: 41439944d30ece34e96484bdb6645b55 |
||||
guid: e011e68d623f0a443919e23f59ee6481 |
||||
NativeFormatImporter: |
||||
externalObjects: {} |
||||
mainObjectFileID: 11400000 |
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2 |
||||
guid: 9383aa19796d6e84e8031655b9ac912f |
||||
guid: 37839dd7355e5d9469eb708916d28ec6 |
||||
folderAsset: yes |
||||
DefaultImporter: |
||||
externalObjects: {} |
@ -0,0 +1,142 @@
|
||||
using System.Collections; |
||||
using System.Collections.Generic; |
||||
using UnityEngine; |
||||
using UnityEngine.UI; |
||||
using TMPro; |
||||
|
||||
public class Card : MonoBehaviour |
||||
{ |
||||
#region Card Data |
||||
[Header("Card Data")] |
||||
[SerializeField] |
||||
private CardScriptableObject cardSO; |
||||
|
||||
// Card stats are used internally and can change during game play |
||||
// The ScriptableObject holds the base stats and it will not change |
||||
// during game play. |
||||
private int currentHealth; |
||||
private int attackPower; |
||||
private int manaCost; |
||||
#endregion |
||||
|
||||
#region Card UI |
||||
// References to UI elements on the card |
||||
[Header("Card Stats UI")] |
||||
[Tooltip("Drag UI element for card HEALTH to here ")] |
||||
[SerializeField] |
||||
private TMP_Text healthText; |
||||
[Tooltip("Drag UI element for card ATTACK to here ")] |
||||
[SerializeField] |
||||
private TMP_Text attackText; |
||||
[Tooltip("Drag UI element for card MANA to here ")] |
||||
[SerializeField] |
||||
private TMP_Text costText; |
||||
|
||||
[Header("Card Description UI")] |
||||
[Tooltip("Drag UI element for card NAME to here ")] |
||||
[SerializeField] |
||||
private TMP_Text nameText; |
||||
[Tooltip("Drag UI element for card DESCRIPTION to here ")] |
||||
[SerializeField] |
||||
private TMP_Text actionDescriptionText; |
||||
[Tooltip("Drag UI element for card LORE to here ")] |
||||
[SerializeField] |
||||
private TMP_Text loreText; |
||||
|
||||
[Header("Card Image UI")] |
||||
[SerializeField] |
||||
private Image characterArt; |
||||
[SerializeField] |
||||
private Image bgArt; |
||||
#endregion |
||||
|
||||
#region Animation |
||||
// Hold location of where this card should display on the game surface. |
||||
[Header("Card Animation")] |
||||
[SerializeField] |
||||
private float moveSpeed = 1.5f; |
||||
[SerializeField] |
||||
private float rotateSpeed = 540.0f; |
||||
|
||||
public Vector3 currentLocation; |
||||
public Quaternion currentRotation; |
||||
|
||||
// Animation will move from current Transform to the values |
||||
// contained in these two variables. |
||||
private Vector3 movetoLocation; |
||||
private Quaternion movetoRotation; |
||||
#endregion |
||||
|
||||
public bool inHand; |
||||
public int handPosition; // index of where the card is in the hand (brittle architecture here) |
||||
|
||||
|
||||
#region MonoBehaviors |
||||
// Start is called before the first frame update |
||||
void Start() |
||||
{ |
||||
SetupCard(); |
||||
} |
||||
|
||||
// Update is called once per frame |
||||
void Update() |
||||
{ |
||||
transform.position = Vector3.Lerp(transform.position, movetoLocation, moveSpeed * Time.deltaTime); |
||||
transform.rotation = Quaternion.RotateTowards(transform.rotation, movetoRotation, rotateSpeed * Time.deltaTime); |
||||
} |
||||
|
||||
private void OnMouseOver() |
||||
{ |
||||
if(inHand) |
||||
{ |
||||
Vector3 newLocation = currentLocation; |
||||
MoveToPoint(newLocation + new Vector3(0.0f, 1.0f, 0.5f), Quaternion.identity); |
||||
} |
||||
} |
||||
|
||||
private void OnMouseExit() |
||||
{ |
||||
if(inHand) |
||||
{ |
||||
MoveToPoint(currentLocation, currentRotation); |
||||
} |
||||
} |
||||
#endregion |
||||
|
||||
/***** |
||||
* This method loads the card data from the referenced ScriptableObject |
||||
* and updates properties and display for this card object. |
||||
*/ |
||||
public void SetupCard() |
||||
{ |
||||
// Set the card's initial stats. |
||||
currentHealth = cardSO.currentHealth; |
||||
attackPower = cardSO.attackPower; |
||||
manaCost = cardSO.manaCost; |
||||
|
||||
// Show the card's stats on the card display |
||||
healthText.text = currentHealth.ToString(); |
||||
attackText.text = attackPower.ToString(); |
||||
costText.text = manaCost.ToString(); |
||||
|
||||
// Show the card's description on the card display |
||||
nameText.text = cardSO.cardName.ToString(); |
||||
actionDescriptionText.text = cardSO.actionDescription.ToString(); |
||||
loreText.text = cardSO.cardLore.ToString(); |
||||
|
||||
// Show the card's images on the card display |
||||
characterArt.sprite = cardSO.characterSprite; |
||||
bgArt.sprite = cardSO.bgSprite; |
||||
} |
||||
|
||||
/***** |
||||
* This method is used move a card around on the game screen. It will move |
||||
* the card from its current location and rotation to the provided location |
||||
* and rotation. |
||||
*/ |
||||
public void MoveToPoint(Vector3 moveCardToLocation, Quaternion rotToMatch) |
||||
{ |
||||
movetoLocation = moveCardToLocation; |
||||
movetoRotation = rotToMatch; |
||||
} |
||||
} |
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2 |
||||
guid: 2c61219a8c88e2b43a6637bc8fe558dc |
||||
guid: fd246c8691e7a19449d9eaee2b9c00e6 |
||||
MonoImporter: |
||||
externalObjects: {} |
||||
serializedVersion: 2 |
@ -0,0 +1,22 @@
|
||||
using System.Collections; |
||||
using System.Collections.Generic; |
||||
using UnityEngine; |
||||
|
||||
[CreateAssetMenu (fileName="New Card", menuName="Card", order=1)] |
||||
public class CardScriptableObject : ScriptableObject |
||||
{ |
||||
[Header("Card Description")] |
||||
public string cardName; |
||||
[TextArea] |
||||
public string actionDescription; |
||||
public string cardLore; |
||||
|
||||
[Header("Card Stats")] |
||||
public int currentHealth; |
||||
public int attackPower; |
||||
public int manaCost; |
||||
|
||||
[Header("Card Image")] |
||||
public Sprite characterSprite; |
||||
public Sprite bgSprite; |
||||
} |
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2 |
||||
guid: 5a8fa255c72c8434990dc8bf9b262d59 |
||||
guid: 826da03748c454845a5a702d25aaeb8d |
||||
MonoImporter: |
||||
externalObjects: {} |
||||
serializedVersion: 2 |
@ -0,0 +1,69 @@
|
||||
using System.Collections; |
||||
using System.Collections.Generic; |
||||
using UnityEngine; |
||||
|
||||
public class HandController : MonoBehaviour |
||||
{ |
||||
[Header("Cards In Hand")] |
||||
public List<Card> heldCards = new List<Card>(); |
||||
|
||||
[Header("Card Placement in Game Space")] |
||||
[SerializeField] |
||||
[Tooltip("Drag a transform element to here that will be the start point for placing cards")] |
||||
public Transform minPos; |
||||
[SerializeField] |
||||
[Tooltip("Drag a transform element to here that will be the end point for placing cards")] |
||||
private Transform maxPos; |
||||
|
||||
// This should be done better by either using a getter or by not referencing this from the outside. |
||||
private List<Vector3> cardPositions = new List<Vector3>(); |
||||
|
||||
#region MonoBehaviors |
||||
// Start is called before the first frame update |
||||
void Start() |
||||
{ |
||||
SetCardPositionsInHand(); |
||||
} |
||||
|
||||
// Update is called once per frame |
||||
void Update() |
||||
{ |
||||
|
||||
} |
||||
#endregion |
||||
|
||||
/***** |
||||
* The purpose of this method is to place the cards that are in the |
||||
* player's hand down on the desktop. It first figures out how far |
||||
* apart each card should be based on the number of cards in hand. |
||||
* Then it places the cards on the desktop that distance apart. The |
||||
* rotation of the minPos element makes the card overlap look nice. |
||||
* |
||||
* minPos: Where on the screen to start placing cards |
||||
* maxPos: Where on the screen to stop placing cards |
||||
*/ |
||||
public void SetCardPositionsInHand() |
||||
{ |
||||
cardPositions.Clear(); |
||||
|
||||
// Calculate how far apart each card will be based on number of cards. |
||||
Vector3 distanceBetweenPoints = Vector3.zero; |
||||
if(heldCards.Count > 1 ) |
||||
{ |
||||
distanceBetweenPoints = (maxPos.position - minPos.position) / (heldCards.Count - 1); |
||||
} |
||||
|
||||
// Place each card on the game surface |
||||
for(int i =0; i < heldCards.Count; i++) |
||||
{ |
||||
cardPositions.Add(minPos.position + (distanceBetweenPoints * i)); |
||||
|
||||
heldCards[i].currentLocation = cardPositions[i]; |
||||
heldCards[i].currentRotation = minPos.rotation; |
||||
heldCards[i].MoveToPoint(cardPositions[i], minPos.rotation); |
||||
|
||||
heldCards[i].inHand = true; |
||||
heldCards[i].handPosition = i; |
||||
} |
||||
} |
||||
} |
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2 |
||||
guid: 03dd6911110407b418a3e5d3f0c473af |
||||
guid: b4f27c8c416c47a4d9ae41225e390282 |
||||
MonoImporter: |
||||
externalObjects: {} |
||||
serializedVersion: 2 |
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue