void Awake() { mainCharacter = GameObject.FindWithTag("Player").GetComponent <ShootingMode>(); fixedJoint = GetComponent <FixedJoint2D> (); handleKilling = GameObject.FindWithTag("Player").GetComponent <EnemyKilling>(); arrowType = GetComponent <Shoot> (); tugComponent = mainCharacter.GetComponent <Tug> (); IgnoreOnCollisionEnter = false; }
public void attachCharacter() { mainCharacter.GetComponent <HingeJoint2D> ().enabled = true; mainCharacter.GetComponent <HingeJoint2D> ().connectedBody = oldCell.GetComponent <Rigidbody2D> (); mainCharacter.GetComponent <HingeJoint2D> ().connectedAnchor = new Vector2(0.0f, anchorBetweenCells); mainCharacter.GetComponent <HingeJoint2D>().anchor = anchorFromCharacter; mainCharacter.GetComponent <ChainConnection>().IsCharacterAttachedToChain = true; mainCharacter.GetComponent <Run>().StopRunning(); for (int i = 0; i < listOfChainCells.Count; i++) { Physics2D.IgnoreCollision(mainCharacter.GetComponent <Collider2D> (), listOfChainCells [i].GetComponent <Collider2D> ()); } mainCharacter.GetComponent <MoveAlongRope> ().ListOfChainCells = listOfChainCells; mainCharacter.GetComponent <MoveAlongRope>().resetMovedDistance(); GameObject.Find("CameraHolder").GetComponent <CountingArrows>().AddNewArrow(arrowWithChain, "Swing"); }
public void attachCharacter() { mainCharacter.GetComponent <HingeJoint2D> ().enabled = true; mainCharacter.GetComponent <HingeJoint2D> ().connectedBody = oldCell.GetComponent <Rigidbody2D> (); mainCharacter.GetComponent <HingeJoint2D> ().connectedAnchor = new Vector2(0.0f, anchorBetweenCells); }