예제 #1
0
        public static void AddBasicChild(BasicShipGameObject Object)
        {
            if (DrawItems.Count > Object.GetIntType())
            {
                if (DrawItems[Object.GetIntType()] != null)
                {
                    SortedChildren[Object.GetIntType()].AddLast(Object);
                    if (!DrawIdList.Contains(Object.GetIntType()))
                    {
                        DrawIdList.AddLast(Object.GetIntType());
                    }
                }
                else
                {
                    DrawItems[Object.GetIntType()] = Object.getDrawItem();
                    if (DrawItems[Object.GetIntType()] == null)
                    {
                        DrawItems[Object.GetIntType()] = new DrawShip(InstanceModelList.GetList()[Object.GetIntType()]);
                    }

                    SortedChildren[Object.GetIntType()] = new LinkedList <BasicShipGameObject>();
                    SortedChildren[Object.GetIntType()].AddLast(Object);
                    DrawIdList.AddLast(Object.GetIntType());
                    if (!DrawIdList.Contains(Object.GetIntType()))
                    {
                        DrawIdList.AddLast(Object.GetIntType());
                    }
                }
            }
            else
            {
                int c    = DrawItems.Count;
                int numb = Object.GetIntType() - c + 1;

                for (int i = 0; i < numb; i++)
                {
                    if (i + c != Object.GetIntType())
                    {
                        DrawItems.Add(null);
                        SortedChildren.Add(null);
                    }
                    else
                    {
                        DrawItems.Add(Object.getDrawItem());
                        if (DrawItems[Object.GetIntType()] == null)
                        {
                            DrawItems.Add(new DrawShip(InstanceModelList.GetList()[Object.GetIntType()]));
                        }

                        SortedChildren.Add(new LinkedList <BasicShipGameObject>());
                        SortedChildren[Object.GetIntType()].AddLast(Object);
                        if (!DrawIdList.Contains(Object.GetIntType()))
                        {
                            DrawIdList.AddLast(Object.GetIntType());
                        }
                    }
                }
            }
        }
예제 #2
0
        public static float AddChild(BasicShipGameObject UnitShip)
        {
            if (DrawItems.Count > UnitShip.GetIntType())
            {
                if (DrawItems[UnitShip.GetIntType()] != null)
                {
                    SortedChildren[UnitShip.GetIntType()].AddLast(UnitShip);
                    if (!DrawIdList.Contains(UnitShip.GetIntType()))
                    {
                        DrawIdList.AddLast(UnitShip.GetIntType());
                    }
                }
                else
                {
                    DrawItems[UnitShip.GetIntType()] = UnitShip.getDrawItem();
                    if (DrawItems[UnitShip.GetIntType()] == null)
                    {
                        DrawItems.Add(new DrawShip(InstanceModelList.GetList()[UnitShip.GetIntType()]));
                    }

                    SortedChildren[UnitShip.GetIntType()] = new LinkedList <BasicShipGameObject>();
                    SortedChildren[UnitShip.GetIntType()].AddLast(UnitShip);
                    DrawIdList.AddLast(UnitShip.GetIntType());
                    if (!DrawIdList.Contains(UnitShip.GetIntType()))
                    {
                        DrawIdList.AddLast(UnitShip.GetIntType());
                    }
                }
            }
            else
            {
                int c    = DrawItems.Count;
                int numb = UnitShip.GetIntType() - c + 1;

                for (int i = 0; i < numb; i++)
                {
                    if (i + c != UnitShip.GetIntType())
                    {
                        DrawItems.Add(null);
                        SortedChildren.Add(null);
                    }
                    else
                    {
                        DrawItems.Add(UnitShip.getDrawItem());
                        if (DrawItems[UnitShip.GetIntType()] == null)
                        {
                            DrawItems.Add(new DrawShip(InstanceModelList.GetList()[UnitShip.GetIntType()]));
                        }

                        SortedChildren.Add(new LinkedList <BasicShipGameObject>());
                        SortedChildren[UnitShip.GetIntType()].AddLast(UnitShip);
                        if (!DrawIdList.Contains(UnitShip.GetIntType()))
                        {
                            DrawIdList.AddLast(UnitShip.GetIntType());
                        }
                    }
                }
            }

            DrawShip r = (DrawShip)DrawItems[UnitShip.GetIntType()];

            return(r.ShipScale / 1.2f);
        }