예제 #1
0
 public void activateOneButton(ActionType action, Sprite actionSprite, SpecificAction functionToCall)
 {
     if (currentActionButton <= 3)
     {
         actionsAvailable.Add(action);
         transform.GetChild(currentActionButton).GetChild(0).GetComponent <Image>().sprite = actionSprite;
         string actionName = GameManager.getActionTypeName(action);
         Text   text       = transform.GetChild(currentActionButton).GetChild(1).GetComponent <Text>();
         text.text = actionName;
         if (actionName.Contains(" "))
         {
             text.horizontalOverflow = HorizontalWrapMode.Wrap;
         }
         else
         {
             text.horizontalOverflow = HorizontalWrapMode.Overflow;
         }
         transform.GetChild(currentActionButton).GetComponent <Button>().onClick.RemoveAllListeners();
         transform.GetChild(currentActionButton).GetComponent <Button>().onClick.AddListener(() => { functionToCall(); });
         currentActionButton++;
     }
     else
     {
         Debug.LogError("ActionWheel, activateOneButton: Trois boutons ont déjà été activés !");
     }
 }
예제 #2
0
 public void activateOneButtonIfNeeded(ActionType action, Sprite actionSprite, SpecificAction functionToCall)
 {
     if (GameManager.gManager.playerInteractionAvailable() && !isActionDisplayed(action))
     {
         activateOneButton(action, actionSprite, functionToCall);
     }
 }