Пример #1
0
        private void loadObjectivesLayer(LayerInfo layer)
        {
            //Load objectives
            for (int i = 0; i < layer.Objects.Length; i++)
            {
                ObjectInfo areaInfo = layer.Objects[i];
                RectangleF area     = new RectangleF(areaInfo.X, areaInfo.Y, areaInfo.Width, areaInfo.Height);

                const int scientistCount = 5;
                for (int k = 0; k < scientistCount; k++)
                {
                    Vector2   position  = new Vector2(RNG.NextFloat(area.Left, area.Right), area.Bottom - 2f);
                    Scientist scientist = new Scientist(map, position, area);

                    scientist.SetPhysicsBody(BodyFactory.CreateCircle(world, ConvertUnits.ToSimUnits(1f), 5f));
                    scientist.PhysicsBody.Position = ConvertUnits.ToSimUnits(position);
                    //scientist.PhysicsBody.BodyType = BodyType.Dynamic;
                    scientist.PhysicsBody.IsSensor = true;
                    scientist.IsImmortal           = true; //TODO: Consider killable scientists
                }

                map.ScientistCount += scientistCount;
            }
        }