public void HandleLightMeleeAttack(WeaponItem weapon) { if (playerManager.isInteracting) { return; } weaponSlotManager.attackingWeapon = weapon; animatorHandler.PlayTargetAnimation(weapon.L_Attack_1, true); lastAttack = weapon.L_Attack_1; }
public void HandleWeaponCombo(WeaponItem weapon) { if (inputHandler.comboFlag) { animatorHandler.anim.SetBool("canDoCombo", false); if (lastAttack == weapon.OH_Light_Attack_1) { animatorHandler.PlayTargetAnimation(weapon.OH_Light_Attack_2, true); } } }
public IEnumerator TakeDamage(int damage) { yield return(null); animatorHandler.PlayTargetAnimation("TakeDamage"); UI.instance.SpawnPopupText(transform.position, damage, PopupType.Damage, "-"); curHp -= damage; UI.instance.UpdateHpBar(GameManager.instance.GetUnitId(this), (float)curHp / maxHp); if (curHp <= 0) { Die(); } }
public override void AttemptToCastSpell(AnimatorHandler animatorHandler, PlayerStats playerStats, WeaponSlotManager weaponSlotManager) { base.AttemptToCastSpell(animatorHandler, playerStats, weaponSlotManager); GameObject instantiateWarmUpSpellFX = Instantiate(spellWarmUpFX, weaponSlotManager.rightHandSlot.transform); //instantiateWarmUpSpellFX.gameObject.transform.localScale = new Vector3(100, 100, 100); animatorHandler.PlayTargetAnimation(spellAnimation, true); }
public virtual void TriggerAbility() { if (canUse) { OnSkillUse.Invoke(cooldownTime); Skill(); StartCooldown(); anim.PlayTargetAnimation(skillAnimation, true, 0.2f); pl.anim.Play(skillAnimation); } }
public void HandleRollAndSprint(float delta) //dodge stuff { if (animatorHandler.anim.GetBool("isInteracting")) { return; } if (inputHandler.rollFlag) { moveDirection = cameraObject.forward * inputHandler.vertical; moveDirection += cameraObject.right * inputHandler.horizontal; if (inputHandler.moveAmount >= 0) { animatorHandler.PlayTargetAnimation("Roll", true); moveDirection.y = 0; Quaternion rollRotation = Quaternion.LookRotation(moveDirection); myTransform.rotation = rollRotation; } } }
public void HandleRollingAndSprinting(float delta) { if (animatorHandler.anim.GetBool("isInteracting")) { return; } if (playerStats.currentStamina <= 0) //sino tiene stamina salirse de la funcion { return; } if (inputHandler.rollflag) { //si la variable en la clase inputHandler es true moveDirection = cameraObject.forward * inputHandler.vertical; moveDirection += cameraObject.right * inputHandler.horizontal; if (inputHandler.moveAmount > 0) { //si el personahe se mueve animatorHandler.PlayTargetAnimation("Rolling", true); moveDirection.y = 0; Quaternion rollRotation = Quaternion.LookRotation(moveDirection); myTransform.rotation = rollRotation; } else //sino { animatorHandler.PlayTargetAnimation("Backstep", true); } } }
public override void TakeDamage(int damage, string damageAnimation = "Take Damage") { if (isDead) { levelLoader.DeathScreen(); } currentHealth = currentHealth - damage; healthbar.SetCurrentHealth(currentHealth); animatorHandler.PlayTargetAnimation(damageAnimation, true); if (currentHealth <= 0) { currentHealth = 0; animatorHandler.PlayTargetAnimation("Death", true); isDead = true; levelLoader.DeathScreen(); //handle player death } }
public virtual void AttemptToConsumeItem(AnimatorHandler playerAnimatorManager, WeaponSlotManager weaponSlotManager, PlayerEffectsManager playerEffectsManager) { if (currentItemAmount > 0 && maxItemAmount >= currentItemAmount) //si tiene items que consumir { //hacer animacion playerAnimatorManager.PlayTargetAnimation(consumeAnimation, isInteracting); currentItemAmount = currentItemAmount - 1; } else { //hacer animacion de que no tiene mas consumibles , deteniendo al player un instante //playerAnimatorManager.PlayTargetAnimation("Shrug", true); } }
private void Update() { if (extraHealthActive) { timer += Time.deltaTime; if (timer > extraHealthSpeed) { extraHealth--; extraHealthBar.setCurrentHealth(extraHealth); timer = 0; } if (extraHealth <= 0) { extraHealth = 0; extraHealthActive = false; } } if (contadorMonedasActive) { timerMonedas += Time.deltaTime; if (timerMonedas > tiempoContadorMonedasActivo) { BarraMonedas.SetActive(false); timerMonedas = 0; } } if (FLAGcontadorMonedasActive) { timerMonedas = 0; contadorMonedasActive = true; FLAGcontadorMonedasActive = false; } if (FLAGcontadorMonedasActive) { timerMonedas = 0; contadorMonedasActive = true; FLAGcontadorMonedasActive = false; } if (FLAGGuende) { timerGuende += Time.deltaTime; if (timerGuende < 20) { staminaRegenTimer = 0; timerInf += Time.deltaTime; if (timerInf >= infectionSpeed) { if (extraHealth <= 0) { currentHealth -= vidaGuende; // vida actual - el danyo que te hacen healthBar.SetCurrentHealth(currentHealth); // actualizar la salud if (currentHealth <= 0) { currentHealth = 0; } } else { extraHealth -= vidaGuende; if (extraHealth < 0) { extraHealth = 0; } healthBar.SetCurrentHealth(currentHealth); extraHealthBar.setCurrentHealth(extraHealth); }; if (currentHealth <= 0) { rodySoundsManager.prepararSonido(0); animatorHandler.PlayTargetAnimation("Dead_01", true); if (SceneManager.GetActiveScene().name.Equals("nivel1")) { ScenesStaticClass.deadInNivel1(); } else if (SceneManager.GetActiveScene().name.Equals("arena_nyapos")) { ScenesStaticClass.deadInArenaNyapos(); } SceneManager.LoadScene("GameOver"); } timerInf = 0; } } else { vidaGuende = 0; timerGuende = 0; playerLocomotion.movementSpeed = normalSpeed; playerLocomotion.sprintSpeed = rollSpeed; FLAGGuende = false; } } if (FLAGFuego) { if (fireClone != null) { fireClone.transform.position = transform.position; } else { fireClone = GameObject.Find("ParticleFire(Clone)"); } timerFuego += Time.deltaTime; if (timerFuego > 60) { Destroy(fireClone); extraFireDamage = 0; FLAGFuego = false; } } }
public void HandleFalling(float delta, Vector3 moveDirection) { playerManager.isGrounded = false; RaycastHit hit; Vector3 origin = myTransform.position; origin.y += groundDetectionRayStartPoint; if (Physics.Raycast(origin, myTransform.forward, out hit, 0.4f)) { moveDirection = Vector3.zero; } if (playerManager.isInAir) { rigidbody.AddForce(-Vector3.up * fallingSpeed); rigidbody.AddForce(moveDirection * fallingSpeed / ledgePush); //The ledgePush acts like a force, making the character kind of leap forwards when falling. } Vector3 dir = moveDirection; dir.Normalize(); origin = origin + dir * groundDirectionRayDistance; targetPosition = myTransform.position; Debug.DrawRay(origin, -Vector3.up * minimumDistanceNeededToBeginFall, Color.red, 0.1f, false); if (Physics.Raycast(origin, -Vector3.up, out hit, minimumDistanceNeededToBeginFall, ignoreForGroundCheck)) { normalVector = hit.normal; Vector3 tp = hit.point; playerManager.isGrounded = true; targetPosition.y = tp.y; if (playerManager.isInAir) { if (inAirTimer > 0.5f) { Debug.Log("you were in the air for " + inAirTimer); //animatorHandler.PlayTargetAnimation("Land", true, 0.2f); //playerManager.anim.Play("Falling"); inAirTimer = 0; } else { //animatorHandler.PlayTargetAnimation("Movement", false, 0.2f); inAirTimer = 0; } playerManager.isInAir = false; } } else { if (playerManager.isGrounded) { playerManager.isGrounded = true; } if (playerManager.isInAir == false) { if (playerManager.isInteracting == false) { animatorHandler.PlayTargetAnimation("Falling", true, 0.2f); } Vector3 vel = rigidbody.velocity; vel.Normalize(); rigidbody.velocity = vel * (movementSpeed / 2); playerManager.isInAir = true; } } if (playerManager.isInteracting || inputHandler.moveAmount > 0) { myTransform.position = Vector3.Lerp(myTransform.position, targetPosition, Time.deltaTime / 0.1f); } else { myTransform.position = targetPosition; } if (playerManager.isGrounded) { if (playerManager.isInteracting || inputHandler.moveAmount > 0) { myTransform.position = Vector3.Lerp(myTransform.position, targetPosition, Time.deltaTime); } else { myTransform.position = targetPosition; } } }