예제 #1
0
파일: MeleeAnim.cs 프로젝트: Jadw1/LD40
    private void Update()
    {
        dt += Time.deltaTime;

        if (dt > animSpeed)
        {
            dt = 0.0f;

            if (isSwinging)
            {
                frame++;

                if (frame >= frames.Length)
                {
                    frame = 0;
                }

                if (frame == middleFrame)
                {
                    melee.MeleeAttack();
                    reachedMiddle = true;
                }
            }
            else
            {
                frame = 0;
            }

            renderer.sprite = frames[frame];
        }
    }
예제 #2
0
    void Update()
    {
        AbilitySelection();
        meleeRef.MeleeAttack();

        Ability1Handling();
        Ability2Handling();
        Ability3Handling();
        Ability4Handling();
    }
예제 #3
0
    private void Attack(GameObject target)
    {
        if (CanAttack == true)
        {
            AttackSound.Play();
            _meleeWeapon.MeleeAttack();
            CanAttack = false;

            if (target.gameObject.activeSelf == false)
            {
                GameObject newTarget = FindObjectOfType <Objective>().gameObject;

                EnemyTarget   = newTarget;
                FaceObjective = newTarget;
                gameObject.GetComponent <NavMeshAgent>().SetDestination(EnemyTarget.transform.position);
                GetComponent <NavMeshAgent>().isStopped = false;
            }
        }
    }