LHMAuraMenu.cs 7.18 KB
Newer Older
Maurice Tayeb Andreas's avatar
Maurice Tayeb Andreas committed
1 2 3 4 5 6 7 8 9 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 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236
using UnityEngine;
using System.Collections;
using VA;
using UnityEngine.UI;

public class LHMAuraMenu : MonoBehaviour {

    public Color setcolor;
    public Color notsetcolor;
    private VAUAuralizationMode auralizationMode;
    private string auraMode;
    private bool DS;
    private bool ER;
    private bool DD;
    private bool DIR;
    private bool AA;
    private bool TV;
    private bool SC;
    private bool DIF;
    private bool NF;
    private bool DP;
    private bool SL;

    void Start()
    {
        auralizationMode = FindObjectOfType<VAUAdapter>().gameObject.GetComponent<VAUAuralizationMode>();
        if (auralizationMode == null)
            Debug.Log("Global AuralizationMode can't be set: No VAUAuralizationMode on VA-Object.");
        auralizationMode.AuraStringChanged += AuralizationMode_AuraStringChanged;   
        RefreshAuraMode();
    }

    private void AuralizationMode_AuraStringChanged(string sAuraString)
    {
        RefreshAuraMode();
    }

    void RefreshAuraMode()
    {
        DS = auralizationMode.DirectSound;
        ER = auralizationMode.EarlyReflections;
        DD = auralizationMode.DiffuseDecay;
        DIR = auralizationMode.SourceDirectivity;
        AA = auralizationMode.AirAbsorption;
        TV = auralizationMode.AtmosphericTemporalVariations;
        SC = auralizationMode.Scattering;
        DIF = auralizationMode.Diffraction;
        NF = auralizationMode.NearFielEffects;
        DP = auralizationMode.DopplerShifts;
        SL = auralizationMode.SphericalSpreadingLoss;

        gameObject.transform.FindChild("DSButton").GetComponent<Image>().color = (DS) ? setcolor : notsetcolor;
        gameObject.transform.FindChild("ERButton").GetComponent<Image>().color = (ER) ? setcolor : notsetcolor;
        gameObject.transform.FindChild("DDButton").GetComponent<Image>().color = (DD) ? setcolor : notsetcolor;
        gameObject.transform.FindChild("DIRButton").GetComponent<Image>().color = (DIR) ? setcolor : notsetcolor;
        gameObject.transform.FindChild("AAButton").GetComponent<Image>().color = (AA) ? setcolor : notsetcolor;
        gameObject.transform.FindChild("TVButton").GetComponent<Image>().color = (TV) ? setcolor : notsetcolor;
        gameObject.transform.FindChild("SCButton").GetComponent<Image>().color = (SC) ? setcolor : notsetcolor;
        gameObject.transform.FindChild("DIFButton").GetComponent<Image>().color = (DIF) ? setcolor : notsetcolor;
        gameObject.transform.FindChild("NFButton").GetComponent<Image>().color = (NF) ? setcolor : notsetcolor;
        gameObject.transform.FindChild("DPButton").GetComponent<Image>().color = (DP) ? setcolor : notsetcolor;
        gameObject.transform.FindChild("SLButton").GetComponent<Image>().color = (SL) ? setcolor : notsetcolor;
    }

