PopOffEnd()

Found in:

private void PopOffEnd(){
    if(transform.childCount > 3){

      GameObject lastPop;
      //transform.GetChild(transform.childCount - 1).localPosition = new Vector2(transform.position.x, 0f);
      lastPop = Instantiate(segment, popOffSpot);
      lastPop.transform.localScale = (new Vector3(.54f, .54f, .54f));
      lastPop.GetComponent().freezeRotation = true;
      lastPop.GetComponent().normalSpeed = Random.Range(1f, 6f);
      lastPop.GetComponent().Separated = true;
      lastPop.GetComponent().startjumpCount(Random.Range(1f, 10f));
      lastPop.GetComponent().relocated = true;
      lastPop.transform.SetParent(popOffSpot, true);
      lastPop.transform.SetParent(null, true);
      lastPop.GetComponent().working = true;

      GameObject toDestroy = transform.GetChild(transform.childCount - 1).gameObject;
      toDestroy.transform.SetParent(null, true);
      Destroy(toDestroy);
            /*
            transform.GetChild(transform.childCount - 1).gameObject.GetComponent().normalSpeed = Random.Range(1F, 6F);
            transform.GetChild(transform.childCount - 1).gameObject.GetComponent().Separated = true;
            transform.GetChild(transform.childCount - 1).gameObject.AddComponent();
            transform.GetChild(transform.childCount - 1).gameObject.GetComponent().freezeRotation = true;
            transform.GetChild(transform.childCount - 1).gameObject.GetComponent().enabled = true;
            transform.GetChild(transform.childCount - 1).gameObject.GetComponent().startjumpCount(Random.Range(1f, 10f));
            transform.GetChild(transform.childCount - 1).SetParent(transform, false);*/
      enemyHealth.ResizeCluster();
    }else{
      ThisThangDed();
    } 
  }


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *