public void DecideIfHighlighted(SelectabilityState selectState) { string sSprPath = "Images/Chrs/imgGlow"; switch (selectState) { case SelectabilityState.NONE: //No additional suffix needed for the path break; case SelectabilityState.ALLYSELECTABLE: sSprPath += "4"; break; case SelectabilityState.ENEMYSELECTABLE: sSprPath += "6"; break; default: Debug.Log("Unrecognized SelectabilityState: " + selectState); break; } LibView.AssignSpritePathToObject(sSprPath, this.gameObject); }
public void DecideIfHighlighted(SelectabilityState selectableState) { //if(selectableState == SelectabilityState.NONE && mod == ContTurns.Get().GetNextActingChr()) { // selectableState = SelectabilityState.ACTIVETURN; //} SetSelectionGlow(selectableState); }
//Sets the sprite for the glowing effect around a character for their selectability void SetSelectionGlow(SelectabilityState selectState) { if (selectState == SelectabilityState.NONE) { //If we want no selection, just delete the glow object (if present) and return if (goCurSelectionGlow != null) { Destroy(goCurSelectionGlow); goCurSelectionGlow = null; } return; } //If we need a glow and it doesn't already exist, instantiate it if (goCurSelectionGlow == null) { goCurSelectionGlow = Instantiate(pfSelectionGlow, maskPortrait.transform); } string sSprPath = "Images/Chrs/imgGlow"; switch (selectState) { case SelectabilityState.ACTIVETURN: //No additional suffix needed for the path break; case SelectabilityState.ALLYSELECTABLE: sSprPath += "4"; break; case SelectabilityState.ENEMYSELECTABLE: sSprPath += "6"; break; default: Debug.Log("Unrecognized SelectabilityState: " + selectState); break; } Sprite sprSelectionGlow = Resources.Load(sSprPath, typeof(Sprite)) as Sprite; Debug.Assert(sprSelectionGlow != null, "Could not find specificed sprite: " + sSprPath); goCurSelectionGlow.GetComponent <SpriteRenderer>().sprite = sprSelectionGlow; }