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

            _originalMaterials = SFX_MaterialUtil.GetOriginalMaterials(gameObject);
            SFX_MaterialUtil.ReplaceMaterial(gameObject, Material);
        }
Esempio n. 2
0
        private void GetMaterialsAndFillCollection(GameObject targetGo)
        {
            var rendToMaterials = SFX_MaterialUtil.GetOriginalMaterials(targetGo);

            foreach (var rToMat in rendToMaterials)
            {
                _rendToMaterialsMap[rToMat.Key] = rToMat.Value;
            }
            SFX_MaterialUtil.AddMaterial(targetGo, Material);
        }
        public override void Run()
        {
            base.Run();

            //Revert
            SFX_InvokeUtil.RunLater(this, delegate
            {
                SFX_MaterialUtil.ReplaceMaterial(_originalMaterials);
                _originalMaterials.Clear();
            }, LifeTime);
        }
Esempio n. 4
0
        public override void Stop()
        {
            base.Stop();

            var timeDiff = Time.time - _addedTime;

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

            SFX_MaterialUtil.ReplaceMaterial(_rendToMaterialsMap);
            _rendToMaterialsMap.Clear();
            _isMaterialAdded = false;
        }