예제 #1
0
        public void RenderAfterWorld(WorldRenderer wr, Actor self)
        {
            if (devMode == null || !devMode.ShowCombatGeometry)
            {
                return;
            }

            var wcr = Game.Renderer.WorldRgbaColorRenderer;
            var iz  = 1 / wr.Viewport.Zoom;

            if (healthInfo != null)
            {
                healthInfo.Shape.DrawCombatOverlay(wr, wcr, self);
            }

            var blockers = allBlockers.Where(Exts.IsTraitEnabled).ToList();

            if (blockers.Count > 0)
            {
                var hc     = Color.Orange;
                var height = new WVec(0, 0, blockers.Max(b => b.BlockingHeight.Length));
                var ha     = wr.ScreenPosition(self.CenterPosition);
                var hb     = wr.ScreenPosition(self.CenterPosition + height);
                wcr.DrawLine(ha, hb, iz, hc);
                TargetLineRenderable.DrawTargetMarker(wr, hc, ha);
                TargetLineRenderable.DrawTargetMarker(wr, hc, hb);
            }

            foreach (var attack in self.TraitsImplementing <AttackBase>().Where(x => !x.IsTraitDisabled))
            {
                DrawArmaments(self, attack, wr, wcr, iz);
            }
        }
예제 #2
0
        void IRenderAboveWorld.RenderAboveWorld(Actor self, WorldRenderer wr)
        {
            if (debugVis == null || !debugVis.CombatGeometry)
            {
                return;
            }

            var wcr = Game.Renderer.WorldRgbaColorRenderer;
            var iz  = 1 / wr.Viewport.Zoom;

            var blockers = allBlockers.Where(Exts.IsTraitEnabled).ToList();

            if (blockers.Count > 0)
            {
                var hc     = Color.Orange;
                var height = new WVec(0, 0, blockers.Max(b => b.BlockingHeight.Length));
                var ha     = wr.Screen3DPosition(self.CenterPosition);
                var hb     = wr.Screen3DPosition(self.CenterPosition + height);
                wcr.DrawLine(ha, hb, iz, hc);
                TargetLineRenderable.DrawTargetMarker(wr, hc, ha);
                TargetLineRenderable.DrawTargetMarker(wr, hc, hb);
            }

            var activeShapes = shapes.Where(Exts.IsTraitEnabled);

            foreach (var s in activeShapes)
            {
                s.Info.Type.DrawCombatOverlay(wr, wcr, self);
            }

            var tc        = Color.Lime;
            var positions = Target.FromActor(self).Positions;

            foreach (var p in positions)
            {
                var center = wr.Screen3DPosition(p);
                TargetLineRenderable.DrawTargetMarker(wr, tc, center);
                wcr.DrawLine(wr.Screen3DPosition(p - TargetPosHLine), wr.Screen3DPosition(p + TargetPosHLine), iz, tc);
                wcr.DrawLine(wr.Screen3DPosition(p - TargetPosVLine), wr.Screen3DPosition(p + TargetPosVLine), iz, tc);
            }

            foreach (var attack in self.TraitsImplementing <AttackBase>().Where(x => !x.IsTraitDisabled))
            {
                DrawArmaments(self, attack, wr, wcr, iz);
            }
        }
