Esempio n. 1
0
        public Drone(WorldHandle world, string name, PlayerInteraction Player)
        {
            DroneConfig config = Serializer.Instance.Deserialize<DroneConfig>(new Path(name + ".drs"));
            _player = Player;

            _dictionaryRotors = new Dictionary<string, Rotor>();

            foreach (RotorDesc rotorSpecified in config.Rotors)
            {
                Rotor r = new Rotor(world.World, rotorSpecified, name);
                _dictionaryRotors.Add(rotorSpecified.Name, r);
            }
            _LIDAR = new LIDAR(world, name,_player, this);

            world.World.ActorAddedFiltered.Subscribe(new RegexFilter<IActor>(name + "[.]ComplexObject[.]" + config.BodyName), BindActor);
        }
Esempio n. 2
0
 public LIDAR(WorldHandle world, string name, PlayerInteraction Player, Drone drone)
 {
     //Register to actor insertion
     _name = "LIDAR" + Guid.NewGuid().ToString();
     _player = Player;
     world.World.ActorAddedFiltered.Subscribe(new RegexFilter<IActor>("[.]ComplexObject[.]Body"), BindActor);
     world.World.AddActuator(this);
     _world = world.World;
     _drone = drone;
     desc = new RayDesc();
     origin = new Vector3(0, (float)0.1, 0);
     rayVec = new Vector3[1081];
     iter = 0;
     int index = 0;
     for (double i = -45.0; i <= 225; i += 0.25)
     {
         rayVec[index] = new Vector3((float)(Math.Cos(i*(Math.PI/180.0))), 0, (float)(-1.0 * Math.Sin(i*(Math.PI/180.0))));
         index++;
     }
 }