Beispiel #1
0
    protected override IEnumerator STATE()
    {
        _damageReceiver.ActiveLogic();
        if (string.IsNullOrEmpty(_soundFx))
        {
            _sfxAudioSource = SoundManager.Instance.PlaySoundEffect(_soundFx, true);
        }
        Transform leftHand  = _owner._avatarController.GetSlotNode(EnumEquipSlot.weapon_left);
        Transform rightHand = _owner._avatarController.GetSlotNode(EnumEquipSlot.weapon_right);

        while (!_isDead)
        {
            // ami to forward.
            Vector3 origin = (leftHand.position + rightHand.position) / 2.0f;
            Vector3 dir    = _owner.ThisTransform.forward;
            ThisTransform.position = origin;
            ThisTransform.LookAt(origin + dir * _range);
            Vector3 scale = _lineTransform.localScale;
            scale.z = _range;
            RaycastHit hitInfo;
            if (Physics.Raycast(origin, dir, out hitInfo, _range, _mask))
            {
                scale.z = (hitInfo.point - origin).magnitude;
            }
            _lineTransform.localScale = scale;
            // hurt enemys.
            foreach (EnemyInRange e in _enemys)
            {
                e._timer -= Time.deltaTime;
                if (e._timer <= 0.0f && e._ac.IsAlived)
                {
                    _fastCommand._param2 = e._ac;
                    CommandManager.Instance.SendFast(ref _fastCommand, e._ac);
                    IsHitSomeone(_owner, this, _damageType, e._ac);
                    e._timer = _hurtStep;
                }
            }
            yield return(null);
        }

        Dead();
    }
Beispiel #2
0
 public void ChangeForward(Vector3 lookToDir)
 {
     ThisTransform.LookAt(new Vector3(lookToDir.x, ThisTransform.position.y, lookToDir.z));
 }