Ejemplo n.º 1
0
        private void nestedControllerCheck()
        {
            var parentPointCheck = transform.parent.parent.GetComponent <FireBase>();

            if (parentPointCheck != null)
            {
                parentPoint = parentPointCheck;
            }
        }
Ejemplo n.º 2
0
        public void cloneFirstEmitter()
        {
            if (EmitterAmount <= 1)
            {
                Utilities.Warn("Not enough Emitters to clone to (2 or more required).", this, transform.parent.parent); return;
            }
            if (FreezeEdits)
            {
                Utilities.Warn("Cannot clone while edits are frozen. Disable FreezeEdits temporarily in order to use clone procedure.", this, transform.parent.parent); return;
            }

            Action <FireBase> copyProcess = (FireBase src) =>
            {
                for (int i = 1; i < Emitters.Count; i++)
                {
                    FireBase targ = Emitters[i].transform.GetChild(0).gameObject.GetComponent <FireBase>();

                    targ.customIndicator = src.customIndicator;
                    targ.Shot            = src.Shot;
                    targ.ShotSpeed       = src.ShotSpeed;
                    targ.LocalOffset     = src.LocalOffset;
                    targ.makeNodeOnly    = src.makeNodeOnly;
                    targ.SpriteColor     = src.SpriteColor;
                    targ.LocalPitch      = src.LocalPitch;

                    if (src.GetType() == typeof(FireBullet)) //extended copying in case of FireBullet type emitter
                    {
                        FireBullet srcXT  = src as FireBullet;
                        FireBullet targXT = Emitters[i].transform.GetChild(0).gameObject.GetComponent <FireBullet>();

                        targXT.SpriteOverride        = srcXT.SpriteOverride;
                        targXT.ParentToEmitter       = srcXT.ParentToEmitter;
                        targXT.IgnoreGlobalRateScale = srcXT.IgnoreGlobalRateScale;
                        targXT.ShotRate         = srcXT.ShotRate;
                        targXT.PauseRate        = srcXT.PauseRate;
                        targXT.PauseLength      = srcXT.PauseLength;
                        targXT.ShotOverlap      = srcXT.ShotOverlap;
                        targXT.PoolingEnabled   = srcXT.PoolingEnabled;
                        targXT.AutoPool         = srcXT.AutoPool;
                        targXT.AutoPoolOverride = srcXT.AutoPoolOverride;
                        targXT.BankingEnabled   = srcXT.BankingEnabled;
                    }
                }
            };

            var scriptToClone = Emitters[0].transform.GetChild(0).gameObject.GetComponent <FireBase>();

            if (DefaultEmitter == PrefabType.Bullet)
            {
                copyProcess(scriptToClone as FireBullet);
            }
            else
            {
                copyProcess(scriptToClone as FireExpanding);
            }
        }