示例#1
0
 void Update()
 {
     if (!isTravelling && !isDoingCurrentNode)
     {
         if (Input.GetAxis("Vertical") > 0 && currentGameNode.nodeUp)
         {
             if (currentGameNode.nodeUp.nodeStatus == NodeStatus.Unlocked || currentGameNode.nodeStatus == NodeStatus.Unlocked)
             {
                 StartCoroutine(Travel());
                 currentGameNode = currentGameNode.nodeUp;
                 currentGameNode.SetCurrent();
             }
         }
         if (Input.GetAxis("Vertical") < 0 && currentGameNode.nodeDown)
         {
             if (currentGameNode.nodeDown.nodeStatus == NodeStatus.Unlocked || currentGameNode.nodeStatus == NodeStatus.Unlocked)
             {
                 StartCoroutine(Travel());
                 currentGameNode = currentGameNode.nodeDown;
                 currentGameNode.SetCurrent();
             }
         }
         if (Input.GetAxis("Horizontal") > 0 && currentGameNode.nodeRight)
         {
             if (currentGameNode.nodeRight.nodeStatus == NodeStatus.Unlocked || currentGameNode.nodeStatus == NodeStatus.Unlocked)
             {
                 StartCoroutine(Travel());
                 currentGameNode = currentGameNode.nodeRight;
                 currentGameNode.SetCurrent();
             }
         }
         if (Input.GetAxis("Horizontal") < 0 && currentGameNode.nodeLeft)
         {
             if (currentGameNode.nodeLeft.nodeStatus == NodeStatus.Unlocked || currentGameNode.nodeStatus == NodeStatus.Unlocked)
             {
                 StartCoroutine(Travel());
                 currentGameNode = currentGameNode.nodeLeft;
                 currentGameNode.SetCurrent();
             }
         }
         if (Input.GetKeyDown(KeyCode.Space))
         {
             isDoingCurrentNode = true;
             StartCoroutine(executeLevel());
         }
     }
 }