Beispiel #1
0
 private static IStatic CreateInstance(Type t, Vector2 position, ObjectsNode node)
 {
     if (node.Direction != Direction.none)
     {
         if (node.Direction == Direction.bottom)
         {
             return((IStatic)(Activator.CreateInstance(t, position, node.PipeType)));
         }
         else
         {
             return((IStatic)(Activator.CreateInstance(t, position, node.TransferedLocation, node.PipeType, node.Direction)));
         }
     }
     if (node.ItemCount == GeneralConstants.DefaultItemContained)
     {
         if (node.ItemType.Equals(StringConsts.NoItemContained))
         {
             return((IStatic)(Activator.CreateInstance(t, position)));
         }
         else
         {
             return((IStatic)(Activator.CreateInstance(t, position, Type.GetType(node.ItemType))));
         }
     }
     else if (node.ItemType.Equals(StringConsts.NoItemContained))
     {
         return((IStatic)(Activator.CreateInstance(t, position, node.ItemCount)));
     }
     else
     {
         return((IStatic)(Activator.CreateInstance(t, position, Type.GetType(node.ItemType), node.ItemCount)));
     }
 }
Beispiel #2
0
        private void VerticalLine(ObjectsNode node)
        {
            Type    t = Type.GetType(node.ObjectType);
            Vector2 position;

            position.X = node.Position.X;
            position.Y = node.Position.Y;
            for (int i = 0; i < node.Size; i++)
            {
                Statics.Add(CreateInstance(t, position, node));
                position.Y -= node.Width;
            }
        }
Beispiel #3
0
        private void LeftTriangle(ObjectsNode node)
        {
            Type    t = Type.GetType(node.ObjectType);
            Vector2 position;

            position.X = node.Position.X;
            position.Y = node.Position.Y;
            for (int i = 0; i < node.Size; i++)
            {
                for (int j = 0; j <= i; j++)
                {
                    position.X = node.Position.X + i * node.Width;
                    position.Y = node.Position.Y - j * node.Width;
                    Statics.Add(CreateInstance(t, position, node));
                    position.Y -= node.Width;
                }
            }
        }