Inheritance: MonoBehaviour
Exemple #1
0
    public static void CallBack(ROSBridgeMsg msg)
    {
        EnvironmentMsg poseMsg = (EnvironmentMsg)msg;

        if (poseMsg.id_.Contains("hoop"))
        {
            char numID = poseMsg.id_[poseMsg.id_.Length - 1];
            //Debug.Log("Got a tf message: " + poseMsg.id_[poseMsg.id_.Length - 1]);

            GameObject currentHoop = null;

            if (!WorldProperties.hoopsDict.ContainsKey(numID))
            {
                GameObject world = GameObject.FindWithTag("World");
                currentHoop = Object.Instantiate(world.GetComponent <WorldProperties>().torus);
                currentHoop.transform.parent     = world.transform;
                WorldProperties.hoopsDict[numID] = currentHoop;
                Debug.Log("Made hoop with id: " + numID);
            }
            else
            {
                currentHoop = WorldProperties.hoopsDict[numID];
            }

            currentHoop.transform.localPosition = WorldProperties.RosSpaceToWorldSpace(poseMsg.x_, poseMsg.y_, poseMsg.z_) +
                                                  WorldProperties.torusModelOffset;
            currentHoop.transform.localRotation = new Quaternion(poseMsg.x_rot_ + 1, poseMsg.y_rot_, poseMsg.z_rot_, poseMsg.w_rot_);
        }
    }
Exemple #2
0
        public void WorldProperties_SaveAndLoad()
        {
            var rootFolder = TestFolder + "/Saves/newworld01";

            Directory.CreateDirectory(rootFolder);

            var props = new WorldProperties
            {
                ChunkSize = new GridSize(2),
                WorldName = "New World",
            };

            var handler     = new WorldPropertiesHandler();
            var saveTask    = handler.Save(rootFolder, props);
            var saveResults = saveTask.FinishTask();

            Assert.IsNull(saveResults.Error);
            Assert.IsTrue(saveResults.SuccessfullySaved);

            var loadTask    = handler.Load(rootFolder);
            var loadResults = loadTask.FinishTask();

            Assert.IsNull(saveResults.Error);
            Assert.IsTrue(loadResults.SuccessfullyLoaded);
            Assert.AreEqual(props, loadResults.Data);
        }
Exemple #3
0
    /// <summary>
    /// Updates data of each text box
    /// </summary>e
    void Update()
    {
        if (initialized)
        {
            foreach (KeyValuePair <Text, string> item in infoTextsDict)
            {
                item.Key.text = connection.GetValueByTopic(item.Value);
            }

            Vector3       dronePosition = this.gameObject.transform.localPosition;
            GPSCoordinate gps           = WorldProperties.UnityCoordToGPSCoord(dronePosition);
            dronePosText.text = "Lat:   " + String.Format("{0:0.0000000}", gps.Lat) + "\nLon: " + String.Format("{0:0.0000000}", gps.Lng);

            if (connection.HasAuthority())
            {
                droneAuthorityText.text  = "Controllable";
                droneAuthorityText.color = Color.green;
            }
            else
            {
                droneAuthorityText.text  = "Request Authority";
                droneAuthorityText.color = Color.white;
            }

            // Make canvas always face the user as drone moves
            headsetTransform = VRTK_DeviceFinder.HeadsetTransform();
            if (headsetTransform != null)
            {
                Vector3 targetPosition = headsetTransform.position;
                // canvas LookAt code is funky. Credit: https://answers.unity.com/questions/132592/lookat-in-opposite-direction.html
                menuCanvas.transform.LookAt(2 * menuCanvas.transform.position - targetPosition);
            }
        }
    }
 private static BoundingBox CalculateExtent(TiffProperties tiffProperties, WorldProperties worldProperties)
 {
     var minX = worldProperties.XCenterOfUpperLeftPixel - worldProperties.PixelSizeX * 0.5;
     var maxX = minX + worldProperties.PixelSizeX * tiffProperties.Width + worldProperties.PixelSizeX * 0.5;
     var maxY = worldProperties.YCenterOfUpperLeftPixel + worldProperties.PixelSizeY * 0.5;
     var minY = maxY + worldProperties.PixelSizeY * tiffProperties.Height - worldProperties.PixelSizeY * 0.5;
     return new BoundingBox(minX, minY, maxX, maxY);
 }
