Exemple #1
0
        void SendTriggerToAnimator(bool jump, bool landed, bool fall,
                                   bool dodge, bool hit, bool run_turn,
                                   bool run_stop, bool change_weapon_state,
                                   bool call_axe)
        {
            if (jump)
            {
                if (IsGrounded)
                {
                    anim_control.Launch("jump");
                    anim_control.ResetTrigger("land");
                }
            }

            if (landed)
            {
                anim_control.Launch("land");
            }

            if (fall)
            {
                anim_control.Launch("fall");
            }

            if (IsGrounded)
            {
                if (dodge)
                {
                    if (CurrentState == CharacterState.dodge)
                    {
                        anim_control.Launch("dodge_second");
                    }
                    else
                    {
                        anim_control.Launch("dodge_first");
                    }
                }
            }

            if (run_turn)
            {
                anim_control.Launch("run_turn");
            }


            if (run_stop)
            {
                anim_control.Launch("run_stop");
            }

            if (hit)
            {
                if (CurrentState == CharacterState.hit)
                {
                    anim_control.HitAnimation("follow");
                }
                else
                {
                    if (has_exec_target)
                    {
                        if (CurrentState == CharacterState.cinematic)
                        {
                            anim_control.Launch("ExecPunch");
                            ExecTargetAnim.Launch("ExecPunch");
                        }
                        else
                        {
                            LaunchExecutionProcedure();
                        }
                    }
                    else
                    {
                        anim_control.HitAnimation("hit");
                    }
                }
            }

            if (change_weapon_state)
            {
                anim_control.Launch("GetAxe");
            }

            if (call_axe)
            {
                anim_control.Launch("CallAxe");
            }
        }
Exemple #2
0
        void EnemyMove(bool grounded, bool landed, bool fall)
        {
            Vector3 mvt           = Vector3.zero;
            bool    dodge_input   = false;
            bool    sprint_input  = false;
            bool    sprint_attack = false;
            bool    walk_around   = false;
            bool    hit           = false;

            EnemyInput(out mvt, out dodge_input, out sprint_input, out sprint_attack, out walk_around, out hit);
            float enemy_mvt_intensity = Vector3.SqrMagnitude(mvt);

            SendTriggerToAnimator(false, landed, fall, dodge_input, false, false, false, false, false);
            if (sprint_input)
            {
                anim_control.Launch("sprint_attack");
            }
            if (sprint_attack)
            {
                anim_control.BoolControl("in_range", true);
            }
            if (walk_around)
            {
                anim_control.Launch("walk_around");
            }
            if (hit)
            {
                if (CurrentState == CharacterState.hit)
                {
                    anim_control.HitAnimation("follow");
                }
                else
                {
                    anim_control.HitAnimation("hit");
                }
            }

            if (GetComponent <EnemyAI>().IsWalkAround())
            {
                Vector3 look_at_ennemy = GetComponent <EnemyAI>().GetLookDirection();

                CharacterMovement.MoveCharacter(controller, transform,
                                                mvt, intensity: 1f, ref current_horizontal_speed,
                                                GroundSpeed, Acceleration, Decceleration,
                                                ref current_vertical_speed, JumpSpeed,
                                                GroundedGravity, AimAerialGravity, MaxFallSpeed,
                                                grounded, jump_trigger, RotationSpeed, false, face_direction: look_at_ennemy);
            }
            else
            {
                MoveLogic(mvt, enemy_mvt_intensity > 0.2f * 0.2f ? Mathf.Clamp01(enemy_mvt_intensity) : 0f, grounded, 0f);
            }
        }