Ejemplo n.º 1
0
 void FixedUpdate()
 {
     if (beingHeld)
     {
         ScoreController.getInstance().addHoldScore();
         beingHeldLineLength += ownerArrowController.speed * GameController.getInstance().getDeltaTime();
         if (beingHeldLineLength > holdLineLength)
         {
             Destroy(gameObject);
             Debug.Log("Perfect");
         }
         else
         {
             beingHeldLineRenderer.drawLine(beingHeldLineLength, followingNodes, 1);
         }
     }
     else
     {
         if (beingHeldLineLength > 0)
         {
             Destroy(gameObject);
             Debug.Log("Good");
         }
     }
     availableGuideLineLength += ownerArrowController.speed * GameController.getInstance().getDeltaTime();
     if (availableGuideLineLength < holdLineLength)
     {
         lineRenderer.drawLine(availableGuideLineLength, followingNodes, 2);
     }
     else
     {
         lineRenderer.drawLine(holdLineLength, followingNodes, 2);
     }
 }
 void FixedUpdate()
 {
     if (!GameController.getInstance().getPaused())
     {
         if (drawnGuideLineLength < GameController.getInstance().getGuideLineLength())
         {
             drawnGuideLineLength += speed * GameController.getInstance().getDeltaTime();
             lineRenderer.drawLine(drawnGuideLineLength, arrow.nodesToVector3().GetRange(nodeCounter, arrow.Nodes.Count - nodeCounter), 3);
         }
         else
         {
             if (!spriteRenderer.enabled)
             {
                 spriteRenderer.enabled = true;
             }
             Vector3 nextPosition = transform.position + speed * (destination - transform.position).normalized * GameController.getInstance().getDeltaTime();
             if (Vector3.Distance(nextPosition, destination) < Vector3.Distance(transform.position, destination))
             {
                 transform.position = nextPosition;
                 lineRenderer.drawLine(GameController.getInstance().getGuideLineLength(), arrow.nodesToVector3().GetRange(nodeCounter, arrow.Nodes.Count - nodeCounter), 3);
                 spawnKeys();
             }
             else
             {
                 ++nodeCounter;
                 ++traveledNode;
                 if (nodeCounter < arrow.Nodes.Count)
                 {
                     setDestination(arrow.Nodes [nodeCounter].Position.vector3());
                 }
                 else
                 {
                     gameObject.SetActive(false);
                 }
             }
         }
     }
 }
Ejemplo n.º 3
0
 void FixedUpdate()
 {
     if (childrenSpawnTime.Count > 0)
     {
         if (!childSpawned)
         {
             connectorLineLength += GameController.getInstance().getDeltaTime() * ownerArrowController.speed;
             lineRenderer.drawLine(connectorLineLength, ownerArrowController.arrow.nodesToVector3().GetRange(parentSpawnNode, ownerArrowController.arrow.Nodes.Count - parentSpawnNode), 2);
             if (childrenSpawnTime [0] <= GameController.getInstance().getTime() + GameController.getInstance().getGuideLineLength() / ownerArrowController.speed)
             {
                 spawnChild();
             }
         }
     }
 }