Exemple #5
0
 public override void DrawCall(SpriteBatch spriteBatch, WorldProperties worldProperties)
 {
     // loop through all layers to draw them
     foreach (TileLayer layer in Layers)
     {
         layer.DrawCall(spriteBatch, worldProperties);
     }
 }
Exemple #6
0
 public override void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch, WorldProperties worldProperties)
 {
     for (int y = 0; y < this.LadderHeight; y++)
     {
         base.Draw(spriteBatch, worldProperties);
         worldProperties.Position.Y += this.Texture.Height;
     }
 }
    void OnClickEvent()
    {
        if (surface_pointcloud)
        {
            Debug.Log("Switching to surface point cloud");
            GameObject sensor = WorldProperties.GetSelectedSensor();
            LampSensor_ROSSensorConnection lampSensor_ROS = sensor.GetComponent <LampSensor_ROSSensorConnection>();
            //lampSensor_ROS.Unsubscribe();
        }

        if (Level_0)
        {
            Debug.Log("Switching to Level 0");
            GameObject sensor = WorldProperties.GetSelectedSensor();
            LampSensor_ROSSensorConnection lampSensor_ROS = sensor.GetComponent <LampSensor_ROSSensorConnection>();
            //lampSensor_ROS.Unsubscribe();
        }

        if (Level_1)
        {
            Debug.Log("Switching to Level 1");
            GameObject sensor = WorldProperties.GetSelectedSensor();
            LampSensor_ROSSensorConnection lampSensor_ROS = sensor.GetComponent <LampSensor_ROSSensorConnection>();
            //lampSensor_ROS.Unsubscribe();
        }

        if (Level_2)
        {
            Debug.Log("Switching to Level 2");
            GameObject sensor = WorldProperties.GetSelectedSensor();
            LampSensor_ROSSensorConnection lampSensor_ROS = sensor.GetComponent <LampSensor_ROSSensorConnection>();
            //lampSensor_ROS.Unsubscribe();
        }


        if (Level_3)
        {
            Debug.Log("Switching to Level 3");
            GameObject sensor = WorldProperties.GetSelectedSensor();
            LampSensor_ROSSensorConnection lampSensor_ROS = sensor.GetComponent <LampSensor_ROSSensorConnection>();
            //lampSensor_ROS.Unsubscribe();
        }

        if (Level_4)
        {
            Debug.Log("Switching to Level 4");
            GameObject sensor = WorldProperties.GetSelectedSensor();
            LampSensor_ROSSensorConnection lampSensor_ROS = sensor.GetComponent <LampSensor_ROSSensorConnection>();
            //lampSensor_ROS.Unsubscribe();
        }

        if (Level_5)
        {
            Debug.Log("Switching to Level 5");
            GameObject sensor = WorldProperties.GetSelectedSensor();
            LampSensor_ROSSensorConnection lampSensor_ROS = sensor.GetComponent <LampSensor_ROSSensorConnection>();
        }
    }
Exemple #8
0
        private static BoundingBox CalculateExtent(TiffProperties tiffProperties, WorldProperties worldProperties)
        {
            var minX = worldProperties.XCenterOfUpperLeftPixel - worldProperties.PixelSizeX * 0.5;
            var maxX = minX + worldProperties.PixelSizeX * tiffProperties.Width + worldProperties.PixelSizeX * 0.5;
            var maxY = worldProperties.YCenterOfUpperLeftPixel + worldProperties.PixelSizeY * 0.5;
            var minY = maxY + worldProperties.PixelSizeY * tiffProperties.Height - worldProperties.PixelSizeY * 0.5;

            return(new BoundingBox(minX, minY, maxX, maxY));
        }
