public override void Run()
        {
            base.Run();

            _addedTime = Time.time;

            if (_isMaterialAdded)
            {
                return;
            }

            if (Targets != null && Targets.Length > 0)
            {
                foreach (var target in Targets)
                {
                    GetMaterialsAndFillCollection(target);
                }
            }
            else
            {
                GetMaterialsAndFillCollection(gameObject);
            }

            _isMaterialAdded = true;


            IFX_InvokeUtil.RunLater(this, Stop, LifeTime);
        }
        public override void Run()
        {
            base.Run();

            //Revert
            IFX_InvokeUtil.RunLater(this, delegate
            {
                IFX_MaterialUtil.ReplaceMaterial(_originalMaterials);
                _originalMaterials.Clear();
            }, LifeTime);
        }
Example #3
0
        private void OnEnable()
        {
            if (SetupAtStart)
            {
                Setup();
            }

            if (RunAtStart)
            {
                IFX_InvokeUtil.RunLater(this, Run, RunDelay);
            }
        }
        public void Activate()
        {
            CreateCurves(TargetPosition);

            var shadowHole = Instantiate(ShadowHole);

            shadowHole.transform.position = TargetPosition;

            if (Target != null)
            {
                IFX_InvokeUtil.RunLater(this, AddTargetComponents, TargetMotionDelay);
            }
        }
        public override void Stop()
        {
            base.Stop();

            var timeDiff = Time.time - _addedTime;

            if (timeDiff < LifeTime)
            {
                //call again
                IFX_InvokeUtil.RunLater(this, Stop, LifeTime - timeDiff);
                return;
            }

            IFX_MaterialUtil.ReplaceMaterial(_rendToMaterialsMap);
            _rendToMaterialsMap.Clear();
            _isMaterialAdded = false;
        }
Example #6
0
        public void Launch()
        {
            _originalPosition = transform.position;

            InvokeRepeating("Shake", 0, ShakeRate);

            IFX_InvokeUtil.RunLater(this, delegate
            {
                CancelInvoke("Shake");
                SetTarget();
            }, ShakeDuration);

            if (AudioSource != null && LaunchSoulsAudioClip != null)
            {
                IFX_InvokeUtil.RunLater(this, delegate { AudioSource.PlayOneShot(LaunchSoulsAudioClip); }, LaunchSoulsAudioDelay);
            }
        }
Example #7
0
        private IEnumerator CastSpell(Vector3 endPosition)
        {
            _launchPs.transform.position = LaunchPsTransform.position;
            _launchPs.transform.rotation = LaunchPsTransform.rotation;

            _hitPs.transform.position = TargetPosition;
            _hitPs.transform.rotation = Quaternion.FromToRotation(_hitPs.transform.up, TargetRotation) *
                                        _hitPs.transform.rotation;

            if (PlayLaunchCurveAudioOnce)
            {
                PlayLaunchCurveAudio();
            }

            foreach (var curveSpellSettings in Curves)
            {
                var lr = Instantiate(LineRenderer).GetComponent <LineRenderer>();

                lr.gameObject.SetActive(false);
                lr.transform.parent = transform.root;
                lr.enabled          = false;

                SetLineRendererPositions(lr, curveSpellSettings, endPosition);

                _lrs.Add(lr);

                IFX_InvokeUtil.RunLater(this, delegate
                {
                    _launchPs.Play();
                    if (!PlayLaunchCurveAudioOnce)
                    {
                        PlayLaunchCurveAudio();
                    }
                }, LaunchPsDelay);

                IFX_InvokeUtil.RunLater(this, () => _hitPs.Play(), HitPsDelay);

                yield return(new WaitForSeconds(InstantiateCurveDelay));
            }
        }
Example #8
0
 public void RunWithDelay()
 {
     IFX_InvokeUtil.RunLater(this, Run, RunDelay);
 }