コード例 #1
0
 /// <summary>
 ///   Main axis of the claw is duplicated or deleted whether the claw is going
 ///   downwards or upwards
 /// </summary>
 private void NodeUpdate()
 {
     if (nodes.Count > 0)
     {
         SpriteRenderer clone = null;
         clone            = nodes.Peek();
         clawLastPosition = clone.GetComponent <Collider2D> ().bounds.max;
     }
     else
     {
         clawLastPosition = clawNode.GetComponent <Collider2D>().bounds.max;
     }
     if (clawMechanism.GetComponent <Renderer> ().bounds.max.y - 0.04f < clawLastPosition.y && nodes.Count > 0)
     {
         SpriteRenderer clone = null;
         clone = nodes.Pop();
         clone.GetComponent <SpriteRenderer> ().enabled = false;
         nodesPool.Push(clone);
     }
     else if (clawMechanism.GetComponent <Renderer> ().bounds.min.y + 0.07f > clawLastPosition.y)
     {
         SpriteRenderer clone = null;
         if (nodesPool.Count == 0)
         {
             clone = (SpriteRenderer)Instantiate(clawNode.GetComponent <SpriteRenderer> (),
                                                 new Vector3(clawCenter.x, clawMechanism.clawInitialPos.y, clawCenter.z),
                                                 clawNode.transform.rotation);
         }
         else
         {
             // Create chain of nodes
             float positionY;
             if (nodes.Count > 0)
             {
                 positionY = nodes.Peek().GetComponent <SpriteRenderer>().bounds.max.y;
             }
             else
             {
                 positionY = clawMechanism.clawInitialPos.y;
             }
             clone = nodesPool.Pop();
             clone.GetComponent <SpriteRenderer> ().enabled = true;
             clone.transform.position = new Vector3(clawCenter.x, positionY, clawCenter.z);
         }
         clone.transform.SetParent(clawPerSe.transform);
         nodes.Push(clone);
     }
 }
コード例 #2
0
ファイル: ClawController.cs プロジェクト: jvmaia/MuvucaGame01
 void Awake()
 {
     clawMechanism    = GetComponentInChildren <ClawMechanism>();
     clawNode         = GetComponentInChildren <ClawNode>();
     clawPerSe        = GetComponentInChildren <ClawPerSe>();
     clawLastPosition = clawNode.GetComponent <Renderer>().bounds.center;
 }
コード例 #3
0
 void Awake() {
     clawMechanism = GetComponentInChildren<ClawMechanism>();
     clawNode = GetComponentInChildren<ClawNode>();
     clawPerSe = GetComponentInChildren<ClawPerSe>();
     heroStrong = FindObjectOfType<HeroStrong> ();
     heroFast = FindObjectOfType<HeroFast>();
     Terminal = GetComponentInChildren<InvisibleAreaTrigger>();
     clawLastPosition = clawNode.GetComponent<Renderer>().bounds.center;
     cameraControl = FindObjectOfType<CameraController>();
 }
コード例 #4
0
 void Awake()
 {
     clawMechanism    = GetComponentInChildren <ClawMechanism>();
     clawNode         = GetComponentInChildren <ClawNode>();
     clawPerSe        = GetComponentInChildren <ClawPerSe>();
     heroStrong       = FindObjectOfType <HeroStrong> ();
     heroFast         = FindObjectOfType <HeroFast>();
     Terminal         = GetComponentInChildren <InvisibleAreaTrigger>();
     clawLastPosition = clawNode.GetComponent <Renderer>().bounds.center;
     cameraControl    = FindObjectOfType <CameraController>();
 }