Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Card : MonoBehaviour {
- public CardContents data;
- public Text cName;
- public Text hitpoint;
- public Text feat1;
- public Text feat2;
- public Text feat3;
- public Text weak;
- public Text resist;
- public Text retreat;
- public Color cardColor;
- // Use this for initialization
- void Start () {
- cName.text = data.cardName;
- hitpoint.text = data.hp.ToString() + " HP";
- Text[] feats = new Text[3];
- feats[0] = feat1;
- feats[1] = feat2;
- feats[2] = feat3;
- for (int i = 0; i < feats.Length; i++)
- {
- if (i < data.features.Length) feats[i].text = data.features[i];
- else feats[i].text = "";
- }
- weak.text = data.weakness;
- resist.text = data.resistance;
- retreat.text = data.retreatCost.ToString();
- cardColor = new Color();
- switch (data.type)
- {
- case "water":
- {
- cardColor.r = 0;
- cardColor.b = 255;
- cardColor.g = 50;
- break;
- }
- case "fire":
- {
- cardColor.r = 255;
- cardColor.b = 0;
- cardColor.g = 50;
- break;
- }
- case "grass":
- {
- cardColor.r = 50;
- cardColor.b = 0;
- cardColor.g = 255;
- break;
- }
- case "dragon":
- {
- cardColor.r = 128;
- cardColor.b = 0;
- cardColor.g = 238;
- break;
- }
- }
- cardColor.a = 255;
- gameObject.GetComponent<Renderer>().sharedMaterial.color = cardColor;
- }
- // Update is called once per frame
- void Update () {
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement