示例#1
0
    // ========================================================================== //

    /* public - [Do] Function
     * 외부 객체가 호출(For External class call)*/

    public void DoMove(Vector3 vecDesireDirection)
    {
        //Vector3 vecPos = _pTransform.position + new Vector3(fSpeedX, 0.0f, fSpeedZ);
        //_pRigidbody.MovePosition(vecPos);

        if (_pCharacterModel.pStat == null)
        {
            return;
        }

        _pRigidbody.velocity = vecDesireDirection * _pCharacterModel.pStat.fSpeed * Time.deltaTime;

        bool bIsMove = vecDesireDirection.x != 0f || vecDesireDirection.z != 0f;

        if (bIsMove && _pAnimatorController.DoCheckIsPlaying(ECharacterAnimationName.Character_OnMove) == false)
        {
            _pAnimatorController.DoPlayAnimation(nameof(ECharacterAnimationName.Character_OnMove), PlayWalkSound);
        }
        else if (bIsMove == false && _pAnimatorController.DoCheckIsPlaying(ECharacterAnimationName.Character_OnMove))
        {
            _pAnimatorController.DoPlayAnimation(nameof(ECharacterAnimationName.Character_OnMove));
        }

        p_Event_OnMovePlayer.DoNotify(bIsMove, vecDesireDirection);
    }
示例#2
0
    // -----------------------

    public void DoAttack_Melee(GameObject pObjectTarget)
    {
        Weapon pWeaponCurrent = GetCurrentWeapon();

        pWeaponCurrent.DoFire_Weapon((pObjectTarget.transform.position - transform.position).normalized);
        p_pAnimator.DoPlayAnimation(ECharacterAnimationName.Character_OnAttack);

        var target = pObjectTarget.GetComponent <CharacterModel>();

        if (target == null)
        {
            return;
        }

        target.pStat.DoDamage((int)pWeaponCurrent.Damage);
        target.p_pAnimator.DoPlayAnimation(ECharacterAnimationName.Character_OnHit);
        target.SendMessage(nameof(IResourceEventListener.IResourceEventListener_Excute), "OnHit", SendMessageOptions.DontRequireReceiver);
    }