public virtual void StartStrike() { salvos++; if (!base.Spawned) { Log.Error("Called StartStrike() on unspawned thing.", false); return; } this.cooldownTicks = strikeDef.timeBetweenSalvos.SecondsToTicks(); if (RemainingSalvos > 0) { this.warmupTicks = strikeDef.warmupTicks; } if (this.angle == 0) { this.angle = OrbitalStrike.AngleRange.RandomInRange; } this.startTick = Find.TickManager.TicksGame; this.ThrowDebugText("Starting " + strikeDef.LabelCap + "", base.Position); CompAffectsSky comp = base.GetComp <CompAffectsSky>(); if (comp != null) { comp.StartFadeInHoldFadeOut(30, this.duration - 30 - 15, 15, 1f); } CompOrbitalBeam comp2 = base.GetComp <CompOrbitalBeam>(); if (comp2 != null) { comp2.StartAnimation(this.duration, 10, this.angle); } }
public override void SpawnSetup(Map map, bool respawningAfterLoad) { base.SpawnSetup(map, respawningAfterLoad); if (!respawningAfterLoad) { Vector3 vector = base.Position.ToVector3Shifted(); this.realPosition = new Vector2(vector.x, vector.z); this.direction = Rand.Range(0f, 360f); this.spawnTick = Find.TickManager.TicksGame; this.leftFadeOutTicks = -1; this.ticksLeftToDisappear = WarpRift.DurationTicks.RandomInRange; IntVec3 effectLoc = new IntVec3((int)realPosition.x, 0, (int)realPosition.y); CompAffectsSky comp = base.GetComp <CompAffectsSky>(); if (comp != null) { comp.StartFadeInHoldFadeOut(30, this.ticksLeftToDisappear - 30 - 15, 15, 1f); } CompOrbitalBeam comp2 = base.GetComp <CompOrbitalBeam>(); if (comp2 != null) { if (this.beamAngle == 0) { this.beamAngle = WarpRift.AngleRange.RandomInRange; } comp2.StartAnimation(this.ticksLeftToDisappear, 10, this.beamAngle); } } this.CreateSustainer(); }