Exemple #9
0
        public static void drawChunks(World world, GizmoType type)
        {
            return; // Temporary to fix issues...

            WorldProperties         properties = world.properties;
            List <ChunkWorldObject> chunks     = world.activeChunks;

            if (chunks != null && world != null)
            {
                // Draw the chunks
                for (int i = 0; i < chunks.Count; i++)
                {
                    ChunkWorldObject obj   = chunks[i];
                    Chunk            chunk = obj.chunk;

                    if (chunk != null)
                    {
                        int size = Chunk.tileDimension;

                        if (chunk.dirty)
                        {
                            Gizmos.color = Color.red;
                        }
                        else
                        {
                            Gizmos.color = Color.green;
                        }

                        //       Gizmos.DrawWireCube(obj.transform.position + new Vector3(size / 2, size / 2, 0) - new Vector3(0.5f, 0.5f, 0.0f), new Vector3(size, size, 0));

                        Vector2I pos = chunk.position;
                    }
                }

                MapHandler    handler = world.mapHandler;
                List <Sector> sectors = handler.activeSectors;

                // Draw the sectors
                for (int i = 0; i < sectors.Count; i++)
                {
                    Sector sector = sectors[i];

                    if (sector != null)
                    {
                        Vector2I pos = sector.position;

                        int size = Sector.chunkDimension * Chunk.tileDimension;

                        Vector3 wPos = Vector3.zero;

                        Gizmos.color = Color.white;

                        Gizmos.DrawWireCube(new Vector3((pos.x * size) + (size / 2.0f), (pos.y * size) + (size / 2.0f), 0) - new Vector3(0.5f, 0.5f, 0.0f), new Vector3(size, size, 0));
                    }
                }
            }
        }
Exemple #10
0
    void ApplyVerticalVelocity()
    {
        float NewYDistance;

        NewYDistance = Velocity.y * WorldProperties.GetDeltaTime();

        NewYDistance = ConstrainVerticalVelocity(NewYDistance);

        transform.position += new Vector3(0, NewYDistance, 0);
    }
Exemple #11
0
    /// <summary>
    /// Initialize all drones and sensors
    /// </summary>
    void Start()
    {
        foreach (ROSDroneConnectionInput rosDroneConnectionInput in DronesList)
        {
            InstantiateDrone(rosDroneConnectionInput);
        }

        success = true;
        WorldProperties.SelectNextDrone();
    }
 private void HideAll()
 {
     WorldProperties.Hide();
     eventStuff.Hide();
     eventStuff.SendToBack();
     EventList.Hide();
     EventList.SendToBack();
     RulesetStuff.Hide();
     RulesetStuff.SendToBack();
 }
 private void SaveClicked(object sender, RoutedEventArgs e)
 {
     if (currentSavedFileName != "")
     {
         WorldProperties.PersistChanges(currentSavedFileName);
     }
     else
     {
         SaveAsClicked(sender, e);
     }
 }
            public UserpointInstruction(Waypoint sendPoint, string action_)
            {
                curr_id = sendPoint.id;
                prev_id = sendPoint.prevPathPoint.id;

                Vector3 rosPos = WorldProperties.WorldSpaceToRosSpace(sendPoint.gameObjectPointer.transform.localPosition);

                x      = (double)rosPos.x;
                y      = (double)rosPos.y;
                z      = (double)rosPos.z;
                action = action_;
            }
Exemple #15
0
    void Awake()
    {
        //  MapLoader.loadSector(new Vector2I(0, 0));
        //SaveGame.Instance.RefreshScene();
        instance    = this;
        _properties = Resources.Load <WorldProperties>("World Properties");

        _chunkPool = new Pool <ChunkWorldObject>();

        Atlas.initialize();
        ItemStore.initialize();
        EntityStore.initialize();
        RecipeManager.loadRecipes();
        CollisionGrid.initialize(this, _properties.worldDimension * _properties.chunkDimension);
        TileStore.initialize();
        Mesher.initialize();

        int half = (_properties.worldDimension - 1) / 2;

        Vector2I spawnPos = new Vector2I(3, 3);

        _position = spawnPos - new Vector2I(half, half);

        // Create and initialize the map handler behaviour
        _mapHandler = new MapHandler(this, spawnPos);

        //_mapHandler.setPosition(new Vector2I(0, 0));
        //_mapHandler.populateSectors();

        //_mapHandler.updatePosition(new Vector2I(0, 0));

        createWorld();
        createLoader(spawnPos);
        //createLoader(spawnPos);
        if (SaveGame.Instance.IsSaveGame)
        {
            getPlayerPos();
        }
        // TEMP
        CollisionGrid.rebuildMap();

        return;

        for (int i = 0; i < 4; i++)
        {
            EntityItem entity = (EntityItem)EntityStore.createEntity(0);
            entity.itemID             = i;
            entity.transform.position = new Vector3(5 + i, 10, 5);
        }
    }
        public void HandlerNotFound_ThrowsError()
        {
            var rootFolder = TestFolder + "/Saves/world15";
            var db         = new WorldDatabase(rootFolder);

            var props = new WorldProperties
            {
                ChunkSize = new GridSize(2),
                WorldName = "New World",
            };

            Assert.Throws <System.ArgumentException>(() => db.SaveObject(props));
            Assert.Throws <System.ArgumentException>(() => db.LoadObject(props));
        }
        public override void Draw(SpriteBatch spriteBatch, WorldProperties worldProperties)
        {
            worldProperties.Position.X *= this.ScrollFactor.X;
            worldProperties.Position.Y *= this.ScrollFactor.Y;

            spriteBatch.Draw(
                this.Emitter.Data.BaseTexture,
                this.Position,
                this.SourceRectangle,
                this.Color * worldProperties.Alpha,
                this.Rotation,
                this.Origin,
                this.Scale,
                this.SpriteEffects,
                Node.GetDrawDepth(this.Depth));
        }
