コード例 #1
0
    protected virtual void Awake()
    {
        _trailRenderer = GetComponent <TrailRenderer>();
        trailSettings.InitRenderer(ref _trailRenderer);
        _trailRenderer.emitting = false;

        _ibSpriteTrigger = GetComponent <IBSpriteTrigger>();
        _ibSpriteTrigger.Disable();
    }
コード例 #2
0
    protected IEnumerator ExeAttackCoroutine()
    {
        _isFollowing = false;
        _isAttacking = true;
        ResetPositionAndRotation();
        EnableTrail(attackTrailSettings);
        EnterCharacterSyncState();
        while (_commandBufferCount > 0)
        {
            _ibSpriteTrigger.Enable();
            if (attackSound)
            {
                _audioSource.PlayOneShot(attackSound.Source);
            }
            float timeStart = Time.time;
            float timeDiff;
            float lerp;
            do
            {
                yield return(null);

                timeDiff           = Time.time - timeStart;
                lerp               = timeDiff / thrustDuration;
                transform.position = Vector3.Lerp(InitialPosition, ThrustPosition, lerp);
            } while (timeDiff < thrustDuration);

            if (thrustBackMode == ThrustBackMode.Immediate)
            {
                yield return(null);

                ResetPositionAndRotation();
            }
            else
            {
                timeStart = Time.time;
                do
                {
                    yield return(null);

                    timeDiff           = Time.time - timeStart;
                    lerp               = timeDiff / thrustDuration;
                    transform.position = Vector3.Lerp(ThrustPosition, InitialPosition, lerp);
                } while (timeDiff < thrustDuration);
                ResetPositionAndRotation();
            }

            _ibSpriteTrigger.Disable();
            _commandBufferCount--;
        }
        _isCommandBufferFull = false;
        ExitCharacterSyncState();
        DisableTrail();
        _attackCoroutine = null;
        _isAttacking     = false;

        characterController.StartStaminaRecovery();
    }
コード例 #3
0
 public void Recycle()
 {
     _trailRenderer.Clear();
     _trailRenderer.emitting = false;
     ownerCollider           = null;
     DetectionSettings       = null;
     OnDetectCharacterEnter  = null;
     OnDetectCharacterExit   = null;
     _ibSpriteTrigger.Disable();
     _fired = false;
 }