Depending on a certain distance between Player and Enemy I want a Menu element (Label) Background Texture color to change.
I found this in your manual:
AC.PlayerMenus.GetElementWithName (string menuName, string menuElementName);
but that's as far as I understand.
My menuName is EnemySees and the Element Name is: thisColor
How can I change the colors ?
Comments
You're on the right track with the coding - that function returns the MenuElement class you want to change. The parameters require the names, so:
MenuElement thisColorElement = AC.PlayerMenus.GetElementWithName ("EnemySees", "thisColor");
will give you a new MenuElement variable named thisColorElement you can manipulate.
The scripting guide's entry on the MenuElement class can be found by searching for it in the top-right corner. Scroll down and you'll find backgroundTexture in the list of variables. You can amend its value with:
thisColorElement.backgroundTexture = myNewTexture;
where myNewTexture is a Texture2D variable you've defined at the top of your script.
To finish this up I need also the Different Texts that go with each color:
This is waht I have for the color change:
MenuElement thisColorElement = AC.PlayerMenus.GetElementWithName ("EnemySees", "thisColor");
thisColorElement.backgroundTexture = attackTexture;
where attackTexture is a public Texture2d.
But, how about using the same procedure for displaying a text under Label Text of the same Menu element? there is no
thisColorElement.LabelText = myText ???
AC.MenuLabel myLabel = (AC.MenuLabel) thisColorElement;
myLabel.label = myText;
Thanks again now I have my scene complete