Exemple #18
0
    public static WorldProperties world;    //Static instance

    void Awake()
    {
        life         = new List <LifeForm>();
        newBornQueue = new List <LifeForm>();

        //create first lifeform
        life.Add(Instantiate(starterLifeform).GetComponent <LifeForm>());

        activeLife = true;
        paused     = false;

        world     = this;
        stepCount = 0;

        StartCoroutine("LifeGoesOn");
    }
        public override void Draw(SpriteBatch spriteBatch, WorldProperties worldProperties)
        {
            worldProperties.Position.X *= this.ScrollFactor.X;
            worldProperties.Position.Y *= this.ScrollFactor.Y;

            spriteBatch.Draw(
                this.Emitter.Data.BaseTexture,
                this.Position,
                this.SourceRectangle,
                this.Color * worldProperties.Alpha,
                this.Rotation,
                this.Origin,
                this.Scale,
                this.SpriteEffects,
                Node.GetDrawDepth(this.Depth));
        }
        // World Stuff

        private void ShowWorldProperties()
        {
            HideAll();
            if (selectedObject is StartupWorld)
            {
                Bt_WorldChange.Enabled = false;
                Bt_WorldClear.Enabled  = false;
            }
            else
            {
                Bt_WorldChange.Enabled = true;
                Bt_WorldClear.Enabled  = true;
            }
            worldName.Text = ((World)selectedObject).Name;
            WorldProperties.Show();
            WorldProperties.BringToFront();
        }
Exemple #21
0
    //-----------------------------------------------------------------------------------------------
    private void DrawWorldState()
    {
        m_isShowingWorldState = EditorGUILayout.Foldout(m_isShowingWorldState, "Current World State");

        if (m_isShowingWorldState)
        {
            WorldState      worldState = m_strategyPlanner.CurrentWorldState;
            WorldProperties properties = worldState.Properties;

            foreach (KeyValuePair <string, byte> property in properties)
            {
                GUIStyle style = new GUIStyle(EditorStyles.label);
                style.padding = new RectOffset(25, 0, 0, 0);
                EditorGUILayout.LabelField(property.Key + ": " + property.Value, style);
            }
        }
    }
Exemple #22
0
        public void SaveWorldProperties_DirectoryDoesNotExist()
        {
            var rootFolder = TestFolder + "/NotReal/world";

            var props = new WorldProperties
            {
                ChunkSize = new GridSize(2),
                WorldName = "New World",
            };

            var handler     = new WorldPropertiesHandler();
            var saveTask    = handler.Save(rootFolder, props);
            var saveResults = saveTask.FinishTask();

            Assert.IsInstanceOf(typeof(IOException), saveResults.Error);
            Assert.IsFalse(saveResults.SuccessfullySaved);
        }
