public void HandleBlock()
 {
     if (inputHandler.leftTriggerInput)
     {
         animationHandler.animator.SetBool("Block", true);
         animationHandler.PlayTargetAnimation("HoldBlock");
     }
     else
     {
         animationHandler.animator.SetBool("Block", false);
     }
 }
Exemple #2
0
        public void TakeDamage(int damange)
        {
            currentHealth -= damange;
            healthBar.SetCurrentHealth(currentHealth);

            if (currentHealth <= 0)
            {
                PlayerManager.instance.playerState = "dead";
                animationHandler.PlayTargetAnimation("SwordAndShieldDeath");
            }
        }
Exemple #3
0
        public void TakeDamage(int damange)
        {
            currentHealth -= damange;
            healthBar.SetCurrentHealth(currentHealth);
            Debug.Log(characterName + " took " + damange + " damage and have " + currentHealth + " remaining");
            if (currentHealth <= 0)
            {
                stateManager.characterState = CharacterState.Dead;
                taticalMovement.currentCell.occupyingObject = null;
                taticalMovement.currentCell.state           = CellState.open;
                animationHandler.PlayTargetAnimation("Death");
            }

            else if (stateManager.characterAction == CharacterAction.LyingDown)
            {
                animationHandler.PlayTargetAnimation("LyingHitReaction");
            }
            else
            {
                animationHandler.PlayTargetAnimation("MinorHitReaction");
            }
        }
Exemple #4
0
        public void TraverseToDestination(float delta)
        {
            if (ReachedPosition(transform.position, moveLocation))
            {
                UpdateGridState();
                characterRigidBody.velocity = Vector3.zero;
                animationHandler.PlayTargetAnimation("CombatIdle");

                animationHandler.UpdateAnimatorValues(delta, 0f);
                transform.position = moveLocation;
                currentPathIndex   = 0;
                SetCurrentNavDict();

                stateManager.characterAction   = CharacterAction.None;
                stateManager.characterState    = CharacterState.Ready;
                characterRigidBody.constraints = RigidbodyConstraints.FreezeAll;
                //Debug.Log(characterStats.characterName + " Reached Destination");
            }

            else
            {
                AlchemyManager.Instance.ApplyCellToPlayer(GridManager.Instance.GetCellByIndex(path[currentPathIndex]).GetComponent <CellAlchemyState>(), characterStateManager);
                if ((ReachedPosition(transform.position, nextPos)))
                {
                    currentPathIndex++;
                    SetNextPos(path[currentPathIndex]);
                }

                Vector3 currentDirection = (nextPos - transform.position);
                currentDirection.y = 0f;
                currentDirection.Normalize();
                HandleRotation(delta, currentDirection);

                characterRigidBody.velocity = movementSpeed * currentDirection;
                RaycastHit hit;
                if (Physics.Raycast(transform.position, Vector3.down, out hit, (1 << 0)))
                {
                    if (hit.distance > .6 && transform.position.y > nextPos.y + .2f)
                    {
                        characterRigidBody.velocity += Vector3.down * 10f;
                    }
                }
                animationHandler.UpdateAnimatorValues(delta, 1f);
            }
        }
Exemple #5
0
        public static void Activate(CharacterStats characterStats, AnimationHandler animationHandler, TaticalMovement taticalMovement, Skill skill, float delta)
        {
            IntVector2 index = taticalMovement.GetMouseIndex();

            GridManager.Instance.HighlightCastableRange(taticalMovement.currentIndex, index, skill);
            int distance = taticalMovement.GetRequiredMoves(index, taticalMovement.path);

            if (index.x >= 0 && characterStats.currentAP >= skill.APcost)
            {
                if (Input.GetMouseButtonDown(0) || InputHandler.instance.tacticsXInput)
                {
                    InputHandler.instance.tacticsXInput = false;

                    animationHandler.PlayTargetAnimation("Attack");
                    characterStats.UseAP(skill.APcost);
                    GridManager.Instance.RemoveAllHighlights();
                    List <GridCell> cells = CastableShapes.GetCastableCells(skill, index);
                    foreach (GridCell cell in cells)
                    {
                        AlchemyManager.Instance.ApplyLiquid(cell.alchemyState, LiquidPhaseState.Oil);
                    }
                }
            }
        }