예제 #3
0
        void DrawArmaments(Actor self, AttackBase attack, WorldRenderer wr, RgbaColorRenderer wcr, float iz)
        {
            var c = Color.White;

            // Fire ports on garrisonable structures
            var garrison = attack as AttackGarrisoned;

            if (garrison != null)
            {
                var bodyOrientation = coords.Value.QuantizeOrientation(self, self.Orientation);
                foreach (var p in garrison.Info.Ports)
                {
                    var pos = self.CenterPosition + coords.Value.LocalToWorld(p.Offset.Rotate(bodyOrientation));
                    var da  = coords.Value.LocalToWorld(new WVec(224, 0, 0).Rotate(WRot.FromYaw(p.Yaw + p.Cone)).Rotate(bodyOrientation));
                    var db  = coords.Value.LocalToWorld(new WVec(224, 0, 0).Rotate(WRot.FromYaw(p.Yaw - p.Cone)).Rotate(bodyOrientation));

                    var o = wr.Screen3DPosition(pos);
                    var a = wr.Screen3DPosition(pos + da * 224 / da.Length);
                    var b = wr.Screen3DPosition(pos + db * 224 / db.Length);
                    wcr.DrawLine(o, a, iz, c);
                    wcr.DrawLine(o, b, iz, c);
                }

                return;
            }

            foreach (var a in attack.Armaments)
            {
                if (a.IsTraitDisabled)
                {
                    continue;
                }

                foreach (var b in a.Barrels)
                {
                    var muzzle    = self.CenterPosition + a.MuzzleOffset(self, b);
                    var dirOffset = new WVec(0, -224, 0).Rotate(a.MuzzleOrientation(self, b));

                    var sm = wr.Screen3DPosition(muzzle);
                    var sd = wr.Screen3DPosition(muzzle + dirOffset);
                    wcr.DrawLine(sm, sd, iz, c);
                    TargetLineRenderable.DrawTargetMarker(wr, c, sm);
                }
            }
        }
예제 #4
0
        public void RenderAfterWorld(WorldRenderer wr, Actor self)
        {
            if (devMode == null || !devMode.ShowCombatGeometry)
            {
                return;
            }

            var wcr = Game.Renderer.WorldRgbaColorRenderer;
            var iz  = 1 / wr.Viewport.Zoom;

            if (healthInfo != null)
            {
                healthInfo.Shape.DrawCombatOverlay(wr, wcr, self);
            }

            if (blockInfo != null)
            {
                var hc     = Color.Orange;
                var height = new WVec(0, 0, blockInfo.Height.Length);
                var ha     = wr.ScreenPosition(self.CenterPosition);
                var hb     = wr.ScreenPosition(self.CenterPosition + height);
                wcr.DrawLine(ha, hb, iz, hc);
                TargetLineRenderable.DrawTargetMarker(wr, hc, ha);
                TargetLineRenderable.DrawTargetMarker(wr, hc, hb);
            }

            // No armaments to draw
            if (attack.Value == null)
            {
                return;
            }

            var c = Color.White;

            // Fire ports on garrisonable structures
            var garrison = attack.Value as AttackGarrisoned;

            if (garrison != null)
            {
                var bodyOrientation = coords.Value.QuantizeOrientation(self, self.Orientation);
                foreach (var p in garrison.Info.Ports)
                {
                    var pos = self.CenterPosition + coords.Value.LocalToWorld(p.Offset.Rotate(bodyOrientation));
                    var da  = coords.Value.LocalToWorld(new WVec(224, 0, 0).Rotate(WRot.FromYaw(p.Yaw + p.Cone)).Rotate(bodyOrientation));
                    var db  = coords.Value.LocalToWorld(new WVec(224, 0, 0).Rotate(WRot.FromYaw(p.Yaw - p.Cone)).Rotate(bodyOrientation));

                    var o = wr.ScreenPosition(pos);
                    var a = wr.ScreenPosition(pos + da * 224 / da.Length);
                    var b = wr.ScreenPosition(pos + db * 224 / db.Length);
                    wcr.DrawLine(o, a, iz, c);
                    wcr.DrawLine(o, b, iz, c);
                }

                return;
            }

            foreach (var a in attack.Value.Armaments)
            {
                foreach (var b in a.Barrels)
                {
                    var muzzle    = self.CenterPosition + a.MuzzleOffset(self, b);
                    var dirOffset = new WVec(0, -224, 0).Rotate(a.MuzzleOrientation(self, b));

                    var sm = wr.ScreenPosition(muzzle);
                    var sd = wr.ScreenPosition(muzzle + dirOffset);
                    wcr.DrawLine(sm, sd, iz, c);
                    TargetLineRenderable.DrawTargetMarker(wr, c, sm);
                }
            }
        }