Exemple #23
0
    void ApplyHorizontalVelocity()
    {
        float NewXDistance;

        if (IsGrounded)
        {
            if (FacingRight && Velocity.x > MaximumGroundSpeed)
            {
                Velocity.x = MaximumGroundSpeed;
            }

            if (!FacingRight && Velocity.x < -MaximumGroundSpeed)
            {
                Velocity.x = -MaximumGroundSpeed;
            }
        }
        else
        {
            if (FacingRight && Velocity.x > MaximumAirSpeedForward)
            {
                Velocity.x = MaximumAirSpeedForward;
            }

            if (FacingRight && Velocity.x < -MaximumAirSpeedBackward)
            {
                Velocity.x = -MaximumAirSpeedBackward;
            }

            if (!FacingRight && Velocity.x < -MaximumAirSpeedForward)
            {
                Velocity.x = -MaximumAirSpeedForward;
            }

            if (!FacingRight && Velocity.x > MaximumAirSpeedBackward)
            {
                Velocity.x = MaximumAirSpeedBackward;
            }
        }

        NewXDistance = Velocity.x * WorldProperties.GetDeltaTime();

        NewXDistance = ConstrainHorizontalVelocity(NewXDistance);

        transform.position += new Vector3(NewXDistance, 0, 0);
    }
        public void CreateWorld()
        {
            if (_hasWorldBeenCreated)
            {
                return;
            }

            var obj = new WorldProperties();

            obj.EntityType = 255;
            obj.Hours      = (byte)DateTime.Now.Hour;
            obj.Minutes    = (byte)DateTime.Now.Minute;
            obj.Weather    = 0;
            obj.LoadedIpl  = new List <string>();
            obj.RemovedIpl = new List <string>();

            lock (ServerEntities) ServerEntities.Add(1, obj);
            _hasWorldBeenCreated = true;
        }
        private void SaveAsClicked(object sender, RoutedEventArgs e)
        {
            SaveFileDialog sfd = new SaveFileDialog();

            if (!String.IsNullOrEmpty(Properties.Settings.Default.UsualFolder))
            {
                sfd.InitialDirectory = Properties.Settings.Default.UsualFolder;
            }
            sfd.DefaultExt   = "trsim";
            sfd.AddExtension = true;
            sfd.Filter       = "Tribe Sim Settings files|*.trsim";
            if (sfd.ShowDialog() == true)
            {
                WorldProperties.PersistChanges(sfd.FileName);
                Properties.Settings.Default.UsualFolder = System.IO.Path.GetDirectoryName(sfd.FileName);
                currentOpenedFileName = currentSavedFileName = sfd.SafeFileName;
                SetTitle();
            }
        }
Exemple #26
0
    // Start is called before the first frame update
    void Start()
    {
        //Setup the backdrop (All possible backdrops will later be sorted and stored under the empty object 'backdrops' to be added
        back = GameObject.Find("a1z1s1backDrop");
        back.SetActive(true);


        //Retrieves Hero slots and WorldProperties
        h1         = GameObject.Find("HeroInstance1");
        h2         = GameObject.Find("HeroInstance2");
        h3         = GameObject.Find("HeroInstance3");
        worldProps = GetComponent <WorldProperties>();


        //Instantiate Heros by placing unit data from world properties slot into HeroInstance slot and activating instance;
        if (GetComponent <WorldProperties>().h1 != null)
        {
            (h1.GetComponent(typeof(StateProperties)) as StateProperties).data = worldProps.h1;
            h1.SetActive(true);
            //Instantiate(heroIn, transform.Find("Slot1Spawner").transform.position, transform.Find("Slot1Spawner").localRotation, transform);
        }

        if (GetComponent <WorldProperties>().h2 != null)
        {
            (h2.GetComponent(typeof(StateProperties)) as StateProperties).data = worldProps.h2;
            h2.SetActive(true);
        }

        if (GetComponent <WorldProperties>().h3 != null)
        {
            (h3.GetComponent(typeof(StateProperties)) as StateProperties).data = worldProps.h3;
            h3.SetActive(true);
        }



        backDrop      = transform.Find("BackDrop");
        floor         = transform.Find("Floor");
        startPosition = backDrop.position;
        tileSizeX     = 18.5f;
        scrollSpeed   = 5f;
    }
