コード例 #1
0
        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);
        }
コード例 #2
0
        public override void Run()
        {
            base.Run();

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

            if (RunAtStart)
            {
                IFX_InvokeUtil.RunLater(this, Run, RunDelay);
            }
        }
コード例 #4
0
        public void Activate()
        {
            CreateCurves(TargetPosition);

            var shadowHole = Instantiate(ShadowHole);

            shadowHole.transform.position = TargetPosition;

            if (Target != null)
            {
                IFX_InvokeUtil.RunLater(this, AddTargetComponents, TargetMotionDelay);
            }
        }
コード例 #5
0
        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;
        }
コード例 #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);
            }
        }
コード例 #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));
            }
        }
コード例 #8
0
 public void RunWithDelay()
 {
     IFX_InvokeUtil.RunLater(this, Run, RunDelay);
 }