public override void DrawGhost(ThingDef def, IntVec3 center, Rot4 rot, Color ghostCol, Thing thing = null)
        {
            base.DrawGhost(def, center, rot, ghostCol, thing);

            // Display effect zone.
            if (center.GetEdifice(Find.CurrentMap) == null)
            {
                List <IntVec3> cellsInAoe = Building_AlertSpeaker.GetAreaOfEffectCells(Find.CurrentMap, center);
                GenDraw.DrawFieldEdges(cellsInAoe);
            }
        }
Example #2
0
        /// <summary>
        /// Checks if a new alert speaker can be built at this location (must be near a wall) and draw effect area.
        /// </summary>
        public override AcceptanceReport AllowsPlacing(BuildableDef checkingDef, IntVec3 loc, Rot4 rot, Map map, Thing thingToIgnore = null)
        {
            // Check it is built near a wall.
            if (Building_AlertSpeaker.IsSupportAlive(map, loc, rot) == false)
            {
                return(new AcceptanceReport("Alert speaker must be built near a wall or tall edifice."));
            }

            // Display effect zone.
            if (loc.GetEdifice(map) == null)
            {
                List <IntVec3> cellsInAoe = Building_AlertSpeaker.GetAreaOfEffectCells(map, loc);
                GenDraw.DrawFieldEdges(cellsInAoe);
            }

            return(true);
        }
Example #3
0
        /// <summary>
        /// Performs the drawing treatment. Applies the drawing parameters.
        /// </summary>
        public override void Draw()
        {
            base.Draw();

            if ((currentDangerRate == StoryDanger.High) &&
                (this.powerComp.PowerOn))
            {
                redAlertLightMatrix.SetTRS(this.Position.ToVector3Shifted() + new Vector3(0f, 10f, -0.25f).RotatedBy(this.Rotation.AsAngle) + Altitudes.AltIncVect, (this.Rotation.AsAngle + redAlertLightAngle).ToQuat(), redAlertLightScale);
                Graphics.DrawMesh(MeshPool.plane10, redAlertLightMatrix, FadedMaterialPool.FadedVersionOf(redAlertLight, redAlertLightIntensity), 0);
            }

            if (Find.Selector.IsSelected(this))
            {
                List <IntVec3> aoeCells = Building_AlertSpeaker.GetAreaOfEffectCells(this.Map, this.Position);
                GenDraw.DrawFieldEdges(aoeCells);
            }
        }