Exemple #27
0
        public GeoTiffProvider(string tiffPath, List <Color> noDataColors = null)
        {
            MemoryStream data;

            if (!File.Exists(tiffPath))
            {
                throw new ArgumentException(string.Format("Tiff file expected at {0}", tiffPath));
            }

            string worldPath = GetPathWithoutExtension(tiffPath) + WorldExtention;

            if (!File.Exists(worldPath))
            {
                throw new ArgumentException(string.Format("World file expected at {0}", worldPath));
            }

            TiffProperties  tiffProperties  = LoadTiff(tiffPath);
            WorldProperties worldProperties = LoadWorld(worldPath);

            _extent = CalculateExtent(tiffProperties, worldProperties);

            try
            {
                try
                {
                    data = ReadImageAsStream(tiffPath, noDataColors);
                }
                catch (OutOfMemoryException e)
                {
                    throw new OutOfMemoryException("Out of memory", e.InnerException);
                }
            }
            catch (ExternalException e)
            {
                throw new ExternalException(e.Message, e.InnerException);
            }

            _feature = new Feature {
                Geometry = new Raster(data, _extent)
            };
            _feature.Styles.Add(new VectorStyle());
        }
Exemple #28
0
    void ApplyHorizontalVelocity()
    {
        float NewXDistance;

        if (Velocity.x > MaximumSpeed)
        {
            Velocity.x = MaximumSpeed;
        }

        if (Velocity.x < -MaximumSpeed)
        {
            Velocity.x = -MaximumSpeed;
        }

        NewXDistance = Velocity.x * WorldProperties.GetDeltaTime();

        NewXDistance = ConstrainHorizontalVelocity(NewXDistance);

        transform.position += new Vector3(NewXDistance, 0, 0);
    }
Exemple #29
0
    void ApplyVerticalVelocity()
    {
        float NewYDistance;

        if (Velocity.y > MaximumSpeed)
        {
            Velocity.y = MaximumSpeed;
        }

        if (Velocity.y < -MaximumSpeed)
        {
            Velocity.y = -MaximumSpeed;
        }

        NewYDistance = Velocity.y * WorldProperties.GetDeltaTime();

        NewYDistance = ConstrainVerticalVelocity(NewYDistance);

        transform.position += new Vector3(0, NewYDistance, 0);
    }
	// Use this for initialization
	void Start () {
		// Instantiate internal managers
		gui = gameObject.AddComponent<GUIManager>();
        musicManager = (GameObject) Instantiate(Resources.Load(ResourcePaths.musicManager), Vector3.zero, Quaternion.identity);
        musicManager.transform.SetParent(transform);
        soundManager = (GameObject) Instantiate(Resources.Load(ResourcePaths.soundManager), Vector3.zero, Quaternion.identity);
        soundManager.transform.SetParent(transform);
        music = musicManager.GetComponent<MusicManager>();
        sound = soundManager.GetComponent<SoundManager>();
        objects = gameObject.AddComponent<ObjectManager>();
		levels = gameObject.AddComponent<LevelGenerator>();
        art = gameObject.GetComponent<LayerManager>();
		reactionTable = new ReactionTable();

        if(layerTracks.Length > 0)
        {
            music.clips = layerTracks;
        }
        //Find camera if not explicitly done in the Editor (this is a failsafe.. shouldn't rely on this)
        if (!mainCamera)
        {
            mainCamera = GameObject.Find("Main Camera");
        }

        // Start first level
        state = GameState.loading;
        PopulateReactionTable();

        //This is just so the old "Gameplay" scene doesn't break
        #pragma warning disable 0618 // Type or member is obsolete
        if(Application.loadedLevelName == "Gameplay")
        {
            worldProperties = gameObject.AddComponent<WorldProperties>();
            levels.CreateSampleLevel();

            // Set the camera to follow the game's player
            mainCamera.GetComponent<CameraFollow>().SetPlayer(ref worldProperties.player);
        }
        #pragma warning restore 0618 // Type or member is obsolete
    }
