コード例 #1
0
 // Update is called once per frame
 void Update()
 {
     if (currentlyInteracting)
     {
         if (Input.GetKeyDown(KeyCode.Return))
         {
             if (!currentReaction.NextStep())
             {
                 if (!currentReactionCollection.TryNextReaction())
                 {
                     Debug.Log("Free to go");
                     currentReaction           = null;
                     currentReactionCollection = null;
                     currentlyInteracting      = false;
                     reactionDisplayArea.gameObject.SetActive(false);
                     Destroy(reactionDisplayArea.transform.GetChild(0).gameObject);
                     allowMovement.Raise();
                 }
                 else
                 {
                     currentReaction = currentReactionCollection.GetNextReaction();
                     Destroy(reactionDisplayArea.transform.GetChild(0).gameObject);
                     var reactionInstance = Instantiate(currentReaction.getReactionObject(), reactionDisplayArea.transform);
                     currentReaction.React(reactionInstance);
                 }
             }
         }
     }
 }
コード例 #2
0
 public void TriggerReaction(ReactionCollection reactionCollection)
 {
     if (!currentlyInteracting)
     {
         reactionDisplayArea.SetActive(true);
         currentlyInteracting      = true;
         currentReactionCollection = reactionCollection;
         currentReaction           = reactionCollection.GetNextReaction();
         var reactionInstance = Instantiate(currentReaction.getReactionObject(), reactionDisplayArea.transform);
         currentReaction.React(reactionInstance);
     }
     else
     {
         Debug.LogError("Can't run multiple reactions at once");
     }
 }