コード例 #1
0
        public override void DrawNode(GameWorld world, DebugRender dr, Color color, bool selected)
        {
            dr.DrawPoint(WorldMatrix.TranslationVector, 0.5f, color, 1);

            var bbox1 = new BoundingBox(Width, Height, Depth);
            var bbox2 = new BoundingBox(0.5f, 0.5f, 0.5f);

            if (selected)
            {
                dr.DrawBox(bbox1, WorldMatrix, color);
            }
            else
            {
                dr.DrawBox(bbox2, WorldMatrix, color);
            }
        }
コード例 #2
0
        public override void DrawNode(GameWorld world, DebugRender dr, Color color, bool selected)
        {
            dr.DrawBasis(WorldMatrix, 1);
            Factory.Draw(dr, WorldMatrix, color);

            if (selected)
            {
                if (Entity != null)
                {
                    var targets = world.GetTargets(Factory.Target);

                    if (targets.Any())
                    {
                        dr.DrawBox(new BoundingBox(0.5f, 0.5f, 0.5f), WorldMatrix, Color.Yellow);
                    }

                    foreach (var target in targets)
                    {
                        var dir  = target.Position - Entity.Position;
                        var len  = dir.Length();
                        var dirn = dir.Normalized();

                        var p0 = Entity.Position;
                        var p1 = target.Position;

                        dr.DrawLine(p0, p1, Color.Yellow, Color.Yellow, 1, 1);
                    }
                }
            }
        }
コード例 #3
0
        public override void Draw(DebugRender dr, Matrix transform, Color color)
        {
            var w = Width / 2;
            var h = Height / 2;
            var d = Depth / 2;

            dr.DrawBox(new BoundingBox(new Vector3(-w, -h, -d), new Vector3(w, h, d)), transform, color);
            dr.DrawPoint(transform.TranslationVector, (w + h + d) / 3 / 2, color);
        }
コード例 #4
0
        public override void DrawNode(GameWorld world, DebugRender dr, Color color, bool selected)
        {
            dr.DrawBasis(WorldMatrix, 1, 2);

            if (scene != null && selected)
            {
                for (int i = 0; i < scene.Nodes.Count; i++)
                {
                    var node = scene.Nodes[i];

                    if (node.MeshIndex < 0)
                    {
                        continue;
                    }

                    dr.DrawBox(bboxes[node.MeshIndex], transforms[i] * WorldMatrix, color, 1);
                }
            }
        }
コード例 #5
0
ファイル: EntityFactory.cs プロジェクト: ttou73/IronStar
 /// <summary>
 /// Draws entity in editor
 /// </summary>
 /// <param name="dr"></param>
 /// <param name="transform"></param>
 /// <param name="color"></param>
 public virtual void Draw(DebugRender dr, Matrix transform, Color color)
 {
     dr.DrawBox(MapEditor.DefaultBox, transform, color);
 }
コード例 #6
0
    private void SetupSurroundingConstructions()
    {
        Bounds coumpoundObjectBounds = General.GetCoumpoundObjectBounds(base.gameObject);

        DebugRender.DrawBox(coumpoundObjectBounds, Color.blue);
        List <Construction> list = new List <Construction>();

        for (int i = 0; i < Construction.s_EnabledConstructions.Count; i++)
        {
            Construction construction = Construction.s_EnabledConstructions[i];
            if (construction.gameObject.activeSelf && construction.m_Info != null)
            {
                float magnitude = (construction.gameObject.transform.position - base.gameObject.transform.position).magnitude;
                if (magnitude <= 10f)
                {
                    float paramsMulRadius = ((ConstructionInfo)construction.m_Info).m_ParamsMulRadius;
                    if (paramsMulRadius >= 0f)
                    {
                        if (magnitude < paramsMulRadius)
                        {
                            list.Add(construction);
                        }
                    }
                    else
                    {
                        Bounds coumpoundObjectBounds2 = General.GetCoumpoundObjectBounds(construction.gameObject);
                        DebugRender.DrawBox(coumpoundObjectBounds2, Color.blue);
                        if (coumpoundObjectBounds2.Intersects(coumpoundObjectBounds))
                        {
                            list.Add(construction);
                        }
                    }
                }
            }
        }
        if (this.m_RestingPlace)
        {
            float num = ((ConstructionInfo)this.m_RestingPlace.m_Info).m_RestingParamsMul;
            for (int j = 0; j < list.Count; j++)
            {
                ConstructionInfo constructionInfo = (ConstructionInfo)list[j].m_Info;
                if (list[j] != null && list[j].HasRestInfluence())
                {
                    num *= constructionInfo.m_RestingParamsMul;
                }
            }
            this.m_ParamsMul = num;
        }
        this.m_Shelter = null;
        this.m_Firecamps.Clear();
        foreach (Construction construction2 in list)
        {
            if (construction2.GetType() == typeof(Firecamp))
            {
                this.m_Firecamps.Add((Firecamp)construction2);
            }
            else if (construction2.m_Info.m_ID.ToString().ToLower().Contains("shelter"))
            {
                this.m_Shelter = construction2;
            }
        }
    }