Exemple #31
0
    void OnClickEvent()
    {
        Drone selectedDrone = WorldProperties.GetSelectedDrone();
        ROSDroneConnectionInterface droneROSConnection = selectedDrone.droneProperties.droneROSConnection;

        if (startMission)
        {
            Debug.Log("Start mission button clicked");
            droneROSConnection.StartMission();
        }

        if (pauseMission)
        {
            droneROSConnection.PauseMission();
        }

        if (resumeMission)
        {
            droneROSConnection.ResumeMission();
        }


        if (clearWaypoints)
        {
            selectedDrone.DeleteAllWaypoints();
        }


        if (landDrone)
        {
            droneROSConnection.LandDrone();
        }


        if (homeDrone)
        {
            droneROSConnection.FlyHome();
        }
    }
    public new static void CallBack(ROSBridgeMsg msg)
    {
        //Debug.Log("Drone Position Callback");

        GameObject robot = GameObject.FindWithTag("Drone");

        if (robot != null)
        {
            DronePositionMsg pose = (DronePositionMsg)msg;

            robot.transform.localPosition = WorldProperties.RosSpaceToWorldSpace(pose._x, pose._y, pose._z) +
                                            WorldProperties.droneModelOffset;

            Vector3 tablePos = GameObject.FindWithTag("Table").transform.position;
            robot.transform.localPosition = new Vector3(-pose._x, pose._z + tablePos.z + 0.148f, -pose._y);

            SaveData();
        }
        else
        {
            Debug.Log("The RosDroneSubscriber script can't find the robot.");
        }
    }
        public GeoTiffProvider(string tiffPath, List<Color> noDataColors = null)
        {
            if (!File.Exists(tiffPath))
            {
                throw new ArgumentException(string.Format("Tiff file expected at {0}", tiffPath));
            }

            worldPath = GetPathWithoutExtension(tiffPath) + WorldExtention;
            if (!File.Exists(worldPath))
            {
                throw new ArgumentException(string.Format("World file expected at {0}", worldPath));
            }

            tiffProperties = LoadTiff(tiffPath);
            worldProperties = LoadWorld(worldPath);
            extent = CalculateExtent(tiffProperties, worldProperties);

            try
            {
                try
                {
                    data = ReadImageAsStream(tiffPath, noDataColors);
                }
                catch (OutOfMemoryException e)
                {
                    throw new OutOfMemoryException("Out of memory", e.InnerException);
                }
            }
            catch (ExternalException e)
            {
                throw new ExternalException(e.Message, e.InnerException);
            }

            feature = new Feature { Geometry = new Raster(data, extent) };
            feature.Styles.Add(new VectorStyle());
        }
        private void MenuItem_OpenClicked(object sender, RoutedEventArgs e)
        {
            OpenFileDialog dialog = new OpenFileDialog();

            if (!String.IsNullOrEmpty(Properties.Settings.Default.UsualFolder))
            {
                dialog.InitialDirectory = Properties.Settings.Default.UsualFolder;
            }
            dialog.Multiselect  = false;
            dialog.DefaultExt   = "trsim";
            dialog.AddExtension = true;
            dialog.Filter       = "Tribe Sim Settings files|*.trsim";
            if (dialog.ShowDialog() == true)
            {
                WorldProperties.LoadPersistance(dialog.FileName);

                currentOpenedFileName = dialog.SafeFileName;
                if (currentSavedFileName != currentOpenedFileName)
                {
                    currentSavedFileName = "";
                }
                SetTitle();

                Properties.Settings.Default.UsualFolder = System.IO.Path.GetDirectoryName(dialog.FileName);

                PropertyTree properties = WorldProperties.PropertyTree;
                suppressExpansionEvents = true;
                PropertiesTree.Items.Clear();
                foreach (string name in properties.treeBranches.Keys)
                {
                    PropertiesTree.Items.Add(CreateTreeViewItemFor(properties.treeBranches[name], name));
                }
                ExpandAsPerList();
                suppressExpansionEvents = false;
            }
        }
 public override void DrawCall(SpriteBatch spriteBatch, WorldProperties worldProperties)
 {
     // we need to pass a zero vector to the draw call, because the particle engine always is at 0,0
     worldProperties.Position = Vector2.Zero;
     base.DrawCall(spriteBatch, worldProperties);
 }
 /// <summary>
 /// Applies the properties.
 /// </summary>
 /// <param name="properties">Properties.</param>
 void applyProperties(WorldProperties properties)
 {
     worldLightAnimator.gameObject.SetActive(properties.isWorldLightOn);
 }
Exemple #37
0
        public override void Draw(SpriteBatch spriteBatch, WorldProperties worldProperties)
        {
            this.Texture = CurrentTexture;

            base.Draw(spriteBatch, worldProperties);
        }