コード例 #1
0
 private void DrawEffects(Vector3 effectVec)
 {
     effectVec.x += Rand.Range(-0.2f, 0.2f);
     effectVec.z += Rand.Range(-0.2f, 0.2f);
     SPT_Utility.ThrowGenericMote(this.moteDef, effectVec, this.Map, Rand.Range(.4f, .6f), Rand.Range(.05f, .1f), .03f, Rand.Range(.2f, .3f), Rand.Range(-200, 200), Rand.Range(.5f, 2f), Rand.Range(0, 360), Rand.Range(0, 360));
 }
コード例 #2
0
        public override void Tick()
        {
            base.Tick();
            if (!this.impacted)
            {
                Vector3 exactPosition = this.ExactPosition;
                if (this.ticksToImpact >= 0 && this.moteDef != null && Find.TickManager.TicksGame % this.moteFrequency == 0)
                {
                    DrawEffects(exactPosition);
                }
                this.ticksToImpact--;
                bool flag = !this.ExactPosition.InBounds(base.Map);
                if (flag)
                {
                    this.ticksToImpact++;
                    base.Position = this.ExactPosition.ToIntVec3();
                    this.Destroy(DestroyMode.Vanish);
                }
                else if (this.dispersalMethod == NaniteDispersal.Spray && !this.ExactPosition.ToIntVec3().GetTransmitter(this.Map).TransmitsPowerNow)
                {
                    this.earlyImpact = true;
                    this.impactForce = (this.DestinationCell - this.ExactPosition.ToIntVec3()).LengthHorizontal + (this.speed * .2f);
                    this.ImpactSomething();
                }
                else
                {
                    base.Position = this.ExactPosition.ToIntVec3();
                    //if (Find.TickManager.TicksGame % 3 == 0)
                    //{
                    //    MoteMaker.ThrowDustPuff(base.Position, base.Map, Rand.Range(0.6f, .8f));
                    //}

                    bool flag2 = this.ticksToImpact <= 0;
                    if (flag2)
                    {
                        if (this.curveVariance > 0)
                        {
                            if ((this.curvePoints.Count() - 1) > this.destinationCurvePoint)
                            {
                                this.origin = curvePoints[destinationCurvePoint];
                                this.destinationCurvePoint++;
                                this.destination   = this.curvePoints[this.destinationCurvePoint];
                                this.ticksToImpact = this.StartingTicksToImpact;
                            }
                            else
                            {
                                bool flag3 = this.DestinationCell.InBounds(base.Map);
                                if (flag3)
                                {
                                    base.Position = this.DestinationCell;
                                }
                                this.ImpactSomething();
                            }
                        }
                        else
                        {
                            bool flag3 = this.DestinationCell.InBounds(base.Map);
                            if (flag3)
                            {
                                base.Position = this.DestinationCell;
                            }
                            this.ImpactSomething();
                        }
                    }
                }
            }

            if (this.impacted)
            {
                if (this.ticksFollowingImpact > 0 && Find.TickManager.TicksGame % 2 == 0 && this.dispersalMethod == NaniteDispersal.Spray)
                {
                    //Spray nanites

                    SPT_Utility.ThrowGenericMote(SPT_DefOf.SPT_Mote_NanitesAir, this.ExactPosition, this.launcher.Map, Rand.Range(.8f, 1.2f), .3f, .01f, .3f, Rand.Range(-100, 100), 5, (Quaternion.AngleAxis(Rand.Range(80, 100), Vector3.up) * sprayVec).ToAngleFlat(), Rand.Range(0, 360));
                }

                if (this.ticksFollowingImpact > 0 && this.dispersalMethod == NaniteDispersal.ExplosionMist && this.impactRadius > 0 && Find.TickManager.TicksGame % 3 == 0)
                {
                    for (int i = 0; i < impactCells.Count; i++)
                    {
                        //Spray nanites

                        SPT_Utility.ThrowGenericMote(SPT_DefOf.SPT_Mote_NanitesAir, impactCells[i].ToVector3Shifted(), this.launcher.Map, Rand.Range(1.5f, 2f), .5f, .01f, Rand.Range(.5f, 1), Rand.Range(-500, 500), Rand.Range(2, 5), (Quaternion.AngleAxis(Rand.Range(80, 100), Vector3.up) * sprayVec).ToAngleFlat(), Rand.Range(0, 360));
                    }
                }

                this.ticksFollowingImpact--;

                if (this.ticksFollowingImpact < 0)
                {
                    this.Destroy(DestroyMode.Vanish);
                }
            }
        }