Example #1
0
        private void CreateChunks(int ax, int az)
        {
            Random r = new Random();

            for (int x = (ax - rendDist); x < (ax + rendDist); x++)
            {
                for (int z = (az - rendDist); z < (az + rendDist); z++)
                {
                    Pair chunk = new Pair();
                    chunk.x = x;
                    chunk.z = z;
                    if (!chunks.Contains(chunk))
                    {
                        int y = 10;
                        if (0 < r.Next(0, 2))
                        {
                            y = 20;
                        }
                        List <Entity> entites   = CreateEntities(x, z, y);
                        BasicDraw     basicDraw = new BasicDraw(this);
                        basicDraw.renderEntities(entites);
                        basicDrawList.Add(basicDraw);
                        chunks.Add(chunk);
                    }
                }
            }
        }
Example #2
0
        public Node(Room room, ShapeType shapetype)
        {
            this.room = room;
            //("Everyone else must use the Parameterized constructor and pass a room reference.");
            name = name + nodeCounter;
            nodeCounter++;
            meta     = new Meta(this);
            movement = new Movement(this);

            Shape shape = null;

            if (shapetype == ShapeType.Circle)
            {
                shape = new Circle(defaultNodeSize);
            }
            else if (shapetype == ShapeType.Polygon)
            {
                shape = new Polygon();
            }

            body             = new Body(shape: shape, parent: this);
            body.radius      = defaultNodeSize;
            collision        = new Collision(this);
            basicdraw        = new BasicDraw(this);
            movement.active  = true;
            collision.active = true;
            basicdraw.active = true;
            IsAI             = false;
            affectAction     = (source, other) => {
                //todo: extend to check for every component for finer control if necessary
                if (source.parent.AffectExclusionCheck != null &&
                    source.parent.AffectExclusionCheck(other.parent))
                {
                    return;
                }
                foreach (Type t in source.parent.aOtherProps)
                {
                    if (!source.parent.comps[t].active)
                    {
                        continue;
                    }
                    source.parent.comps[t].AffectOther(other.parent);
                }
            };
        }
Example #3
0
 private void TssbtnCopy_Click(object sender, EventArgs e)
 {
     tssbtnPaste.Enabled = true;
     CopyCur             = pnMain.CopyCur();
 }