// // // Light Attack Switches // // public void LightAttackPlaying() { lightAttack = true; attackBoolRef.LightAttack(lightAttack); }
void Update() { attackCooldownTimer -= Time.deltaTime; UpdateRaycastOrigins(); ScaleChanger(); transform.localScale = scaleChange; //camPos = new Vector3(playerRB.position.x, playerRB.position.y, -10); //newCamPos = new Vector2(cameraOffSet, 0); if (Input.GetButtonDown("Jump") && grounded) { jump = true; } if (grounded) { dashCount = 1; gravity = 0f; if (canPlayLandingSound) { //playerSounds.LandingSound(); //canPlayLandingSound = false; } } else if (!grounded) { gravity = Input.GetButton("Jump") && canGlide ? glideGravity : 9.81f; //canPlayLandingSound = true; } airTime = !grounded ? airTime += Time.deltaTime : 0f; canGlide = airTime >= 1f ? true : false; dash = Input.GetKey(KeyCode.LeftShift) && canDash || Input.GetButton("Fire1") && canDash ? true : false; //Fire1 nappi toimii ainakin PS4 ohjaimen "R1" nappina if (Input.GetKeyDown(KeyCode.V)) //PlaceHolder napit hyökkäyksille { if (attackCooldownTimer < 0) { attackCooldownTimer = lightAttackCooldown; ChangeAnimationState("Silkie_Attack"); playerAttacks.LightAttack(); playerSounds.LightAttackSound(); } } else if (Input.GetKey(KeyCode.B) && playerAttacks.canDmgBuildUp) { playerAttacks.StartCoroutine("HeavyDMGBuildUp"); //playerAttacks.heavyAttackForce += Time.deltaTime; } else if (Input.GetKeyUp(KeyCode.B)) { playerAttacks.HeavyAttack(); playerAttacks.heavyAttackForce = playerAttacks.defaultHeavyAForce; playerAttacks.heavyAttackDMG = playerAttacks.defaultHeavyDMG; } if (attackCooldownTimer > 0) { // attack still going, don't change animation } else if (!grounded) { if (playerRB.velocity.y >= 0) { if (playerRB.velocity.y <= jumpMidThree_yTH) { ChangeAnimationState("Silkie_JumpMid_03"); } else if (playerRB.velocity.y <= jumpMidTwo_yTH) { ChangeAnimationState("Silkie_JumpMid_02"); } else if (playerRB.velocity.y <= jumpMidOne_yTH) { ChangeAnimationState("Silkie_JumpMid_01"); } else { ChangeAnimationState("Silkie_Jump"); } } else if (playerRB.velocity.y < 0) { if (Mathf.Abs(playerRB.velocity.y) >= fallSpeed) { ChangeAnimationState("Silkie_Falling"); } else if (Mathf.Abs(playerRB.velocity.y) >= jumpMidOne_yTH) { ChangeAnimationState("Silkie_JumpMid_06"); } else if (Mathf.Abs(playerRB.velocity.y) >= jumpMidTwo_yTH) { ChangeAnimationState("Silkie_JumpMid_05"); } else { ChangeAnimationState("Silkie_JumpMid_04"); } } } else if (Mathf.Abs(Input.GetAxis("Horizontal")) > 0.1f) { ChangeAnimationState("Silkie_Run"); } else { ChangeAnimationState("Silkie_Idle"); } }