Beispiel #1
0
        public void Launch()
        {
            ShaderAnimator.Run();

            _ifxTargetAttacher.FindAndAttach(LaunchAnchorName, Emitter, transform);

            ProjectileWeapon.EarlyAim();
        }
        private void AddShaderAnimatorAndRun()
        {
            if (!AddShaderAnimator)
            {
                return;
            }

            if (_shaderAnimator != null)
            {
                _shaderAnimator.Run();
                return;
            }

            _shaderAnimator = gameObject.AddComponent <IFX_ShaderAnimator>();
            _shaderAnimator.DynamicShaderParameters = new[] { DynamicShaderParameter };
            _shaderAnimator.Run();
        }
Beispiel #3
0
        private void LateUpdate()
        {
            if (_targetAttacher.IsAttached)
            {
                _targetAttacher.Update();
                return;
            }

            var emitterAnchor = _targetAttacher.Target.position;

            var targetPos  = _isTargetReached ? emitterAnchor : ResultTargetPosition;
            var emitterPos = _isTargetReached ? ResultTargetPosition : emitterAnchor;

            var targetOffset = (targetPos - emitterPos).normalized * TargetOffset;

            targetPos += targetOffset;

            _shurikenPs.transform.rotation = Quaternion.Slerp(_shurikenPs.transform.rotation,
                                                              Quaternion.LookRotation(targetPos - _shurikenPs.transform.position), ShurikenMotionRotationSpeed * Time.deltaTime);

            _shurikenPs.transform.position += _shurikenPs.transform.forward * Time.deltaTime * ShurikenMotionSpeed;

            if (!_isTargetReached)
            {
                var distance = Vector3.Distance(_shurikenPs.transform.position, targetPos);
                if (distance <= ReturnDistance)
                {
                    _isTargetReached = true;
                }
            }
            else if (!_isTrailDissapearing)
            {
                var distance = Vector3.Distance(_shurikenPs.transform.position, emitterAnchor);
                if (distance <= DissapearDistance)
                {
                    TrailShaderAnimator.Run();
                    ShurikenShaderAnimator.Run();
                    _isTrailDissapearing = true;
                }
            }
        }
        private void LateUpdate()
        {
            if (_targetAttacher.IsAttached)
            {
                _targetAttacher.Update();
            }

            if (_isActivated && !_isExploded)
            {
                var distance = Vector3.Distance(GrenadeFx.transform.position, _lerpMotion.TargetPosition);
                if (distance <= ExplodeDistance)
                {
                    GrenadeMesh.gameObject.SetActive(false);
                    _explosionPs = Instantiate(ExplosionPs, Vector3.zero, Quaternion.identity, transform);
                    _explosionPs.transform.position = GrenadeFx.transform.position;
                    _explosionPs.Play();
                    _lerpMotion.Stop();
                    _isExploded = true;
                    TrailShaderAnimator.Run();
                }
            }
        }