    public void AllClicked()
    {
        auralizationMode.TriggerAuraStringChanged("all");
    }
    public void DefaultClicked()
    {
        auralizationMode.TriggerAuraStringChanged("default");
    }
    public void DSClicked()
    {
        if (DS)
        {
            auralizationMode.TriggerAuraStringChanged("-DS");
            DS = false;
        }
        else
        {
            auralizationMode.TriggerAuraStringChanged("+DS");
            DS = true;
        }
        gameObject.transform.Find("DSButton").GetComponent<Image>().color = (DS) ? setcolor : notsetcolor;
    }
    public void DDClicked()
    {
        if (DD)
        {
            auralizationMode.TriggerAuraStringChanged("-DD");
            DD = false;
        }
        else
        {
            auralizationMode.TriggerAuraStringChanged("+DD");
            DD = true;
        }
        gameObject.transform.Find("DDButton").GetComponent<Image>().color = (DD) ? setcolor : notsetcolor;
        
    }
    public void DIRClicked()
    {
        if (DIR)
        {
            auralizationMode.TriggerAuraStringChanged("-DIR");
            DIR = false;
        }
        else
        {
            auralizationMode.TriggerAuraStringChanged("+DIR");
            DIR = true;
        }
        gameObject.transform.Find("DIRButton").GetComponent<Image>().color = (DIR) ? setcolor : notsetcolor;
        
    }
    public void AAClicked()
    {
        if (AA)
        {
            auralizationMode.TriggerAuraStringChanged("-AA");
            AA = false;
        }
        else
        {
            auralizationMode.TriggerAuraStringChanged("+AA");
            AA = true;
        }
        gameObject.transform.Find("AAButton").GetComponent<Image>().color = (AA) ? setcolor : notsetcolor;
        
    }
    public void TVClicked()
    {
        if (TV)
        {
            auralizationMode.TriggerAuraStringChanged("-TV");
            TV = false;
        }
        else
        {
            auralizationMode.TriggerAuraStringChanged("+TV");
            TV = true;
        }
        gameObject.transform.Find("TVButton").GetComponent<Image>().color = (TV) ? setcolor : notsetcolor;
        
    }
    public void SCClicked()
    {
        if (SC)
        {
            auralizationMode.TriggerAuraStringChanged("-SC");
            SC = false;
        }
        else
        {
            auralizationMode.TriggerAuraStringChanged("+SC");
            SC = true;
        }
        gameObject.transform.Find("SCButton").GetComponent<Image>().color = (SC) ? setcolor : notsetcolor;
        
    }
    public void DIFClicked()
    {
        if (DIF)
        {
            auralizationMode.TriggerAuraStringChanged("-DIF");
            DIF = false;
        }
        else
        {
            auralizationMode.TriggerAuraStringChanged("+DIF");
            DIF = true;
        }
        gameObject.transform.Find("DIFButton").GetComponent<Image>().color = (DIF) ? setcolor : notsetcolor;
        
    }
    public void NFClicked()
    {
        if (NF)
        {
            auralizationMode.TriggerAuraStringChanged("-NF");
            NF = false;
        }
        else
        {
            auralizationMode.TriggerAuraStringChanged("+NF");
            NF = true;
        }
        gameObject.transform.Find("NFButton").GetComponent<Image>().color = (NF) ? setcolor : notsetcolor;
        
    }
    public void DPClicked()
    {
        if (DP)
        {
            auralizationMode.TriggerAuraStringChanged("-DP");
            DP = false;
        }
        else
        {
            auralizationMode.TriggerAuraStringChanged("+DP");
            DP = true;
        }
        gameObject.transform.Find("DPButton").GetComponent<Image>().color = (DP) ? setcolor : notsetcolor;
        
    }
    public void SLClicked()
    {
        if (SL)
        {
            auralizationMode.TriggerAuraStringChanged("-SL");
            SL = false;
        }
        else
        {
            auralizationMode.TriggerAuraStringChanged("+SL");
            SL = true;
        }
        gameObject.transform.Find("SLButton").GetComponent<Image>().color = (SL) ? setcolor : notsetcolor;
    }
    public void ERClicked()
    {
        if (ER)
        {
            auralizationMode.TriggerAuraStringChanged("-ER");
            ER = false;
        }
        else
        {
            auralizationMode.TriggerAuraStringChanged("+ER");
            ER = true;
        }
        gameObject.transform.Find("ERButton").GetComponent<Image>().color = (ER) ? setcolor : notsetcolor;
    }

}