void Update() { //print ("x " +rb.velocity.x.ToString()); //print ("y " + rb.velocity.y.ToString()); //print(CurrGameobj.name); ///////////////////////////////////////////////// //Handling of clicking and dragging for pounce if (Input.GetMouseButtonDown(0) && Vector3.Distance(MF.FindMouse(), gameObject.transform.position) <= AttachDistance && !TL.isTurning) { isClicked = true; initPos = MF.FindMouse2D(); } else if (Input.GetMouseButtonUp(0)) { if (isClicked) { isClicked = false; Char.isImmobile = false; endPos = MF.FindMouse2D(); transform.parent = null; PrevGameobj = CurrGameobj; LaunchCharacter(); } } ////////////////////////////////////////////////////////// //Makes player immobile if (Char.isImmobile) { rb.gravityScale = 0; rb.velocity = Vector2.zero; } else if (!Char.isImmobile) { rb.gravityScale = 1; } }
void Update() { //Checks for controller InputDevice inDev = InputManager.ActiveDevice; //print (inDev.RightStickX); //updates controller if (inDev != null) { UpdateInDev(inDev); } //Increases power //if you change the values change them in start too if (rightBeingUsed) { //Checks if the cat is charging if (!Char.isFalling && !Char.isJumping && (RCc.attachBottomAny || RCc.attachBottom || RCc.attachBottomBox) && !TL.isTurningLeft && !TL.isTurningRight) { Char.isCharging = true; } else { Char.isCharging = false; } if (powerVal < 22) { if (!isIncreasing) { StartCoroutine(IncreasePower()); } } } else if (!rightBeingUsed) { powerVal = 7; Char.isCharging = false; } if (Input.GetKeyDown(KeyCode.Return)) { } ///////////////////////////////////////////////////// if (inDev.RightTrigger.WasPressed && rightBeingUsed && (!TL.isTurningRight || !TL.isTurningLeft) && Char.canJump) { Char.canJump = false; Char.isImmobile = false; Char.canMove = false; Char.isJumping = true; RCc.attachBottom = false; rb.velocity = Vector2.zero; endPos = MF.FindMouse2D(); transform.parent = null; PrevGameobj = CurrGameobj; LaunchCharacter(); print("Jumped"); } ////////////////////////////////////////////////////////// //Makes player immobile if (Char.isImmobile) { rb.isKinematic = true; rb.velocity = Vector2.zero; } else if (!Char.isImmobile) { //rb.gravityScale=1; rb.isKinematic = false; } /*if(!rightBeingUsed) * { * Char.isRunningRight = false; * Char.isRunningLeft = false; * }*/ if (Char.isJumping && (RCc.attachLeft || RCc.attachRight)) { } }