Ejemplo n.º 1
0
        private static bool NewBaseImpactMote(this MoteSubEffect MSE, out MoteThrown moteThrown)
        {
            if (!MSE.HasImpactMote)
            {
                Tools.Warn("NewBaseImpactMote - Failed to find impact mote; giving up", MSE.debug);
                moteThrown = null;
                return(false);
            }

            moteThrown              = (MoteThrown)ThingMaker.MakeThing(MSE.impactMote.moteDef);
            moteThrown.Scale        = MSE.impactMote.scale.RandomInRange;
            moteThrown.rotationRate = MSE.impactMote.rotationRate.RandomInRange;

            Tools.Warn("NewBaseImpactMote - ok", MSE.debug);

            return(true);
        }
Ejemplo n.º 2
0
        public static void ThrowImpactMote(this ShadowMote shadowMote)
        {
            if (!shadowMote.HasMSE || !shadowMote.MSE.HasImpactMote)
            {
                return;
            }

            Vector3 loc = shadowMote.exactPosition;
            Map     map = shadowMote.Map;

            MoteSubEffect MSE = shadowMote.MSE;

            //Tools.Warn("ThrowImpactMote ; has MSE; has impactMote", MSE.debug);

            if (!loc.AllowedMoteSpawn(map))
            {
                return;
            }
            //Tools.Warn("ThrowImpactMote ; AllowedMoteSpawn", MSE.debug);

            if (!MSE.NewBaseImpactMote(out MoteThrown moteThrown))
            {
                Tools.Warn("ThrowImpactMote ; NewBaseImpactMote ko; giving up", MSE.debug);
                return;
            }


            moteThrown.exactPosition = loc;
            //Tools.Warn("ThrowImpactMote ; what", MSE.debug);
            moteThrown.exactPosition += new Vector3(Rand.Range(-0.02f, 0.02f), 0f, Rand.Range(-0.02f, 0.02f));

            //Tools.Warn("ThrowImpactMote ; exactPosition ok", MSE.debug);

            moteThrown.SetVelocity(
                MSE.impactMote.angle.RandomInRange,
                MSE.impactMote.speed.RandomInRange
                );

            //Tools.Warn("ThrowImpactMote ; SetVelocity ok", MSE.debug);

            GenSpawn.Spawn(moteThrown, loc.ToIntVec3(), map);
            Tools.Warn("ThrowImpactMote ; GenSpawn.Spawn ok", MSE.debug);
        }