ElementAnzeige.cs 2.93 KB
Newer Older
Isa's avatar
Isa committed
1 2 3 4
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
Isa's avatar
Isa committed
5
using _Game.Scripts.Scriptable_Object;
Isa's avatar
Isa committed
6 7 8

public class ElementAnzeige : MonoBehaviour
{
Isa's avatar
Isa committed
9
	[SerializeField] private PlayerState state;
Isa's avatar
Isa committed
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
	public Sprite empty;
	public GameObject Feuer;
	public Sprite[] FeuerSprites;
	public GameObject Erde;
	public Sprite[] ErdeSprites;
	public GameObject Wasser;
	public Sprite[] WasserSprites;
	public GameObject Luft;
	public Sprite[] LuftSprites;
	public int availableCount = 0;

    public void UpdateFeuerAnzeige()
    {
	    Debug.Log("Feuer");
	    switch (availableCount)
	    {
		    case 5: Feuer.GetComponent<Image>().sprite = FeuerSprites[4];
			    break;
		    case 4: Feuer.GetComponent<Image>().sprite = FeuerSprites[3];
			    break;
		    case 3: Feuer.GetComponent<Image>().sprite = FeuerSprites[2];
			    break;
		    case 2: Feuer.GetComponent<Image>().sprite = FeuerSprites[1];
			    break;
		    case 1: Feuer.GetComponent<Image>().sprite = FeuerSprites[0];
			    break;
		    case 0: Feuer.GetComponent<Image>().sprite = empty;
			    break;
	    }
    }

    public void UpdateErdeAnzeige()
    {
	    Debug.Log("Erde");
	    switch (availableCount)
	    {
		    case 5: Erde.GetComponent<Image>().sprite = FeuerSprites[4];
			    break;
		    case 4: Erde.GetComponent<Image>().sprite = FeuerSprites[3];
			    break;
		    case 3: Erde.GetComponent<Image>().sprite = FeuerSprites[2];
			    break;
		    case 2: Erde.GetComponent<Image>().sprite = FeuerSprites[1];
			    break;
		    case 1: Erde.GetComponent<Image>().sprite = FeuerSprites[0];
			    break;
		    case 0: Erde.GetComponent<Image>().sprite = empty;
			    break;
	    }
    }

    public void UpdateWasserAnzeige()
    {
	    Debug.Log("Wasser");
	    switch (availableCount)
	    {
		    case 5: Wasser.GetComponent<Image>().sprite = FeuerSprites[4];
			    break;
		    case 4: Wasser.GetComponent<Image>().sprite = FeuerSprites[3];
			    break;
		    case 3: Wasser.GetComponent<Image>().sprite = FeuerSprites[2];
			    break;
		    case 2: Wasser.GetComponent<Image>().sprite = FeuerSprites[1];
			    break;
		    case 1: Wasser.GetComponent<Image>().sprite = FeuerSprites[0];
			    break;
		    case 0: Wasser.GetComponent<Image>().sprite = empty;
			    break;
	    }
    }

    public void UpdateLuftAnzeige()
    {
	    Debug.Log("Wasser");
	    switch (availableCount)
	    {
		    case 5: Luft.GetComponent<Image>().sprite = FeuerSprites[4];
			    break;
		    case 4: Luft.GetComponent<Image>().sprite = FeuerSprites[3];
			    break;
		    case 3: Luft.GetComponent<Image>().sprite = FeuerSprites[2];
			    break;
		    case 2: Luft.GetComponent<Image>().sprite = FeuerSprites[1];
			    break;
		    case 1: Luft.GetComponent<Image>().sprite = FeuerSprites[0];
			    break;
		    case 0: Luft.GetComponent<Image>().sprite = empty;
			    break;
	    }
    }
Isa's avatar
Isa committed
100 101 102 103 104

    public void GetRemainingCharges()
    {
	    availableCount = state.GetCharges();
    }
Isa's avatar
Isa committed
105
}